sxy-test-runner 2.5.0 → 2.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/AGENTS.md +9 -1
  2. package/dist/cli/cliTypes.d.ts +1 -0
  3. package/dist/cli/cliTypes.js.map +1 -1
  4. package/dist/cli/init.js +3 -0
  5. package/dist/cli/init.js.map +1 -1
  6. package/dist/cli/lib/addBasePath.js +1 -1
  7. package/dist/cli/lib/addBasePath.js.map +1 -1
  8. package/dist/cli/lib/buildDependencyTrees.d.ts +1 -1
  9. package/dist/cli/lib/buildDependencyTrees.js +2 -2
  10. package/dist/cli/lib/buildDependencyTrees.js.map +1 -1
  11. package/dist/cli/lib/defaultConfig.js +1 -0
  12. package/dist/cli/lib/defaultConfig.js.map +1 -1
  13. package/dist/cli/lib/failureEntries.js +6 -3
  14. package/dist/cli/lib/failureEntries.js.map +1 -1
  15. package/dist/cli/lib/filter.js +2 -2
  16. package/dist/cli/lib/filter.js.map +1 -1
  17. package/dist/cli/lib/findTestFiles.js +1 -1
  18. package/dist/cli/lib/findTestFiles.js.map +1 -1
  19. package/dist/cli/lib/parseCommandLineArguments.js +20 -8
  20. package/dist/cli/lib/parseCommandLineArguments.js.map +1 -1
  21. package/dist/cli/lib/parseDescribe.js +1 -1
  22. package/dist/cli/lib/parseDescribe.js.map +1 -1
  23. package/dist/cli/lib/runDescribe.js +1 -1
  24. package/dist/cli/lib/runDescribe.js.map +1 -1
  25. package/dist/cli/lib/runDescribeRun.js +1 -1
  26. package/dist/cli/lib/runDescribeRun.js.map +1 -1
  27. package/dist/cli/lib/runIt.js +1 -1
  28. package/dist/cli/lib/runIt.js.map +1 -1
  29. package/dist/cli/lib/runTests.js +9 -188
  30. package/dist/cli/lib/runTests.js.map +1 -1
  31. package/dist/cli/lib/showFailuresColorized.d.ts +2 -0
  32. package/dist/cli/lib/showFailuresColorized.js +52 -0
  33. package/dist/cli/lib/showFailuresColorized.js.map +1 -0
  34. package/dist/cli/lib/showTestFileResult.d.ts +7 -0
  35. package/dist/cli/lib/{showTestResult.js → showTestFileResult.js} +15 -9
  36. package/dist/cli/lib/showTestFileResult.js.map +1 -0
  37. package/dist/cli/lib/showTestResultsSummary.d.ts +8 -0
  38. package/dist/cli/lib/showTestResultsSummary.js +213 -0
  39. package/dist/cli/lib/showTestResultsSummary.js.map +1 -0
  40. package/dist/cli/lib/timeProfiler.d.ts +3 -0
  41. package/dist/cli/lib/{timeProfier.js → timeProfiler.js} +1 -1
  42. package/dist/cli/lib/timeProfiler.js.map +1 -0
  43. package/dist/cli/lib/validateConfig.js +3 -0
  44. package/dist/cli/lib/validateConfig.js.map +1 -1
  45. package/dist/cli/lib/watchFilesAndRunTestsNodeWatch.js +3 -3
  46. package/dist/cli/lib/watchFilesAndRunTestsNodeWatch.js.map +1 -1
  47. package/dist/cli/lib/watchFilesNodeWatch.js +3 -3
  48. package/dist/cli/lib/watchFilesNodeWatch.js.map +1 -1
  49. package/dist/cli/once.js +4 -2
  50. package/dist/cli/once.js.map +1 -1
  51. package/dist/cli/watch.d.ts +1 -1
  52. package/dist/cli/watch.js +8 -5
  53. package/dist/cli/watch.js.map +1 -1
  54. package/dist/packages/timeProfiler.d.ts +1 -1
  55. package/dist/packages/timeProfiler.js.map +1 -1
  56. package/dist/types.d.ts +1 -0
  57. package/dist/types.js.map +1 -1
  58. package/package.json +2 -3
  59. package/dist/cli/lib/showTestResult.d.ts +0 -4
  60. package/dist/cli/lib/showTestResult.js.map +0 -1
  61. package/dist/cli/lib/timeProfier.d.ts +0 -3
  62. package/dist/cli/lib/timeProfier.js.map +0 -1
package/AGENTS.md CHANGED
@@ -490,7 +490,7 @@ line ending in `:` - because the lines after the first are often the point: `nod
490
490
  puts only a preamble on the first, with the values below, so its failure reads
491
491
  `AssertionError: Expected values to be strictly equal: 1 !== 2`, and a deep-equal diff reads
492
492
  `... deep-equal: + actual - expected / { / + a: 1, / - a: 2 / }`. Blank lines are
493
- dropped and the message is cut at 300 characters; the terminal keeps the full diff.
493
+ dropped and the message is cut at 500 characters; the terminal keeps the full diff.
494
494
 
495
495
  In `once`, read the process's exit code for pass/fail and the `status` on `done` for what
496
496
  kind of failure it was - `status=failed` accompanies exit `20`. `watching` and `change`
@@ -515,6 +515,7 @@ export default {
515
515
  testsIgnore: '**/node_modules/**',
516
516
  showErrorTrace: true,
517
517
  compact: false,
518
+ restateFailures: true,
518
519
  agent: false,
519
520
 
520
521
  setup: undefined,
@@ -548,6 +549,13 @@ export default {
548
549
  Set `showErrorTrace: true` when an agent needs stack traces for test failures. With the
549
550
  default `false`, failure output is intentionally shorter.
550
551
 
552
+ `restateFailures` (default `true`) repeats a failed run's failures in full under a
553
+ `Failures:` heading, just above the tallies, so they are still on screen after a long run.
554
+ It is skipped when nothing or everything failed, and when there are more than 10 failures
555
+ and more than `1.7 × n^0.58` of the run's `n` tests, describes that threw and files that
556
+ would not load. It only affects the usual output; under `--agent` the `fail` lines already
557
+ list every failure.
558
+
551
559
  ## Maintaining this repository
552
560
 
553
561
  Source files live in `src/`; `dist/` is generated. Do not make a source fix only in
@@ -1,6 +1,7 @@
1
1
  export interface AllowedArgument {
2
2
  flag?: string;
3
3
  hasValue: boolean;
4
+ isGlob?: boolean;
4
5
  }
5
6
  export type AllowedArguments = Record<string, AllowedArgument>;
6
7
  export type AllowedFlags = Record<string, string>;
@@ -1 +1 @@
1
- {"version":3,"file":"cliTypes.js","sourceRoot":"","sources":["../../src/cli/cliTypes.ts"],"names":[],"mappings":"AACA,8EAA8E","sourcesContent":["\r\n// -- CLI argument parsing ---------------------------------------------------\r\n\r\nexport interface AllowedArgument {\r\n flag?: string\r\n hasValue: boolean\r\n}\r\n\r\nexport type AllowedArguments = Record<string, AllowedArgument>\r\nexport type AllowedFlags = Record<string, string>\r\nexport type ParsedArguments = Record<string, string | true>\r\n\r\nexport interface TestExecutionFilters {\r\n describe?: string\r\n it?: string\r\n}\r\n"]}
1
+ {"version":3,"file":"cliTypes.js","sourceRoot":"","sources":["../../src/cli/cliTypes.ts"],"names":[],"mappings":"AACA,8EAA8E","sourcesContent":["\r\n// -- CLI argument parsing ---------------------------------------------------\r\n\r\nexport interface AllowedArgument {\r\n flag?: string\r\n hasValue: boolean\r\n isGlob?: boolean\r\n}\r\n\r\nexport type AllowedArguments = Record<string, AllowedArgument>\r\nexport type AllowedFlags = Record<string, string>\r\nexport type ParsedArguments = Record<string, string | true>\r\n\r\nexport interface TestExecutionFilters {\r\n describe?: string\r\n it?: string\r\n}\r\n"]}
package/dist/cli/init.js CHANGED
@@ -69,6 +69,9 @@ export default {
69
69
  // glob pattern or array of patterns of test files to ignore
70
70
  testsIgnore: ['**/node_modules/**'],
71
71
 
72
+ // repeat the failures above the tallies at the end of a run, when there are a small number of them
73
+ restateFailures: true,
74
+
72
75
  // whether to show the full error trace when an error occurs in a test file
73
76
  showErrorTrace: false,
74
77
 
@@ -1 +1 @@
1
- {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/cli/init.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,MAAM,IAAI,CAAA;AAEnB,OAAO,KAAK,MAAM,sBAAsB,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACrF,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAG9C,MAAM,UAAU,IAAI;IAChB,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAA;IAEhC,KAAK,MAAM,cAAc,IAAI,eAAe,EAAE,CAAC;QAC3C,KAAK,MAAM,cAAc,IAAI,eAAe,EAAE,CAAC;YAC3C,IAAI,GAAG,CAAA;YACP,GAAG,GAAG,IAAI,CAAC,UAAU,EAAE,cAAc,EAAE,cAAc,GAAG,KAAK,CAAC,C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ourcesContent":["\nimport { join } from 'path'\nimport fs from 'fs'\n\nimport chalk from '../packages/chalk.js'\nimport { packageName, cliName, configFileNames, configLocations } from '../config.js'\nimport { out } from '../output.js'\nimport { exitCodes } from './lib/exitCodes.js'\n\n\nexport function init(): void {\n const projectDir = process.cwd()\n\n for (const configLocation of configLocations) {\n for (const configFileName of configFileNames) {\n let loc\n loc = join(projectDir, configLocation, configFileName + '.js')\n if (fs.existsSync(loc)) {\n configAlreadyExists(loc)\n }\n loc = join(projectDir, configLocation, configFileName + '.cjs')\n if (fs.existsSync(loc)) {\n configAlreadyExists(loc)\n }\n loc = join(projectDir, configLocation, configFileName + '.mjs')\n if (fs.existsSync(loc)) {\n configAlreadyExists(loc)\n }\n }\n }\n\n function configAlreadyExists(loc: string): never {\n reportAndExit(`[${packageName}] A matching config already exists at ${loc}`\n + `\\nPlease remove this config before generating a new one with \\`${cliName} init\\``)\n }\n\n const projectPackageJsonLocation = join(projectDir, 'package.json')\n if (!fs.existsSync(projectPackageJsonLocation)) {\n reportAndExit(`[${packageName}] No package.json exists in this location`\n + '\\nPlease initialise the package with `npm init` or `yarn init`'\n + ' before running this command, and run this command from the project root folder')\n }\n\n let packageJson: { type?: string }\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n packageJson = JSON.parse(fs.readFileSync(projectPackageJsonLocation, 'utf8'))\n } catch (error) {\n reportAndExit(`[${packageName}] Could not read the package.json at ${projectPackageJsonLocation}`\n + `\\n${error instanceof Error ? error.message : String(error)}`\n + '\\nPlease make sure the file is readable and contains valid JSON, then try again')\n }\n\n const targetConfigName = (packageJson.type === 'module')\n // ES6 module\n ? join(projectDir, configLocations[0] ?? '', configFileNames[0] + '.js')\n // common\n : join(projectDir, configLocations[0] ?? '', configFileNames[0] + '.mjs')\n\n const defaultConfig =\n `\n// @ts-check\n\n/** @type {import('sxy-test-runner').Config} */\nexport default {\n\n // base folder for tests match and ignore patterns\n testsBase: '.',\n\n // glob pattern or array of glob patterns of test files\n tests: [\n '**/*.sxyt.{js,mjs,jsx}',\n '**/*.test.{js,mjs,jsx}',\n '**/*.spec.{js,mjs,jsx}',\n '**/tests?/*.{js,mjs,jsx}',\n '**/__tests?__/*.{js,mjs,jsx}'\n ],\n\n // glob pattern or array of patterns of test files to ignore\n testsIgnore: ['**/node_modules/**'],\n\n // whether to show the full error trace when an error occurs in a test file\n showErrorTrace: false,\n\n // drop the blank lines within each test file's output, does nothing when agent: is true\n compact: false,\n\n // report only minimal info, failures and results, as single lines, suited for agents\n agent: false,\n\n\n // tasks to run on startup\n // accepts a function, file location (relative to project base), or array of functions and or files\n setup: undefined,\n\n // tasks to run before each test file is run\n beforeEachFile: undefined,\n\n // tasks to run after each test file is run\n afterEachFile: undefined,\n\n // tasks to run before each describe block is processed\n // if the function returns an object with named properties, or the file exports named exports,\n // these will be passed to the callback function in argument 0, and can be access by destructruing e.g.\n // describe('thing', ({exportA, exportB}) => { it('should', ...) })\n beforeEachDescribe: undefined,\n\n // tasks to run after each describe block\n afterEachDescribe: undefined,\n\n // tasks to run before each it/test block\n // function returns and file exports will be passed to the it/test block as with describe above, e.g.\n // it('should', ({exportA, exportB}) => { assert('something') })\n beforeEachTest: undefined,\n\n // tasks to run after each it/test block\n afterEachTest: undefined,\n\n // tasks to run once the whole run has finished\n teardown: undefined,\n\n // how to execute the different parts of test files\n execution: {\n\n // run test files in 'parallel' or 'sequential'ly\n files: 'sequential',\n\n // run describe blocks within a test file in 'parallel' or 'sequential'ly\n describes: 'sequential',\n\n // run it/test blocks within a describe blocks in 'parallel' or 'sequential'ly\n tests: 'sequential'\n\n },\n\n // watch mode configurations\n watch: {\n\n //// the base directory to watch files in\n watchFilesBase: '.',\n\n //// glob filter or array of glob filters of files to watch\n watchFiles: '**/*.js',\n\n //// glob filter or array of globl filters of files to ignore\n watchFilesIgnore: '**/node_modules/**',\n\n // run all tests when starting the watcher\n runAllOnStartup: true,\n\n // re run all previously failed tests on each test run, until they pass\n reRunFailingTests: true,\n\n // evaluate the dependencies of each test file, and re-run that test file only when they change. \n // Set this to false to re-run everything on any change\n dependencyEvaluation: true,\n\n // run watch mode keyboard commands immediately, without waiting for Enter\n ttyActionsOnKeypress: false,\n\n // file to write the latest run status to, or false for none\n statusFile: false,\n\n },\n\n}`\n\n try {\n fs.writeFileSync(targetConfigName, defaultConfig)\n } catch (error) {\n reportAndExit(`[${packageName}] Could not write the config to ${targetConfigName}`\n + `\\n${error instanceof Error ? error.message : String(error)}`\n + '\\nPlease check the folder is writable, then try again')\n }\n\n out(chalk.mediumgreen`[${packageName}] Created config at ` + chalk.blue(targetConfigName))\n}\n\n// init cannot continue past any of these, so they report in the error colour and stop\nfunction reportAndExit(message: string): never {\n out(chalk.mediumred(message))\n process.exit(exitCodes.usageError)\n}\n"]}
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/cli/init.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,MAAM,IAAI,CAAA;AAEnB,OAAO,KAAK,MAAM,sBAAsB,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACrF,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAG9C,MAAM,UAAU,IAAI;IAChB,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAA;IAEhC,KAAK,MAAM,cAAc,IAAI,eAAe,EAAE,CAAC;QAC3C,KAAK,MAAM,cAAc,IAAI,eAAe,EAAE,CAAC;YAC3C,IAAI,GAAG,CAAA;YACP,GAAG,GAAG,IAAI,CAAC,UAAU,EAAE,cAAc,EAAE,cAAc,GAAG,KAAK,CAAC,CAAA;YAC9D,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;gBACrB,mBAAmB,CAAC,GAAG,CA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GAAG,CAAC,WAAW,CAAC,IAAI,KAAK,QAAQ,CAAC;QACpD,aAAa;QACb,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;QACxE,SAAS;QACT,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAA;IAE7E,MAAM,aAAa,GACf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4GN,CAAA;IAEE,IAAI,CAAC;QACD,EAAE,CAAC,aAAa,CAAC,gBAAgB,EAAE,aAAa,CAAC,CAAA;IACrD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,aAAa,CAAC,IAAI,WAAW,mCAAmC,gBAAgB,EAAE;cAC5E,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;cAC7D,uDAAuD,CAAC,CAAA;IAClE,CAAC;IAED,GAAG,CAAC,KAAK,CAAC,WAAW,CAAA,IAAI,WAAW,sBAAsB,GAAG,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAA;AAC9F,CAAC;AAED,sFAAsF;AACtF,SAAS,aAAa,CAAC,OAAe;IAClC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IAC7B,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAA;AACtC,CAAC","sourcesContent":["\nimport { join } from 'path'\nimport fs from 'fs'\n\nimport chalk from '../packages/chalk.js'\nimport { packageName, cliName, configFileNames, configLocations } from '../config.js'\nimport { out } from '../output.js'\nimport { exitCodes } from './lib/exitCodes.js'\n\n\nexport function init(): void {\n const projectDir = process.cwd()\n\n for (const configLocation of configLocations) {\n for (const configFileName of configFileNames) {\n let loc\n loc = join(projectDir, configLocation, configFileName + '.js')\n if (fs.existsSync(loc)) {\n configAlreadyExists(loc)\n }\n loc = join(projectDir, configLocation, configFileName + '.cjs')\n if (fs.existsSync(loc)) {\n configAlreadyExists(loc)\n }\n loc = join(projectDir, configLocation, configFileName + '.mjs')\n if (fs.existsSync(loc)) {\n configAlreadyExists(loc)\n }\n }\n }\n\n function configAlreadyExists(loc: string): never {\n reportAndExit(`[${packageName}] A matching config already exists at ${loc}`\n + `\\nPlease remove this config before generating a new one with \\`${cliName} init\\``)\n }\n\n const projectPackageJsonLocation = join(projectDir, 'package.json')\n if (!fs.existsSync(projectPackageJsonLocation)) {\n reportAndExit(`[${packageName}] No package.json exists in this location`\n + '\\nPlease initialise the package with `npm init` or `yarn init`'\n + ' before running this command, and run this command from the project root folder')\n }\n\n let packageJson: { type?: string }\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n packageJson = JSON.parse(fs.readFileSync(projectPackageJsonLocation, 'utf8'))\n } catch (error) {\n reportAndExit(`[${packageName}] Could not read the package.json at ${projectPackageJsonLocation}`\n + `\\n${error instanceof Error ? error.message : String(error)}`\n + '\\nPlease make sure the file is readable and contains valid JSON, then try again')\n }\n\n const targetConfigName = (packageJson.type === 'module')\n // ES6 module\n ? join(projectDir, configLocations[0] ?? '', configFileNames[0] + '.js')\n // common\n : join(projectDir, configLocations[0] ?? '', configFileNames[0] + '.mjs')\n\n const defaultConfig =\n `\n// @ts-check\n\n/** @type {import('sxy-test-runner').Config} */\nexport default {\n\n // base folder for tests match and ignore patterns\n testsBase: '.',\n\n // glob pattern or array of glob patterns of test files\n tests: [\n '**/*.sxyt.{js,mjs,jsx}',\n '**/*.test.{js,mjs,jsx}',\n '**/*.spec.{js,mjs,jsx}',\n '**/tests?/*.{js,mjs,jsx}',\n '**/__tests?__/*.{js,mjs,jsx}'\n ],\n\n // glob pattern or array of patterns of test files to ignore\n testsIgnore: ['**/node_modules/**'],\n\n // repeat the failures above the tallies at the end of a run, when there are a small number of them\n restateFailures: true,\n\n // whether to show the full error trace when an error occurs in a test file\n showErrorTrace: false,\n\n // drop the blank lines within each test file's output, does nothing when agent: is true\n compact: false,\n\n // report only minimal info, failures and results, as single lines, suited for agents\n agent: false,\n\n\n // tasks to run on startup\n // accepts a function, file location (relative to project base), or array of functions and or files\n setup: undefined,\n\n // tasks to run before each test file is run\n beforeEachFile: undefined,\n\n // tasks to run after each test file is run\n afterEachFile: undefined,\n\n // tasks to run before each describe block is processed\n // if the function returns an object with named properties, or the file exports named exports,\n // these will be passed to the callback function in argument 0, and can be access by destructruing e.g.\n // describe('thing', ({exportA, exportB}) => { it('should', ...) })\n beforeEachDescribe: undefined,\n\n // tasks to run after each describe block\n afterEachDescribe: undefined,\n\n // tasks to run before each it/test block\n // function returns and file exports will be passed to the it/test block as with describe above, e.g.\n // it('should', ({exportA, exportB}) => { assert('something') })\n beforeEachTest: undefined,\n\n // tasks to run after each it/test block\n afterEachTest: undefined,\n\n // tasks to run once the whole run has finished\n teardown: undefined,\n\n // how to execute the different parts of test files\n execution: {\n\n // run test files in 'parallel' or 'sequential'ly\n files: 'sequential',\n\n // run describe blocks within a test file in 'parallel' or 'sequential'ly\n describes: 'sequential',\n\n // run it/test blocks within a describe blocks in 'parallel' or 'sequential'ly\n tests: 'sequential'\n\n },\n\n // watch mode configurations\n watch: {\n\n //// the base directory to watch files in\n watchFilesBase: '.',\n\n //// glob filter or array of glob filters of files to watch\n watchFiles: '**/*.js',\n\n //// glob filter or array of globl filters of files to ignore\n watchFilesIgnore: '**/node_modules/**',\n\n // run all tests when starting the watcher\n runAllOnStartup: true,\n\n // re run all previously failed tests on each test run, until they pass\n reRunFailingTests: true,\n\n // evaluate the dependencies of each test file, and re-run that test file only when they change. \n // Set this to false to re-run everything on any change\n dependencyEvaluation: true,\n\n // run watch mode keyboard commands immediately, without waiting for Enter\n ttyActionsOnKeypress: false,\n\n // file to write the latest run status to, or false for none\n statusFile: false,\n\n },\n\n}`\n\n try {\n fs.writeFileSync(targetConfigName, defaultConfig)\n } catch (error) {\n reportAndExit(`[${packageName}] Could not write the config to ${targetConfigName}`\n + `\\n${error instanceof Error ? error.message : String(error)}`\n + '\\nPlease check the folder is writable, then try again')\n }\n\n out(chalk.mediumgreen`[${packageName}] Created config at ` + chalk.blue(targetConfigName))\n}\n\n// init cannot continue past any of these, so they report in the error colour and stop\nfunction reportAndExit(message: string): never {\n out(chalk.mediumred(message))\n process.exit(exitCodes.usageError)\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { timeProfile } from './timeProfier.js';
1
+ import { timeProfile } from './timeProfiler.js';
2
2
  export function addBasePath(base, items) {
3
3
  return timeProfile('add base to globs', () => {
4
4
  if (base !== undefined && base !== '.' && base !== '') {
@@ -1 +1 @@
1
- {"version":3,"file":"addBasePath.js","sourceRoot":"","sources":["../../../src/cli/lib/addBasePath.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAG9C,MAAM,UAAU,WAAW,CAAC,IAAwB,EAAE,KAAkB;IACpE,OAAO,WAAW,CAAC,mBAAmB,EAAE,GAAG,EAAE;QACzC,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,EAAE,EAAE,CAAC;YACpD,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;gBACvB,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,IAAI,IAAI,EAAE,CAAC;gBACtC,CAAC,CAAC,GAAG,IAAI,IAAI,KAAK,EAAE,CAAA;QAC5B,CAAC;QACD,OAAO,KAAK,CAAA;IAChB,CAAC,CAAC,CAAA;AACN,CAAC","sourcesContent":["\nimport type { GlobPattern } from '../../types.js'\nimport { timeProfile } from './timeProfier.js'\n\n\nexport function addBasePath(base: string | undefined, items: GlobPattern): GlobPattern {\n return timeProfile('add base to globs', () => {\n if (base !== undefined && base !== '.' && base !== '') {\n return Array.isArray(items)\n ? items.map(item => `${base}/${item}`)\n : `${base}/${items}`\n }\n return items\n })\n}\n"]}
1
+ {"version":3,"file":"addBasePath.js","sourceRoot":"","sources":["../../../src/cli/lib/addBasePath.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAG/C,MAAM,UAAU,WAAW,CAAC,IAAwB,EAAE,KAAkB;IACpE,OAAO,WAAW,CAAC,mBAAmB,EAAE,GAAG,EAAE;QACzC,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,EAAE,EAAE,CAAC;YACpD,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;gBACvB,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,IAAI,IAAI,EAAE,CAAC;gBACtC,CAAC,CAAC,GAAG,IAAI,IAAI,KAAK,EAAE,CAAA;QAC5B,CAAC;QACD,OAAO,KAAK,CAAA;IAChB,CAAC,CAAC,CAAA;AACN,CAAC","sourcesContent":["\nimport type { GlobPattern } from '../../types.js'\nimport { timeProfile } from './timeProfiler.js'\n\n\nexport function addBasePath(base: string | undefined, items: GlobPattern): GlobPattern {\n return timeProfile('add base to globs', () => {\n if (base !== undefined && base !== '.' && base !== '') {\n return Array.isArray(items)\n ? items.map(item => `${base}/${item}`)\n : `${base}/${items}`\n }\n return items\n })\n}\n"]}
@@ -1,3 +1,3 @@
1
1
  import type { FinalConfig, DependencyTrees } from '../../types.js';
2
- export declare function buildDependencyTrees(config: FinalConfig, testFiles: Set<string>): Promise<DependencyTrees>;
2
+ export declare function buildDependencyTrees(config: FinalConfig, testFiles: Set<string>): DependencyTrees;
3
3
  //# sourceMappingURL=buildDependencyTrees.d.ts.map
@@ -2,9 +2,9 @@ import { createTimeProfiler } from '../../packages/timeProfiler.js';
2
2
  import { showTimeProfiling } from '../../config.js';
3
3
  import { debug } from '../../output.js';
4
4
  import { buildDependencyTree } from './buildDependencyTree.js';
5
- const { timeProfileAsync } = createTimeProfiler(showTimeProfiling);
5
+ const { timeProfile } = createTimeProfiler(showTimeProfiling);
6
6
  export function buildDependencyTrees(config, testFiles) {
7
- return timeProfileAsync('build dependency trees', () => {
7
+ return timeProfile('build dependency trees', () => {
8
8
  const dependencyTrees = {};
9
9
  for (const testFile of testFiles) {
10
10
  const dependencyTree = buildDependencyTree(config, testFile);
@@ -1 +1 @@
1
- {"version":3,"file":"buildDependencyTrees.js","sourceRoot":"","sources":["../../../src/cli/lib/buildDependencyTrees.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAG9D,MAAM,EAAE,gBAAgB,EAAE,GAAG,kBAAkB,CAAC,iBAAiB,CAAC,CAAA;AAElE,MAAM,UAAU,oBAAoB,CAAC,MAAmB,EAAE,SAAsB;IAC5E,OAAO,gBAAgB,CAAC,wBAAwB,EAAE,GAAG,EAAE;QACnD,MAAM,eAAe,GAAoB,EAAE,CAAA;QAE3C,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;YAC/B,MAAM,cAAc,GAAG,mBAAmB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;YAC5D,eAAe,CAAC,QAAQ,CAAC,GAAG,cAAc,CAAA;YAC1C,KAAK,CAAC,gBAAgB,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAA;QACtD,CAAC;QAED,OAAO,eAAe,CAAA;IAC1B,CAAC,CAAC,CAAA;AACN,CAAC","sourcesContent":["\nimport type { FinalConfig, DependencyTrees } from '../../types.js'\nimport { createTimeProfiler } from '../../packages/timeProfiler.js'\nimport { showTimeProfiling } from '../../config.js'\nimport { debug } from '../../output.js'\nimport { buildDependencyTree } from './buildDependencyTree.js'\n\n\nconst { timeProfileAsync } = createTimeProfiler(showTimeProfiling)\n\nexport function buildDependencyTrees(config: FinalConfig, testFiles: Set<string>): Promise<DependencyTrees> {\n return timeProfileAsync('build dependency trees', () => {\n const dependencyTrees: DependencyTrees = {}\n\n for (const testFile of testFiles) {\n const dependencyTree = buildDependencyTree(config, testFile)\n dependencyTrees[testFile] = dependencyTree\n debug('final dep tree', dependencyTrees[testFile])\n }\n\n return dependencyTrees\n })\n}\n"]}
1
+ {"version":3,"file":"buildDependencyTrees.js","sourceRoot":"","sources":["../../../src/cli/lib/buildDependencyTrees.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAG9D,MAAM,EAAE,WAAW,EAAE,GAAG,kBAAkB,CAAC,iBAAiB,CAAC,CAAA;AAE7D,MAAM,UAAU,oBAAoB,CAAC,MAAmB,EAAE,SAAsB;IAC5E,OAAO,WAAW,CAAC,wBAAwB,EAAE,GAAG,EAAE;QAC9C,MAAM,eAAe,GAAoB,EAAE,CAAA;QAE3C,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;YAC/B,MAAM,cAAc,GAAG,mBAAmB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;YAC5D,eAAe,CAAC,QAAQ,CAAC,GAAG,cAAc,CAAA;YAC1C,KAAK,CAAC,gBAAgB,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAA;QACtD,CAAC;QAED,OAAO,eAAe,CAAA;IAC1B,CAAC,CAAC,CAAA;AACN,CAAC","sourcesContent":["\nimport type { FinalConfig, DependencyTrees } from '../../types.js'\nimport { createTimeProfiler } from '../../packages/timeProfiler.js'\nimport { showTimeProfiling } from '../../config.js'\nimport { debug } from '../../output.js'\nimport { buildDependencyTree } from './buildDependencyTree.js'\n\n\nconst { timeProfile } = createTimeProfiler(showTimeProfiling)\n\nexport function buildDependencyTrees(config: FinalConfig, testFiles: Set<string>): DependencyTrees {\n return timeProfile('build dependency trees', () => {\n const dependencyTrees: DependencyTrees = {}\n\n for (const testFile of testFiles) {\n const dependencyTree = buildDependencyTree(config, testFile)\n dependencyTrees[testFile] = dependencyTree\n debug('final dep tree', dependencyTrees[testFile])\n }\n\n return dependencyTrees\n })\n}\n"]}
@@ -10,6 +10,7 @@ export const defaultConfig = {
10
10
  testsIgnore: ['**/node_modules/**'],
11
11
  showErrorTrace: false,
12
12
  compact: false,
13
+ restateFailures: true,
13
14
  agent: false,
14
15
  failFast: false,
15
16
  execution: {
@@ -1 +1 @@
1
- {"version":3,"file":"defaultConfig.js","sourceRoot":"","sources":["../../../src/cli/lib/defaultConfig.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,aAAa,GAAgB;IACtC,SAAS,EAAE,GAAG;IACd,KAAK,EAAE;QACH,wBAAwB;QACxB,wBAAwB;QACxB,wBAAwB;QACxB,0BAA0B;QAC1B,8BAA8B;KACjC;IACD,WAAW,EAAE,CAAC,oBAAoB,CAAC;IACnC,cAAc,EAAE,KAAK;IACrB,OAAO,EAAE,KAAK;IACd,KAAK,EAAE,KAAK;IACZ,QAAQ,EAAE,KAAK;IACf,SAAS,EAAE;QACP,KAAK,EAAE,YAAY;QACnB,SAAS,EAAE,YAAY;QACvB,KAAK,EAAE,YAAY;KACtB;IACD,KAAK,EAAE;QACH,cAAc,EAAE,GAAG;QACnB,UAAU,EAAE,SAAS;QACrB,gBAAgB,EAAE,oBAAoB;QACtC,eAAe,EAAE,IAAI;QACrB,iBAAiB,EAAE,IAAI;QACvB,oBAAoB,EAAE,IAAI;QAC1B,oBAAoB,EAAE,KAAK;QAC3B,UAAU,EAAE,KAAK;KACpB;CACJ,CAAA","sourcesContent":["\nimport type { FinalConfig } from '../../types.js'\n\n\nexport const defaultConfig: FinalConfig = {\n testsBase: '.',\n tests: [\n '**/*.sxyt.{js,mjs,jsx}',\n '**/*.test.{js,mjs,jsx}',\n '**/*.spec.{js,mjs,jsx}',\n '**/tests?/*.{js,mjs,jsx}',\n '**/__tests?__/*.{js,mjs,jsx}'\n ],\n testsIgnore: ['**/node_modules/**'],\n showErrorTrace: false,\n compact: false,\n agent: false,\n failFast: false,\n execution: {\n files: 'sequential',\n describes: 'sequential',\n tests: 'sequential'\n },\n watch: {\n watchFilesBase: '.',\n watchFiles: '**/*.js',\n watchFilesIgnore: '**/node_modules/**',\n runAllOnStartup: true,\n reRunFailingTests: true,\n dependencyEvaluation: true,\n ttyActionsOnKeypress: false,\n statusFile: false\n }\n}\n"]}
1
+ {"version":3,"file":"defaultConfig.js","sourceRoot":"","sources":["../../../src/cli/lib/defaultConfig.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,aAAa,GAAgB;IACtC,SAAS,EAAE,GAAG;IACd,KAAK,EAAE;QACH,wBAAwB;QACxB,wBAAwB;QACxB,wBAAwB;QACxB,0BAA0B;QAC1B,8BAA8B;KACjC;IACD,WAAW,EAAE,CAAC,oBAAoB,CAAC;IACnC,cAAc,EAAE,KAAK;IACrB,OAAO,EAAE,KAAK;IACd,eAAe,EAAE,IAAI;IACrB,KAAK,EAAE,KAAK;IACZ,QAAQ,EAAE,KAAK;IACf,SAAS,EAAE;QACP,KAAK,EAAE,YAAY;QACnB,SAAS,EAAE,YAAY;QACvB,KAAK,EAAE,YAAY;KACtB;IACD,KAAK,EAAE;QACH,cAAc,EAAE,GAAG;QACnB,UAAU,EAAE,SAAS;QACrB,gBAAgB,EAAE,oBAAoB;QACtC,eAAe,EAAE,IAAI;QACrB,iBAAiB,EAAE,IAAI;QACvB,oBAAoB,EAAE,IAAI;QAC1B,oBAAoB,EAAE,KAAK;QAC3B,UAAU,EAAE,KAAK;KACpB;CACJ,CAAA","sourcesContent":["\nimport type { FinalConfig } from '../../types.js'\n\n\nexport const defaultConfig: FinalConfig = {\n testsBase: '.',\n tests: [\n '**/*.sxyt.{js,mjs,jsx}',\n '**/*.test.{js,mjs,jsx}',\n '**/*.spec.{js,mjs,jsx}',\n '**/tests?/*.{js,mjs,jsx}',\n '**/__tests?__/*.{js,mjs,jsx}'\n ],\n testsIgnore: ['**/node_modules/**'],\n showErrorTrace: false,\n compact: false,\n restateFailures: true,\n agent: false,\n failFast: false,\n execution: {\n files: 'sequential',\n describes: 'sequential',\n tests: 'sequential'\n },\n watch: {\n watchFilesBase: '.',\n watchFiles: '**/*.js',\n watchFilesIgnore: '**/node_modules/**',\n runAllOnStartup: true,\n reRunFailingTests: true,\n dependencyEvaluation: true,\n ttyActionsOnKeypress: false,\n statusFile: false\n }\n}\n"]}
@@ -1,3 +1,4 @@
1
+ import { inspect } from 'node:util';
1
2
  export function failureEntries(testResults, erroringTests = {}) {
2
3
  const entries = [];
3
4
  for (const [file, test] of Object.entries(erroringTests)) {
@@ -44,10 +45,12 @@ function simplifyError(error) {
44
45
  const name = ('name' in error && typeof error.name === 'string') ? error.name : 'Error';
45
46
  return `${name}: ${joinLines(error.message)}`;
46
47
  }
47
- // eslint-disable-next-line @typescript-eslint/no-base-to-string -- only a fallback
48
- return joinLines(String(error));
48
+ if (typeof error === 'string')
49
+ return joinLines(error);
50
+ // breakLength keeps inspect from wrapping, so the result stays one line
51
+ return joinLines(inspect(error, { breakLength: Infinity }));
49
52
  }
50
- const messageLimit = 300;
53
+ const messageLimit = 500;
51
54
  // lines after the first often carry the point - node:assert's values, ensure's sightings - so
52
55
  // all are kept, joined to stay one line for the status file and the agent stream
53
56
  function joinLines(text) {
@@ -1 +1 @@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O,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC;SAClF,MAAM,CAAC,CAAC,QAAQ,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,QAAQ,KAAK,EAAE,CAAC;QACzC,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,QAAQ,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,CAAA;IACvE,OAAO,CAAC,MAAM,CAAC,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAA;AAC1F,CAAC","sourcesContent":["\nimport type { TestResult } from './runTest.js'\nimport type { TestFile } from './loadTestFile.js'\n\n\n// One failure, flattened. `describe` is absent when a file would not load, and `test` is\n// absent when the describe itself threw. Shared by the status file's nested tree and the\n// agent reporter's flat lines, so both describe a failure the same way.\nexport interface FailureEntry {\n file: string\n describe?: string\n test?: string\n error: string\n}\n\nexport function failureEntries(\n testResults: TestResult[],\n erroringTests: Record<string, TestFile> = {}\n): FailureEntry[] {\n const entries: FailureEntry[] = []\n\n for (const [file, test] of Object.entries(erroringTests)) {\n entries.push({ file, error: `did not load: ${loadError(test.error)}` })\n }\n\n for (const testResult of testResults) {\n for (const describeResult of testResult.describeResults) {\n if (describeResult.error !== undefined) {\n entries.push({\n file: testResult.file,\n describe: describeResult.thing,\n error: `threw: ${simplifyError(describeResult.error)}`\n })\n }\n\n for (const itResult of describeResult.itResults) {\n if (itResult.success !== false) continue\n entries.push({\n file: testResult.file,\n describe: describeResult.thing,\n test: itResult.should,\n error: simplifyError(itResult.error)\n })\n }\n }\n }\n\n return entries\n}\n\n// the loader stores its own preamble with the real cause on the line below, so the first\n// line alone says only that loading failed - which `did not load` has already said. Drop the\n// preamble and keep the cause, flattened: an import error can run to several lines.\nfunction loadError(error: unknown): string {\n if (typeof error !== 'string') return simplifyError(error)\n\n const cause = error.replace(/^Error loading file\\r?\\n/, '').replace(/\\s*[\\r\\n]+\\s*/g, ' ').trim()\n if (cause === '') return 'Error loading file'\n return (cause.length > 200) ? `${cause.slice(0, 200)}...` : cause\n}\n\nfunction simplifyError(error: unknown): string {\n if (error === undefined || error === null || error === false) return 'unknown error'\n\n if (typeof error === 'object' && 'message' in error && typeof error.message === 'string') {\n const name = ('name' in error && typeof error.name === 'string') ? error.name : 'Error'\n return `${name}: ${joinLines(error.message)}`\n }\n\n // eslint-disable-next-line @typescript-eslint/no-base-to-string -- only a fallback\n return joinLines(String(error))\n}\n\nconst messageLimit = 300\n\n// lines after the first often carry the point - node:assert's values, ensure's sightings - so\n// all are kept, joined to stay one line for the status file and the agent stream\nfunction joinLines(text: string): string {\n const joined = text.split(/\\r?\\n/).map(line => line.trim()).filter(line => line !== '')\n .reduce((previous, line) => (previous === '')\n ? line\n : previous + (previous.endsWith(':') ? ' ' : ' / ') + line, '')\n return (joined.length > messageLimit) ? `${joined.slice(0, messageLimit)}...` : joined\n}\n"]}
1
+ {"version":3,"file":"failureEntries.js","sourceRoot":"","sources":["../../../src/cli/lib/failureEntries.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAgBnC,MAAM,UAAU,cAAc,CAC1B,WAAyB,EACzB,gBAA0C,EAAE;IAE5C,MAAM,OAAO,GAAmB,EAAE,CAAA;IAElC,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC;QACvD,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,iBAAiB,SAAS,CAAC,IAA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AAC,CAAC,IAAI;QACN,CAAC,CAAC,QAAQ,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,CAAA;IACvE,OAAO,CAAC,MAAM,CAAC,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAA;AAC1F,CAAC","sourcesContent":["\nimport { inspect } from 'node:util'\n\nimport type { TestResult } from './runTest.js'\nimport type { TestFile } from './loadTestFile.js'\n\n\n// One failure, flattened. `describe` is absent when a file would not load, and `test` is\n// absent when the describe itself threw. Shared by the status file's nested tree and the\n// agent reporter's flat lines, so both describe a failure the same way.\nexport interface FailureEntry {\n file: string\n describe?: string\n test?: string\n error: string\n}\n\nexport function failureEntries(\n testResults: TestResult[],\n erroringTests: Record<string, TestFile> = {}\n): FailureEntry[] {\n const entries: FailureEntry[] = []\n\n for (const [file, test] of Object.entries(erroringTests)) {\n entries.push({ file, error: `did not load: ${loadError(test.error)}` })\n }\n\n for (const testResult of testResults) {\n for (const describeResult of testResult.describeResults) {\n if (describeResult.error !== undefined) {\n entries.push({\n file: testResult.file,\n describe: describeResult.thing,\n error: `threw: ${simplifyError(describeResult.error)}`\n })\n }\n\n for (const itResult of describeResult.itResults) {\n if (itResult.success !== false) continue\n entries.push({\n file: testResult.file,\n describe: describeResult.thing,\n test: itResult.should,\n error: simplifyError(itResult.error)\n })\n }\n }\n }\n\n return entries\n}\n\n// the loader stores its own preamble with the real cause on the line below, so the first\n// line alone says only that loading failed - which `did not load` has already said. Drop the\n// preamble and keep the cause, flattened: an import error can run to several lines.\nfunction loadError(error: unknown): string {\n if (typeof error !== 'string') return simplifyError(error)\n\n const cause = error.replace(/^Error loading file\\r?\\n/, '').replace(/\\s*[\\r\\n]+\\s*/g, ' ').trim()\n if (cause === '') return 'Error loading file'\n return (cause.length > 200) ? `${cause.slice(0, 200)}...` : cause\n}\n\nfunction simplifyError(error: unknown): string {\n if (error === undefined || error === null || error === false) return 'unknown error'\n\n if (typeof error === 'object' && 'message' in error && typeof error.message === 'string') {\n const name = ('name' in error && typeof error.name === 'string') ? error.name : 'Error'\n return `${name}: ${joinLines(error.message)}`\n }\n\n if (typeof error === 'string') return joinLines(error)\n // breakLength keeps inspect from wrapping, so the result stays one line\n return joinLines(inspect(error, { breakLength: Infinity }))\n}\n\nconst messageLimit = 500\n\n// lines after the first often carry the point - node:assert's values, ensure's sightings - so\n// all are kept, joined to stay one line for the status file and the agent stream\nfunction joinLines(text: string): string {\n const joined = text.split(/\\r?\\n/).map(line => line.trim()).filter(line => line !== '')\n .reduce((previous, line) => (previous === '')\n ? line\n : previous + (previous.endsWith(':') ? ' ' : ' / ') + line, '')\n return (joined.length > messageLimit) ? `${joined.slice(0, messageLimit)}...` : joined\n}\n"]}
@@ -1,8 +1,8 @@
1
- import minimatch from 'minimatch';
1
+ import { matchesGlob } from 'node:path';
2
2
  import { addBasePath } from './addBasePath.js';
3
3
  import { globArgCombine } from './globArgCombine.js';
4
4
  export function filter(testsBase, testFilter, testFile) {
5
5
  const filterGlob = addBasePath(testsBase, testFilter);
6
- return minimatch(testFile, globArgCombine(filterGlob));
6
+ return matchesGlob(testFile, globArgCombine(filterGlob));
7
7
  }
8
8
  //# sourceMappingURL=filter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"filter.js","sourceRoot":"","sources":["../../../src/cli/lib/filter.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,WAAW,CAAA;AAEjC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAGpD,MAAM,UAAU,MAAM,CAClB,SAAiB,EACjB,UAAkB,EAClB,QAAgB;IAEhB,MAAM,UAAU,GAAG,WAAW,CAAC,SAAS,EAAE,UAAU,CAAC,CAAA;IACrD,OAAO,SAAS,CAAC,QAAQ,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC,CAAA;AAC1D,CAAC","sourcesContent":["\nimport minimatch from 'minimatch'\n\nimport { addBasePath } from './addBasePath.js'\nimport { globArgCombine } from './globArgCombine.js'\n\n\nexport function filter(\n testsBase: string,\n testFilter: string,\n testFile: string,\n): boolean {\n const filterGlob = addBasePath(testsBase, testFilter)\n return minimatch(testFile, globArgCombine(filterGlob))\n}\n"]}
1
+ {"version":3,"file":"filter.js","sourceRoot":"","sources":["../../../src/cli/lib/filter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAEvC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAGpD,MAAM,UAAU,MAAM,CAClB,SAAiB,EACjB,UAAkB,EAClB,QAAgB;IAEhB,MAAM,UAAU,GAAG,WAAW,CAAC,SAAS,EAAE,UAAU,CAAC,CAAA;IACrD,OAAO,WAAW,CAAC,QAAQ,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC,CAAA;AAC5D,CAAC","sourcesContent":["\nimport { matchesGlob } from 'node:path'\n\nimport { addBasePath } from './addBasePath.js'\nimport { globArgCombine } from './globArgCombine.js'\n\n\nexport function filter(\n testsBase: string,\n testFilter: string,\n testFile: string,\n): boolean {\n const filterGlob = addBasePath(testsBase, testFilter)\n return matchesGlob(testFile, globArgCombine(filterGlob))\n}\n"]}
@@ -7,7 +7,7 @@ export async function findTestFiles(config) {
7
7
  const testsIgnoreGlobs = addBasePath(config.testsBase, config.testsIgnore);
8
8
  // Node's built-in glob replaces the globby/tinyglobby dependency (no import cost).
9
9
  // It yields OS-native separators, so slash() restores the forward-slash paths the
10
- // rest of the runner relies on (watch-mode minimatch filters, dependency-tree keys).
10
+ // rest of the runner relies on (watch-mode glob filters, dependency-tree keys).
11
11
  const files = new Set;
12
12
  for await (const file of glob(testsGlobs, {
13
13
  exclude: Array.isArray(testsIgnoreGlobs) ? testsIgnoreGlobs : [testsIgnoreGlobs]
@@ -1 +1 @@
1
- {"version":3,"file":"findTestFiles.js","sourceRoot":"","sources":["../../../src/cli/lib/findTestFiles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAGlC,OAAO,KAAK,MAAM,yBAAyB,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAGpC,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,MAAmB;IACnD,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,CAAA;IAC9D,MAAM,gBAAgB,GAAG,WAAW,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,CAAA;IAE1E,mFAAmF;IACnF,kFAAkF;IAClF,qFAAqF;IACrF,MAAM,KAAK,GAAG,IAAI,GAAW,CAAA;IAC7B,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE;QACtC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC;KACnF,CAAC,EAAE,CAAC;QACD,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,CAAA;QAC5B,IAAI,MAAM,CAAC,WAAW,KAAK,SAAS,IAAI,MAAM,CAAC,WAAW,KAAK,EAAE,EAAE,CAAC;YAChE,IAAI,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,WAAW,EAAE,QAAQ,CAAC;gBAAE,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;QACnF,CAAC;aAAM,CAAC;YACJ,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;QACvB,CAAC;IACL,CAAC;IAED,OAAO,KAAK,CAAA;AAChB,CAAC","sourcesContent":["\nimport { glob } from 'fs/promises'\n\nimport type { FinalConfig } from '../../types.js'\nimport slash from '../../packages/slash.js'\nimport { addBasePath } from './addBasePath.js'\nimport { filter } from './filter.js'\n\n\nexport async function findTestFiles(config: FinalConfig): Promise<Set<string>> {\n const testsGlobs = addBasePath(config.testsBase, config.tests)\n const testsIgnoreGlobs = addBasePath(config.testsBase, config.testsIgnore)\n\n // Node's built-in glob replaces the globby/tinyglobby dependency (no import cost).\n // It yields OS-native separators, so slash() restores the forward-slash paths the\n // rest of the runner relies on (watch-mode minimatch filters, dependency-tree keys).\n const files = new Set<string>\n for await (const file of glob(testsGlobs, {\n exclude: Array.isArray(testsIgnoreGlobs) ? testsIgnoreGlobs : [testsIgnoreGlobs]\n })) {\n const testFile = slash(file)\n if (config.testsFilter !== undefined && config.testsFilter !== '') {\n if (filter(config.testsBase, config.testsFilter, testFile)) files.add(testFile)\n } else {\n files.add(testFile)\n }\n }\n\n return files\n}\n"]}
1
+ {"version":3,"file":"findTestFiles.js","sourceRoot":"","sources":["../../../src/cli/lib/findTestFiles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAGlC,OAAO,KAAK,MAAM,yBAAyB,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAGpC,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,MAAmB;IACnD,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,CAAA;IAC9D,MAAM,gBAAgB,GAAG,WAAW,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,CAAA;IAE1E,mFAAmF;IACnF,kFAAkF;IAClF,gFAAgF;IAChF,MAAM,KAAK,GAAG,IAAI,GAAW,CAAA;IAC7B,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE;QACtC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC;KACnF,CAAC,EAAE,CAAC;QACD,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,CAAA;QAC5B,IAAI,MAAM,CAAC,WAAW,KAAK,SAAS,IAAI,MAAM,CAAC,WAAW,KAAK,EAAE,EAAE,CAAC;YAChE,IAAI,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,WAAW,EAAE,QAAQ,CAAC;gBAAE,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;QACnF,CAAC;aAAM,CAAC;YACJ,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;QACvB,CAAC;IACL,CAAC;IAED,OAAO,KAAK,CAAA;AAChB,CAAC","sourcesContent":["\nimport { glob } from 'fs/promises'\n\nimport type { FinalConfig } from '../../types.js'\nimport slash from '../../packages/slash.js'\nimport { addBasePath } from './addBasePath.js'\nimport { filter } from './filter.js'\n\n\nexport async function findTestFiles(config: FinalConfig): Promise<Set<string>> {\n const testsGlobs = addBasePath(config.testsBase, config.tests)\n const testsIgnoreGlobs = addBasePath(config.testsBase, config.testsIgnore)\n\n // Node's built-in glob replaces the globby/tinyglobby dependency (no import cost).\n // It yields OS-native separators, so slash() restores the forward-slash paths the\n // rest of the runner relies on (watch-mode glob filters, dependency-tree keys).\n const files = new Set<string>\n for await (const file of glob(testsGlobs, {\n exclude: Array.isArray(testsIgnoreGlobs) ? testsIgnoreGlobs : [testsIgnoreGlobs]\n })) {\n const testFile = slash(file)\n if (config.testsFilter !== undefined && config.testsFilter !== '') {\n if (filter(config.testsBase, config.testsFilter, testFile)) files.add(testFile)\n } else {\n files.add(testFile)\n }\n }\n\n return files\n}\n"]}
@@ -13,6 +13,13 @@ export function parseCommandLineArguments(allowedArguments) {
13
13
  // collected rather than reported one at a time, so a mistyped command line is fixed in
14
14
  // one go rather than one option per run
15
15
  const unknownArgs = [];
16
+ // a repeat is an error rather than an overwrite: a warning is easily missed, and the run
17
+ // would then quietly use only the last value
18
+ const givenValues = {};
19
+ const setArg = (longFlag, value) => {
20
+ (givenValues[longFlag] ??= []).push(value);
21
+ returnArgs[longFlag] = value;
22
+ };
16
23
  for (let position = 0; position < __sxyt_commandLineArguments.length; position++) {
17
24
  const arg = __sxyt_commandLineArguments[position];
18
25
  if (arg === undefined)
@@ -24,10 +31,10 @@ export function parseCommandLineArguments(allowedArguments) {
24
31
  if (allowedArgument.hasValue) {
25
32
  const value = __sxyt_commandLineArguments[++position];
26
33
  if (value !== undefined)
27
- returnArgs[longFlag] = value;
34
+ setArg(longFlag, value);
28
35
  }
29
36
  else {
30
- returnArgs[longFlag] = true;
37
+ setArg(longFlag, true);
31
38
  }
32
39
  }
33
40
  else {
@@ -47,17 +54,14 @@ export function parseCommandLineArguments(allowedArguments) {
47
54
  const shortFlag = arg.slice(1);
48
55
  const longFlag = allowedFlags[shortFlag];
49
56
  if (longFlag !== undefined) {
50
- if (longFlag in returnArgs) {
51
- log(chalk.orange(`[${packageName}] Option --${longFlag} already set, being overwritten by -${shortFlag}`));
52
- }
53
57
  const allowedArgument = allowedArguments[longFlag];
54
58
  if (allowedArgument?.hasValue === true) {
55
59
  const value = __sxyt_commandLineArguments[++position];
56
60
  if (value !== undefined)
57
- returnArgs[longFlag] = value;
61
+ setArg(longFlag, value);
58
62
  }
59
63
  else {
60
- returnArgs[longFlag] = true;
64
+ setArg(longFlag, true);
61
65
  }
62
66
  }
63
67
  else {
@@ -71,7 +75,15 @@ export function parseCommandLineArguments(allowedArguments) {
71
75
  }
72
76
  // stop rather than run something other than what was asked for: an ignored option can
73
77
  // mean the wrong tests, or a whole suite where a single filtered test was wanted
74
- if (unknownArgs.length > 0) {
78
+ const repeatedArgs = Object.entries(givenValues).filter(([, values]) => values.length > 1);
79
+ for (const [longFlag, values] of repeatedArgs) {
80
+ log(chalk.mediumred(`[${packageName}] Option --${longFlag} given more than once`));
81
+ if (allowedArguments[longFlag]?.isGlob === true) {
82
+ const bracePattern = `{${values.join(',')}}`;
83
+ log(chalk.mediumred(`To match several patterns, use one brace pattern: --${longFlag} "${bracePattern}"`));
84
+ }
85
+ }
86
+ if (unknownArgs.length > 0 || repeatedArgs.length > 0) {
75
87
  log(chalk.orange(`Run \`${cliName} help\` to see the available options.`));
76
88
  process.exit(exitCodes.usageError);
77
89
  }
@@ -1 +1 @@
1
- {"version":3,"file":"parseCommandLineArguments.js","sourceRoot":"","sources":["../../../src/cli/lib/parseCommandLineArguments.ts"],"names":[],"mappings":"AACA,SAAS;AACT,QAAQ;AACR,6BAA6B;AAG7B,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAG3D,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,MAAM,yBAAyB,CAAA;AAG3C,MAAM,UAAU,yBAAyB,CAAC,gBAAkC;IACxE,MAAM,YAAY,GAAG,eAAe,CAAC,gBAAgB,CAAC,CAAA;IAEtD,MAAM,UAAU,GAAoB,EAAE,CAAA;IACtC,uFAAuF;IACvF,wCAAwC;IACxC,MAAM,WAAW,GAAa,EAAE,CAAA;IAEhC,KAAK,IAAI,QAAQ,GAAG,CAAC,EAAE,QAAQ,GAAG,2BAA2B,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE,CAAC;QAC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SAAS,OAAO,uCAAuC,CAAC,CAAC,CAAA;QAC1E,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAA;IACtC,CAAC;IAED,OAAO,UAAU,CAAA;AACrB,CAAC","sourcesContent":["\n// watch:\n// once:\n// // --config configLocation\n\n\nimport { reduce as objectReduce } from 'sxy-lib/objects.js'\n\nimport type { AllowedArguments, ParsedArguments } from '../cliTypes.js'\nimport { packageName, cliName } from '../../config.js'\nimport { log } from '../../output.js'\nimport { exitCodes } from './exitCodes.js'\nimport { getAllowedFlags } from './getAllowedFlags.js'\nimport chalk from '../../packages/chalk.js'\n\n\nexport function parseCommandLineArguments(allowedArguments: AllowedArguments): ParsedArguments {\n const allowedFlags = getAllowedFlags(allowedArguments)\n\n const returnArgs: ParsedArguments = {}\n // collected rather than reported one at a time, so a mistyped command line is fixed in\n // one go rather than one option per run\n const unknownArgs: string[] = []\n\n for (let position = 0; position < __sxyt_commandLineArguments.length; position++) {\n const arg = __sxyt_commandLineArguments[position]\n if (arg === undefined) continue\n if (arg.slice(0, 2) === '--') {\n const longFlag = arg.slice(2)\n const allowedArgument = allowedArguments[longFlag]\n if (allowedArgument) {\n if (allowedArgument.hasValue) {\n const value = __sxyt_commandLineArguments[++position]\n if (value !== undefined) returnArgs[longFlag] = value\n } else {\n returnArgs[longFlag] = true\n }\n } else {\n unknownArgs.push(`--${longFlag}`)\n log(chalk.mediumred(`[${packageName}] Unknown option --${longFlag}`))\n if (\n longFlag.length === 1\n && objectReduce(\n allowedArguments,\n (prev: boolean, _key: string, value: {\n flag?: string\n hasValue: boolean\n }) => {\n if (value.flag === longFlag) return true\n return prev\n },\n false\n )\n ) {\n log(chalk.mediumred(`I think you meant -${longFlag}`))\n }\n }\n } else if (arg.slice(0, 1) === '-') {\n const shortFlag = arg.slice(1)\n const longFlag = allowedFlags[shortFlag]\n if (longFlag !== undefined) {\n if (longFlag in returnArgs) {\n log(chalk.orange(\n `[${packageName}] Option --${longFlag} already set, being overwritten by -${shortFlag}`\n ))\n }\n\n const allowedArgument = allowedArguments[longFlag]\n if (allowedArgument?.hasValue === true) {\n const value = __sxyt_commandLineArguments[++position]\n if (value !== undefined) returnArgs[longFlag] = value\n } else {\n returnArgs[longFlag] = true\n }\n } else {\n unknownArgs.push(`-${shortFlag}`)\n log(chalk.mediumred(`[${packageName}] Unknown flag -${shortFlag}`))\n if (shortFlag.length > 1 && shortFlag in allowedArguments) {\n log(chalk.mediumred(`I think you meant --${shortFlag}`))\n }\n }\n }\n }\n\n // stop rather than run something other than what was asked for: an ignored option can\n // mean the wrong tests, or a whole suite where a single filtered test was wanted\n if (unknownArgs.length > 0) {\n log(chalk.orange(`Run \\`${cliName} help\\` to see the available options.`))\n process.exit(exitCodes.usageError)\n }\n\n return returnArgs\n}\n"]}
1
+ {"version":3,"file":"parseCommandLineArguments.js","sourceRoot":"","sources":["../../../src/cli/lib/parseCommandLineArguments.ts"],"names":[],"mappings":"AACA,SAAS;AACT,QAAQ;AACR,6BAA6B;AAG7B,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAG3D,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,MAAM,yBAAyB,CAAA;AAG3C,MAAM,UAAU,yBAAyB,CAAC,gBAAkC;IACxE,MAAM,YAAY,GAAG,eAAe,CAAC,gBAAgB,CAAC,CAAA;IAEtD,MAAM,UAAU,GAAoB,EAAE,CAAA;IACtC,uFAAuF;IACvF,wCAAwC;IACxC,MAAM,WAAW,GAAa,EAAE,CAAA;IAChC,yFAAyF;IACzF,6CAA6C;IAC7C,MAAM,WAAW,GAAyC,EAAE,CAAA;IAC5D,MAAM,MAAM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ACL,CAAC;QACL,CAAC;IACL,CAAC;IAED,sFAAsF;IACtF,iFAAiF;IACjF,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;IAC1F,KAAK,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,YAAY,EAAE,CAAC;QAC5C,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,WAAW,cAAc,QAAQ,uBAAuB,CAAC,CAAC,CAAA;QAClF,IAAI,gBAAgB,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,EAAE,CAAC;YAC9C,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAA;YAC5C,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,uDAAuD,QAAQ,KAAK,YAAY,GAAG,CAAC,CAAC,CAAA;QAC7G,CAAC;IACL,CAAC;IAED,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpD,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,OAAO,uCAAuC,CAAC,CAAC,CAAA;QAC1E,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAA;IACtC,CAAC;IAED,OAAO,UAAU,CAAA;AACrB,CAAC","sourcesContent":["\n// watch:\n// once:\n// // --config configLocation\n\n\nimport { reduce as objectReduce } from 'sxy-lib/objects.js'\n\nimport type { AllowedArguments, ParsedArguments } from '../cliTypes.js'\nimport { packageName, cliName } from '../../config.js'\nimport { log } from '../../output.js'\nimport { exitCodes } from './exitCodes.js'\nimport { getAllowedFlags } from './getAllowedFlags.js'\nimport chalk from '../../packages/chalk.js'\n\n\nexport function parseCommandLineArguments(allowedArguments: AllowedArguments): ParsedArguments {\n const allowedFlags = getAllowedFlags(allowedArguments)\n\n const returnArgs: ParsedArguments = {}\n // collected rather than reported one at a time, so a mistyped command line is fixed in\n // one go rather than one option per run\n const unknownArgs: string[] = []\n // a repeat is an error rather than an overwrite: a warning is easily missed, and the run\n // would then quietly use only the last value\n const givenValues: Record<string, Array<string | true>> = {}\n const setArg = (longFlag: string, value: string | true): void => {\n (givenValues[longFlag] ??= []).push(value)\n returnArgs[longFlag] = value\n }\n\n for (let position = 0; position < __sxyt_commandLineArguments.length; position++) {\n const arg = __sxyt_commandLineArguments[position]\n if (arg === undefined) continue\n if (arg.slice(0, 2) === '--') {\n const longFlag = arg.slice(2)\n const allowedArgument = allowedArguments[longFlag]\n if (allowedArgument) {\n if (allowedArgument.hasValue) {\n const value = __sxyt_commandLineArguments[++position]\n if (value !== undefined) setArg(longFlag, value)\n } else {\n setArg(longFlag, true)\n }\n } else {\n unknownArgs.push(`--${longFlag}`)\n log(chalk.mediumred(`[${packageName}] Unknown option --${longFlag}`))\n if (\n longFlag.length === 1\n && objectReduce(\n allowedArguments,\n (prev: boolean, _key: string, value: {\n flag?: string\n hasValue: boolean\n }) => {\n if (value.flag === longFlag) return true\n return prev\n },\n false\n )\n ) {\n log(chalk.mediumred(`I think you meant -${longFlag}`))\n }\n }\n } else if (arg.slice(0, 1) === '-') {\n const shortFlag = arg.slice(1)\n const longFlag = allowedFlags[shortFlag]\n if (longFlag !== undefined) {\n const allowedArgument = allowedArguments[longFlag]\n if (allowedArgument?.hasValue === true) {\n const value = __sxyt_commandLineArguments[++position]\n if (value !== undefined) setArg(longFlag, value)\n } else {\n setArg(longFlag, true)\n }\n } else {\n unknownArgs.push(`-${shortFlag}`)\n log(chalk.mediumred(`[${packageName}] Unknown flag -${shortFlag}`))\n if (shortFlag.length > 1 && shortFlag in allowedArguments) {\n log(chalk.mediumred(`I think you meant --${shortFlag}`))\n }\n }\n }\n }\n\n // stop rather than run something other than what was asked for: an ignored option can\n // mean the wrong tests, or a whole suite where a single filtered test was wanted\n const repeatedArgs = Object.entries(givenValues).filter(([, values]) => values.length > 1)\n for (const [longFlag, values] of repeatedArgs) {\n log(chalk.mediumred(`[${packageName}] Option --${longFlag} given more than once`))\n if (allowedArguments[longFlag]?.isGlob === true) {\n const bracePattern = `{${values.join(',')}}`\n log(chalk.mediumred(`To match several patterns, use one brace pattern: --${longFlag} \"${bracePattern}\"`))\n }\n }\n\n if (unknownArgs.length > 0 || repeatedArgs.length > 0) {\n log(chalk.orange(`Run \\`${cliName} help\\` to see the available options.`))\n process.exit(exitCodes.usageError)\n }\n\n return returnArgs\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { timeProfileAsync } from './timeProfier.js';
1
+ import { timeProfileAsync } from './timeProfiler.js';
2
2
  import { runTasks } from './runTasks.js';
3
3
  import { addExports } from './addExports.js';
4
4
  class SxytNotAFunctionError extends Error {
@@ -1 +1 @@
1
- {"version":3,"file":"parseDescribe.js","sourceRoot":"","sources":["../../../src/cli/lib/parseDescribe.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAG5C,MAAM,qBAAsB,SAAQ,KAAK;IACrC,IAAI,GAAG,uBAAuB,CAAA;CACjC;AACD,MAAM,uBAAwB,SAAQ,KAAK;IACvC,IAAI,GAAG,yBAAyB,CAAA;CACnC;AAED,SAAS,yBAAyB,CAAC,KAAa,EAAE,IAAa;IAC3D,MAAM,IAAI,qBAAqB,CAAC,GAAG,KAAK,gCAAgC,KAAK,wBAAwB;UAC/F,aAAa,OAAO,IAAI,EAAE,CAAC,CAAA;AACrC,CAAC;AAED,SAAS,wBAAwB,CAAC,KAAa;IAC3C,MAAM,IAAI,uBAAuB,CAAC,GAAG,KAAK,aAAa,KAAK,+BAA+B;UACrF,iCAAiC,CAAC,CAAA;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;AACL,CAAC","sourcesContent":["\nimport type { FinalConfig, Describe, DescribeParcel, It, ParsedDescribe, TaskExports } from '../../types.js'\nimport { timeProfileAsync } from './timeProfier.js'\nimport { runTasks } from './runTasks.js'\nimport { addExports } from './addExports.js'\n\n\nclass SxytNotAFunctionError extends Error {\n name = 'SxytNotAFunctionError'\n}\nclass SxytAlreadyDefinedError extends Error {\n name = 'SxytAlreadyDefinedError'\n}\n\nfunction throwMustBeAFunctionError(fname: string, func: unknown): never {\n throw new SxytNotAFunctionError(`${fname}() error, argument passed to ${fname}() must be a function,`\n + ` received ${typeof func}`)\n}\n\nfunction throwAlreadyDefinedError(fname: string): never {\n throw new SxytAlreadyDefinedError(`${fname}() error, ${fname} function is already defined.`\n + ' Only one function is permitted')\n}\n\nexport function parseDescribe(\n config: FinalConfig,\n describe: Describe,\n itFilter?: string\n): Promise<ParsedDescribe> {\n return timeProfileAsync(`parse its from describe ${describe.thing}`, async () => {\n let itCounter = 1\n const its: It[] = []\n\n // create functions to pass back\n\n // afterDescribe\n let afterDescribeFunc: (() => void | Promise<void>) | undefined\n function afterDescribe(func: () => void | Promise<void>): void {\n if (typeof func !== 'function') {\n throwMustBeAFunctionError('afterDescribe', func)\n }\n if (afterDescribeFunc !== undefined) {\n throwAlreadyDefinedError('afterDescribe')\n }\n afterDescribeFunc = func\n }\n\n // beforeEachTest\n let beforeEachTestFunc: (() => TaskExports | void | Promise<TaskExports | void>) | undefined\n function beforeEachTest(func: () => TaskExports | void | Promise<TaskExports | void>): void {\n if (typeof func !== 'function') {\n throwMustBeAFunctionError('beforeEachTest', func)\n }\n if (beforeEachTestFunc !== undefined) {\n throwAlreadyDefinedError('beforeEachTest')\n }\n beforeEachTestFunc = func\n }\n\n // afterEachTest\n let afterEachTestFunc: (() => void | Promise<void>) | undefined\n function afterEachTest(func: () => void | Promise<void>): void {\n if (typeof func !== 'function') {\n throwMustBeAFunctionError('afterEachTest', func)\n }\n if (afterEachTestFunc !== undefined) {\n throwAlreadyDefinedError('afterEachTest')\n }\n afterEachTestFunc = func\n }\n\n // it\n function it(should: string, test: It['test']): void {\n const thisItCounter = itCounter++\n if (itFilter !== undefined && !should.toLowerCase().includes(itFilter.toLowerCase())) return\n its.push({\n counter: thisItCounter,\n should,\n test\n })\n }\n\n const beforeDescribeExports: TaskExports = {}\n await configBeforeEachDescribe(config, beforeDescribeExports)\n\n const describeParcel: DescribeParcel = { it, test: it, afterDescribe, beforeEachTest, afterEachTest }\n addExports(describeParcel, beforeDescribeExports, 'beforeEachDescribe')\n\n let error: unknown\n try {\n await describe.tests(describeParcel)\n } catch (e) {\n error = e\n }\n\n return {\n its,\n beforeDescribeExports,\n afterDescribeFunc,\n beforeEachTestFunc,\n afterEachTestFunc,\n error\n }\n })\n}\n\nasync function configBeforeEachDescribe(config: FinalConfig, exports: TaskExports): Promise<void> {\n if (config.beforeEachDescribe !== undefined) {\n const theExports = await runTasks(config.beforeEachDescribe, undefined, 'beforeEachDescribe')\n if (theExports) addExports(exports, theExports, 'beforeEachDescribe')\n }\n}\n"]}
1
+ {"version":3,"file":"parseDescribe.js","sourceRoot":"","sources":["../../../src/cli/lib/parseDescribe.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAG5C,MAAM,qBAAsB,SAAQ,KAAK;IACrC,IAAI,GAAG,uBAAuB,CAAA;CACjC;AACD,MAAM,uBAAwB,SAAQ,KAAK;IACvC,IAAI,GAAG,yBAAyB,CAAA;CACnC;AAED,SAAS,yBAAyB,CAAC,KAAa,EAAE,IAAa;IAC3D,MAAM,IAAI,qBAAqB,CAAC,GAAG,KAAK,gCAAgC,KAAK,wBAAwB;UAC/F,aAAa,OAAO,IAAI,EAAE,CAAC,CAAA;AACrC,CAAC;AAED,SAAS,wBAAwB,CAAC,KAAa;IAC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7F,IAAI,UAAU;YAAE,UAAU,CAAC,OAAO,EAAE,UAAU,EAAE,oBAAoB,CAAC,CAAA;IACzE,CAAC;AACL,CAAC","sourcesContent":["\nimport type { FinalConfig, Describe, DescribeParcel, It, ParsedDescribe, TaskExports } from '../../types.js'\nimport { timeProfileAsync } from './timeProfiler.js'\nimport { runTasks } from './runTasks.js'\nimport { addExports } from './addExports.js'\n\n\nclass SxytNotAFunctionError extends Error {\n name = 'SxytNotAFunctionError'\n}\nclass SxytAlreadyDefinedError extends Error {\n name = 'SxytAlreadyDefinedError'\n}\n\nfunction throwMustBeAFunctionError(fname: string, func: unknown): never {\n throw new SxytNotAFunctionError(`${fname}() error, argument passed to ${fname}() must be a function,`\n + ` received ${typeof func}`)\n}\n\nfunction throwAlreadyDefinedError(fname: string): never {\n throw new SxytAlreadyDefinedError(`${fname}() error, ${fname} function is already defined.`\n + ' Only one function is permitted')\n}\n\nexport function parseDescribe(\n config: FinalConfig,\n describe: Describe,\n itFilter?: string\n): Promise<ParsedDescribe> {\n return timeProfileAsync(`parse its from describe ${describe.thing}`, async () => {\n let itCounter = 1\n const its: It[] = []\n\n // create functions to pass back\n\n // afterDescribe\n let afterDescribeFunc: (() => void | Promise<void>) | undefined\n function afterDescribe(func: () => void | Promise<void>): void {\n if (typeof func !== 'function') {\n throwMustBeAFunctionError('afterDescribe', func)\n }\n if (afterDescribeFunc !== undefined) {\n throwAlreadyDefinedError('afterDescribe')\n }\n afterDescribeFunc = func\n }\n\n // beforeEachTest\n let beforeEachTestFunc: (() => TaskExports | void | Promise<TaskExports | void>) | undefined\n function beforeEachTest(func: () => TaskExports | void | Promise<TaskExports | void>): void {\n if (typeof func !== 'function') {\n throwMustBeAFunctionError('beforeEachTest', func)\n }\n if (beforeEachTestFunc !== undefined) {\n throwAlreadyDefinedError('beforeEachTest')\n }\n beforeEachTestFunc = func\n }\n\n // afterEachTest\n let afterEachTestFunc: (() => void | Promise<void>) | undefined\n function afterEachTest(func: () => void | Promise<void>): void {\n if (typeof func !== 'function') {\n throwMustBeAFunctionError('afterEachTest', func)\n }\n if (afterEachTestFunc !== undefined) {\n throwAlreadyDefinedError('afterEachTest')\n }\n afterEachTestFunc = func\n }\n\n // it\n function it(should: string, test: It['test']): void {\n const thisItCounter = itCounter++\n if (itFilter !== undefined && !should.toLowerCase().includes(itFilter.toLowerCase())) return\n its.push({\n counter: thisItCounter,\n should,\n test\n })\n }\n\n const beforeDescribeExports: TaskExports = {}\n await configBeforeEachDescribe(config, beforeDescribeExports)\n\n const describeParcel: DescribeParcel = { it, test: it, afterDescribe, beforeEachTest, afterEachTest }\n addExports(describeParcel, beforeDescribeExports, 'beforeEachDescribe')\n\n let error: unknown\n try {\n await describe.tests(describeParcel)\n } catch (e) {\n error = e\n }\n\n return {\n its,\n beforeDescribeExports,\n afterDescribeFunc,\n beforeEachTestFunc,\n afterEachTestFunc,\n error\n }\n })\n}\n\nasync function configBeforeEachDescribe(config: FinalConfig, exports: TaskExports): Promise<void> {\n if (config.beforeEachDescribe !== undefined) {\n const theExports = await runTasks(config.beforeEachDescribe, undefined, 'beforeEachDescribe')\n if (theExports) addExports(exports, theExports, 'beforeEachDescribe')\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { timeProfileAsync } from './timeProfier.js';
1
+ import { timeProfileAsync } from './timeProfiler.js';
2
2
  import { parseDescribe } from './parseDescribe.js';
3
3
  import { runDescribeRun } from './runDescribeRun.js';
4
4
  import { captureLogs } from './consoleCapture.js';
@@ -1 +1 @@
1
- {"version":3,"file":"runDescribe.js","sourceRoot":"","sources":["../../../src/cli/lib/runDescribe.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE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E,GAAG,SAAS,CAAA;QACtD,cAAc,CAAC,IAAI,GAAG,IAAI,CAAA;QAE1B,kEAAkE;QAClE,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,cAAc,CAAC,KAAK,KAAK,SAAS,CAAC,CAAA;QAEhE,OAAO,cAAc,CAAA;IACzB,CAAC,CAAC,CAAA;AACN,CAAC","sourcesContent":["\nimport type { FinalConfig, Describe } from '../../types.js'\nimport type { ItResult } from './runIt.js'\nimport { timeProfileAsync } from './timeProfier.js'\nimport { parseDescribe } from './parseDescribe.js'\nimport { runDescribeRun } from './runDescribeRun.js'\nimport { captureLogs } from './consoleCapture.js'\nimport { makeStopSignal, stopIfFailFast, type StopSignal } from './stopSignal.js'\n\n\nexport type ItResultsSummary = { total: number, passes: number }\nexport type DescribeResult = {\n counter: number\n thing: string\n success: boolean | null\n // total elapsed for the whole describe, filled in by runDescribe once it has finished\n time: number\n itResults: ItResult[]\n itResultsSummary: ItResultsSummary\n logs?: unknown[][]\n error?: unknown\n}\n\nfunction createDescribeErrorResult(describe: Describe, error: unknown): DescribeResult {\n return {\n counter: describe.counter,\n thing: describe.thing,\n success: false,\n time: 0, // overwritten by runDescribe\n itResults: [],\n itResultsSummary: {\n total: 0,\n passes: 0\n },\n error\n }\n}\n\nexport function runDescribe(\n config: FinalConfig,\n describe: Describe,\n itFilter?: string,\n stop: StopSignal = makeStopSignal()\n): Promise<DescribeResult> {\n return timeProfileAsync(`run describe ${describe.thing}`, async () => {\n const logs: unknown[][] = []\n\n const startTime = new Date().getTime()\n\n const describeResult = await captureLogs(logs, async () => {\n try {\n const parsedDescribe = await parseDescribe(config, describe, itFilter)\n return parsedDescribe.error !== undefined\n ? createDescribeErrorResult(describe, parsedDescribe.error)\n : await runDescribeRun(config, describe, parsedDescribe, stop)\n } catch (e) {\n return createDescribeErrorResult(describe, e)\n }\n })\n\n describeResult.time = new Date().getTime() - startTime\n describeResult.logs = logs\n\n // a describe that threw stops the run just as a failing test does\n stopIfFailFast(config, stop, describeResult.error !== undefined)\n\n return describeResult\n })\n}\n"]}
1
+ {"version":3,"file":"runDescribe.js","sourceRoot":"","sources":["../../../src/cli/lib/runDescribe.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAmB,MAAM,iBAAiB,CAAA;AAgBjF,SAAS,yBAAyB,CAAC,QAAkB,EAAE,KAAc;IACjE,OAAO;QACH,OAAO,EAAE,QAAQ,CAAC,OAAO;QACzB,KAAK,EAAE,QAAQ,CAAC,KAAK;QACrB,OAAO,EAAE,KAAK;QACd,IAAI,EAAE,CAAC,EAAE,6BAA6B;QACtC,SAAS,EAAE,EAAE;QACb,gBAAgB,EAAE;YACd,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,CAAC;SACZ;QACD,KAAK;KACR,CAAA;AACL,CAAC;AAED,MAAM,UAAU,WAAW,CACvB,MAAmB,EACnB,QAAkB,EAClB,QAAiB,EACjB,OAAmB,cAAc,EAAE;IAEnC,OAAO,gBAAgB,CAAC,gBAAgB,QAAQ,CAAC,KAAK,EAAE,EAAE,KAAK,IAAI,EAAE;QACjE,MAAM,IAAI,GAAgB,EAAE,CAAA;QAE5B,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAA;QAEtC,MAAM,cAAc,GAAG,MAAM,WAAW,CAAC,IAAI,EAAE,KAAK,IAAI,EAAE;YACtD,IAAI,CAAC;gBACD,MAAM,cAAc,GAAG,MAAM,aAAa,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAA;gBACtE,OAAO,cAAc,CAAC,KAAK,KAAK,SAAS;oBACrC,CAAC,CAAC,yBAAyB,CAAC,QAAQ,EAAE,cAAc,CAAC,KAAK,CAAC;oBAC3D,CAAC,CAAC,MAAM,cAAc,CAAC,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,CAAC,CAAA;YACtE,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACT,OAAO,yBAAyB,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAA;YACjD,CAAC;QACL,CAAC,CAAC,CAAA;QAEF,cAAc,CAAC,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,SAAS,CAAA;QACtD,cAAc,CAAC,IAAI,GAAG,IAAI,CAAA;QAE1B,kEAAkE;QAClE,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,cAAc,CAAC,KAAK,KAAK,SAAS,CAAC,CAAA;QAEhE,OAAO,cAAc,CAAA;IACzB,CAAC,CAAC,CAAA;AACN,CAAC","sourcesContent":["\nimport type { FinalConfig, Describe } from '../../types.js'\nimport type { ItResult } from './runIt.js'\nimport { timeProfileAsync } from './timeProfiler.js'\nimport { parseDescribe } from './parseDescribe.js'\nimport { runDescribeRun } from './runDescribeRun.js'\nimport { captureLogs } from './consoleCapture.js'\nimport { makeStopSignal, stopIfFailFast, type StopSignal } from './stopSignal.js'\n\n\nexport type ItResultsSummary = { total: number, passes: number }\nexport type DescribeResult = {\n counter: number\n thing: string\n success: boolean | null\n // total elapsed for the whole describe, filled in by runDescribe once it has finished\n time: number\n itResults: ItResult[]\n itResultsSummary: ItResultsSummary\n logs?: unknown[][]\n error?: unknown\n}\n\nfunction createDescribeErrorResult(describe: Describe, error: unknown): DescribeResult {\n return {\n counter: describe.counter,\n thing: describe.thing,\n success: false,\n time: 0, // overwritten by runDescribe\n itResults: [],\n itResultsSummary: {\n total: 0,\n passes: 0\n },\n error\n }\n}\n\nexport function runDescribe(\n config: FinalConfig,\n describe: Describe,\n itFilter?: string,\n stop: StopSignal = makeStopSignal()\n): Promise<DescribeResult> {\n return timeProfileAsync(`run describe ${describe.thing}`, async () => {\n const logs: unknown[][] = []\n\n const startTime = new Date().getTime()\n\n const describeResult = await captureLogs(logs, async () => {\n try {\n const parsedDescribe = await parseDescribe(config, describe, itFilter)\n return parsedDescribe.error !== undefined\n ? createDescribeErrorResult(describe, parsedDescribe.error)\n : await runDescribeRun(config, describe, parsedDescribe, stop)\n } catch (e) {\n return createDescribeErrorResult(describe, e)\n }\n })\n\n describeResult.time = new Date().getTime() - startTime\n describeResult.logs = logs\n\n // a describe that threw stops the run just as a failing test does\n stopIfFailFast(config, stop, describeResult.error !== undefined)\n\n return describeResult\n })\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { timeProfileAsync } from './timeProfier.js';
1
+ import { timeProfileAsync } from './timeProfiler.js';
2
2
  import { runTasks } from './runTasks.js';
3
3
  import { debug } from '../../output.js';
4
4
  import { runIt } from './runIt.js';
@@ -1 +1 @@
1
- {"version":3,"file":"runDescribeRun.js","sourceRoot":"","sources":["../../../src/cli/lib/runDescribeRun.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,KAAK,EAAiB,MAAM,YAAY,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAmB,MAAM,iBAAiB,CAAA;AAGjF,MAAM,UAAU,cAAc,CAC1B,MAAmB,EACnB,QAAkB,EAClB,SAAyB,EACzB,OAAmB,cAAc,EAAE;IAEnC,OAAO,gBAAgB,CAAC,yBAAyB,QAAQ,CAAC,KAAK,EAAE,EAAE,KAAK,IAAI,EAAE;QAC1E,MAAM,EAAE,GAAG,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,GAAG,SAAS,CAAA;QAE1G,iFAAiF;QACjF,sBAAsB;QACtB,MA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I,CAAC,CAAC,QAAQ,CAAC,OAAO,IAAI,KAAK,CAAC,CAAA;QAC3D,CAAC;QAED,KAAK,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;QAE3C,MAAM,cAAc,GAAmB;YACnC,OAAO,EAAE,QAAQ,CAAC,OAAO;YACzB,KAAK,EAAE,QAAQ,CAAC,KAAK;YACrB,OAAO,EAAE,CAAC,gBAAgB,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,MAAM,KAAK,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;YACjG,IAAI,EAAE,CAAC,EAAE,6BAA6B;YACtC,SAAS;YACT,gBAAgB;SACnB,CAAA;QAED,YAAY;QACZ,IAAI,OAAO,iBAAiB,KAAK,UAAU;YAAE,MAAM,iBAAiB,EAAE,CAAA;QACtE,MAAM,uBAAuB,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAA;QAE5D,OAAO,cAAc,CAAA;IACzB,CAAC,CAAC,CAAA;AACN,CAAC;AAED,KAAK,UAAU,uBAAuB,CAAC,MAAmB,EAAE,OAAoB;IAC5E,IAAI,MAAM,CAAC,iBAAiB,KAAK,SAAS,EAAE,CAAC;QACzC,MAAM,QAAQ,CAAC,MAAM,CAAC,iBAAiB,EAAE,OAAO,EAAE,mBAAmB,CAAC,CAAA;IAC1E,CAAC;AACL,CAAC","sourcesContent":["\nimport type {\n FinalConfig, Describe, ParsedDescribe, TaskExports\n} from '../../types.js'\nimport type { DescribeResult } from './runDescribe.js'\nimport { timeProfileAsync } from './timeProfier.js'\nimport { runTasks } from './runTasks.js'\nimport { debug } from '../../output.js'\nimport { runIt, type ItResult } from './runIt.js'\nimport { makeStopSignal, stopIfFailFast, type StopSignal } from './stopSignal.js'\n\n\nexport function runDescribeRun(\n config: FinalConfig,\n describe: Describe,\n parsedIts: ParsedDescribe,\n stop: StopSignal = makeStopSignal()\n): Promise<DescribeResult> {\n return timeProfileAsync(`run describe, run its ${describe.thing}`, async () => {\n const { its, beforeDescribeExports, afterDescribeFunc, beforeEachTestFunc, afterEachTestFunc } = parsedIts\n\n // describe() rejects a meta naming neither key, so the else branch can only be a\n // sequentialTests one\n const parallelOverride = describe.meta === undefined\n ? undefined\n : 'parallelTests' in describe.meta ? describe.meta.parallelTests : !describe.meta.sequentialTests\n\n const isParallel = parallelOverride ?? config.execution.tests === 'parallel'\n\n const itPromises: Array<Promise<ItResult>> = []\n for (const it of its) {\n // checked before starting, so the failing test is the last one that runs\n if (stop.stopped) break\n const itPromise = runIt(config, it, beforeEachTestFunc, afterEachTestFunc)\n itPromises.push(itPromise)\n if (!isParallel) stopIfFailFast(config, stop, (await itPromise).success === false)\n }\n const itResults = await Promise.all(itPromises)\n\n // in parallel mode the tests are already in flight, so this only stops later work\n stopIfFailFast(config, stop, itResults.some(itResult => itResult.success === false))\n\n const itResultsSummary: DescribeResult['itResultsSummary'] = {\n total: 0,\n passes: 0\n }\n\n for (const itResult of itResults) {\n itResultsSummary.total += +(itResult.success !== null)\n itResultsSummary.passes += +(itResult.success ?? false)\n }\n\n debug('itResultsSummary', itResultsSummary)\n\n const describeResult: DescribeResult = {\n counter: describe.counter,\n thing: describe.thing,\n success: (itResultsSummary.total > 0) ? itResultsSummary.passes === itResultsSummary.total : null,\n time: 0, // overwritten by runDescribe\n itResults,\n itResultsSummary\n }\n\n // run after\n if (typeof afterDescribeFunc === 'function') await afterDescribeFunc()\n await configAfterEachDescribe(config, beforeDescribeExports)\n\n return describeResult\n })\n}\n\nasync function configAfterEachDescribe(config: FinalConfig, exports: TaskExports): Promise<void> {\n if (config.afterEachDescribe !== undefined) {\n await runTasks(config.afterEachDescribe, exports, 'afterEachDescribe')\n }\n}\n"]}
1
+ {"version":3,"file":"runDescribeRun.js","sourceRoot":"","sources":["../../../src/cli/lib/runDescribeRun.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,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I,MAAM,CAAC,iBAAiB,KAAK,SAAS,EAAE,CAAC;QACzC,MAAM,QAAQ,CAAC,MAAM,CAAC,iBAAiB,EAAE,OAAO,EAAE,mBAAmB,CAAC,CAAA;IAC1E,CAAC;AACL,CAAC","sourcesContent":["\nimport type {\n FinalConfig, Describe, ParsedDescribe, TaskExports\n} from '../../types.js'\nimport type { DescribeResult } from './runDescribe.js'\nimport { timeProfileAsync } from './timeProfiler.js'\nimport { runTasks } from './runTasks.js'\nimport { debug } from '../../output.js'\nimport { runIt, type ItResult } from './runIt.js'\nimport { makeStopSignal, stopIfFailFast, type StopSignal } from './stopSignal.js'\n\n\nexport function runDescribeRun(\n config: FinalConfig,\n describe: Describe,\n parsedIts: ParsedDescribe,\n stop: StopSignal = makeStopSignal()\n): Promise<DescribeResult> {\n return timeProfileAsync(`run describe, run its ${describe.thing}`, async () => {\n const { its, beforeDescribeExports, afterDescribeFunc, beforeEachTestFunc, afterEachTestFunc } = parsedIts\n\n // describe() rejects a meta naming neither key, so the else branch can only be a\n // sequentialTests one\n const parallelOverride = describe.meta === undefined\n ? undefined\n : 'parallelTests' in describe.meta ? describe.meta.parallelTests : !describe.meta.sequentialTests\n\n const isParallel = parallelOverride ?? config.execution.tests === 'parallel'\n\n const itPromises: Array<Promise<ItResult>> = []\n for (const it of its) {\n // checked before starting, so the failing test is the last one that runs\n if (stop.stopped) break\n const itPromise = runIt(config, it, beforeEachTestFunc, afterEachTestFunc)\n itPromises.push(itPromise)\n if (!isParallel) stopIfFailFast(config, stop, (await itPromise).success === false)\n }\n const itResults = await Promise.all(itPromises)\n\n // in parallel mode the tests are already in flight, so this only stops later work\n stopIfFailFast(config, stop, itResults.some(itResult => itResult.success === false))\n\n const itResultsSummary: DescribeResult['itResultsSummary'] = {\n total: 0,\n passes: 0\n }\n\n for (const itResult of itResults) {\n itResultsSummary.total += +(itResult.success !== null)\n itResultsSummary.passes += +(itResult.success ?? false)\n }\n\n debug('itResultsSummary', itResultsSummary)\n\n const describeResult: DescribeResult = {\n counter: describe.counter,\n thing: describe.thing,\n success: (itResultsSummary.total > 0) ? itResultsSummary.passes === itResultsSummary.total : null,\n time: 0, // overwritten by runDescribe\n itResults,\n itResultsSummary\n }\n\n // run after\n if (typeof afterDescribeFunc === 'function') await afterDescribeFunc()\n await configAfterEachDescribe(config, beforeDescribeExports)\n\n return describeResult\n })\n}\n\nasync function configAfterEachDescribe(config: FinalConfig, exports: TaskExports): Promise<void> {\n if (config.afterEachDescribe !== undefined) {\n await runTasks(config.afterEachDescribe, exports, 'afterEachDescribe')\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { timeProfileAsync } from './timeProfier.js';
1
+ import { timeProfileAsync } from './timeProfiler.js';
2
2
  import { runTasks } from './runTasks.js';
3
3
  import { addExports } from './addExports.js';
4
4
  import { captureLogs } from './consoleCapture.js';
@@ -1 +1 @@
1
- {"version":3,"file":"runIt.js","sourceRoot":"","sources":["../../../src/cli/lib/runIt.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAYjD,MAAM,UAAU,KAAK,CACjB,MAAmB,EACnB,EAAM,EACN,kBAAwF,EACxF,iBAA2D;IAE3D,OAAO,gBAAgB,CAAC,UAAU,EAAE,CAAC,MAAM,EAAE,EAAE,KAAK,IAAI,EAAE;QACtD,MAAM,IAAI,GAAgB,EAAE,CAAA;QAE5B,OAAO,MAAM,WAAW,CAAC,IAAI,EAAE,KAAK,IAAI,EAAE;YACtC,qBAAqB;YACrB,MAAM,WAAW,GAAgB,EAAE,CAAA;YACnC,MAAM,oBAAoB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;YAC/C,IAAI,OAAO,kBAAkB,KAAK,UAAU,EAAE,C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B,CAAC,MAAmB,EAAE,OAAoB;IACzE,IAAI,MAAM,CAAC,cAAc,KAAK,SAAS,EAAE,CAAC;QACtC,MAAM,UAAU,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,cAAc,EAAE,SAAS,EAAE,gBAAgB,CAAC,CAAA;QACrF,IAAI,UAAU;YAAE,UAAU,CAAC,OAAO,EAAE,UAAU,EAAE,gBAAgB,CAAC,CAAA;IACrE,CAAC;AACL,CAAC;AAED,KAAK,UAAU,mBAAmB,CAAC,MAAmB,EAAE,OAAoB;IACxE,IAAI,MAAM,CAAC,aAAa,KAAK,SAAS,EAAE,CAAC;QACrC,MAAM,QAAQ,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,EAAE,eAAe,CAAC,CAAA;IAClE,CAAC;AACL,CAAC","sourcesContent":["\nimport type { FinalConfig, It, TaskExports } from '../../types.js'\nimport { timeProfileAsync } from './timeProfier.js'\nimport { runTasks } from './runTasks.js'\nimport { addExports } from './addExports.js'\nimport { captureLogs } from './consoleCapture.js'\n\n\nexport type ItResult = {\n counter: number\n should: string\n success: boolean | null\n time: number\n error?: unknown\n logs: unknown[][]\n}\n\nexport function runIt(\n config: FinalConfig,\n it: It,\n beforeEachTestFunc: (() => TaskExports | void | Promise<TaskExports | void>) | undefined,\n afterEachTestFunc: (() => void | Promise<void>) | undefined\n): Promise<ItResult> {\n return timeProfileAsync(`run it ${it.should}`, async () => {\n const logs: unknown[][] = []\n\n return await captureLogs(logs, async () => {\n // run before test/it\n const testExports: TaskExports = {}\n await configBeforeEachTest(config, testExports)\n if (typeof beforeEachTestFunc === 'function') {\n const funcExports = await beforeEachTestFunc()\n if (funcExports) {\n addExports(testExports, funcExports, 'beforeEachTest', 'the describe\\'s beforeEachTest()')\n }\n }\n\n const testParcel: TaskExports = {}\n addExports(testParcel, testExports)\n\n //// run the it\n let success: boolean | null\n let hasError = false\n let error: unknown\n const startTime = new Date().getTime()\n try {\n await it.test(testParcel)\n success = true\n } catch (e) {\n success = false\n hasError = true\n error = e\n }\n\n const time = new Date().getTime() - startTime\n\n const itResult: ItResult = {\n counter: it.counter,\n should: it.should,\n success,\n time,\n logs\n }\n if (hasError) itResult.error = error\n\n // run after test/it\n if (typeof afterEachTestFunc === 'function') await afterEachTestFunc()\n await configAfterEachTest(config, testExports)\n\n return itResult\n })\n })\n}\n\nasync function configBeforeEachTest(config: FinalConfig, exports: TaskExports): Promise<void> {\n if (config.beforeEachTest !== undefined) {\n const theExports = await runTasks(config.beforeEachTest, undefined, 'beforeEachTest')\n if (theExports) addExports(exports, theExports, 'beforeEachTest')\n }\n}\n\nasync function configAfterEachTest(config: FinalConfig, exports: TaskExports): Promise<void> {\n if (config.afterEachTest !== undefined) {\n await runTasks(config.afterEachTest, exports, 'afterEachTest')\n }\n}\n"]}
1
+ {"version":3,"file":"runIt.js","sourceRoot":"","sources":["../../../src/cli/lib/runIt.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAYjD,MAAM,UAAU,KAAK,CACjB,MAAmB,EACnB,EAAM,EACN,kBAAwF,EACxF,iBAA2D;IAE3D,OAAO,gBAAgB,CAAC,UAAU,EAAE,CAAC,MAAM,EAAE,EAAE,KAAK,IAAI,EAAE;QACtD,MAAM,IAAI,GAAgB,EAAE,CAAA;QAE5B,OAAO,MAAM,WAAW,CAAC,IAAI,EAAE,KAAK,IAAI,EAAE;YACtC,qBAAqB;YACrB,MAAM,WAAW,GAAgB,EAAE,CAAA;YACnC,MAAM,oBAAoB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;YAC/C,IAAI,OAAO,kBAAkB,KAAK,UAAU,EAAE,CAAC;gBAC3C,MAAM,WAAW,GAAG,MAAM,kBAAkB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M,CAAC,cAAc,KAAK,SAAS,EAAE,CAAC;QACtC,MAAM,UAAU,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,cAAc,EAAE,SAAS,EAAE,gBAAgB,CAAC,CAAA;QACrF,IAAI,UAAU;YAAE,UAAU,CAAC,OAAO,EAAE,UAAU,EAAE,gBAAgB,CAAC,CAAA;IACrE,CAAC;AACL,CAAC;AAED,KAAK,UAAU,mBAAmB,CAAC,MAAmB,EAAE,OAAoB;IACxE,IAAI,MAAM,CAAC,aAAa,KAAK,SAAS,EAAE,CAAC;QACrC,MAAM,QAAQ,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,EAAE,eAAe,CAAC,CAAA;IAClE,CAAC;AACL,CAAC","sourcesContent":["\nimport type { FinalConfig, It, TaskExports } from '../../types.js'\nimport { timeProfileAsync } from './timeProfiler.js'\nimport { runTasks } from './runTasks.js'\nimport { addExports } from './addExports.js'\nimport { captureLogs } from './consoleCapture.js'\n\n\nexport type ItResult = {\n counter: number\n should: string\n success: boolean | null\n time: number\n error?: unknown\n logs: unknown[][]\n}\n\nexport function runIt(\n config: FinalConfig,\n it: It,\n beforeEachTestFunc: (() => TaskExports | void | Promise<TaskExports | void>) | undefined,\n afterEachTestFunc: (() => void | Promise<void>) | undefined\n): Promise<ItResult> {\n return timeProfileAsync(`run it ${it.should}`, async () => {\n const logs: unknown[][] = []\n\n return await captureLogs(logs, async () => {\n // run before test/it\n const testExports: TaskExports = {}\n await configBeforeEachTest(config, testExports)\n if (typeof beforeEachTestFunc === 'function') {\n const funcExports = await beforeEachTestFunc()\n if (funcExports) {\n addExports(testExports, funcExports, 'beforeEachTest', 'the describe\\'s beforeEachTest()')\n }\n }\n\n const testParcel: TaskExports = {}\n addExports(testParcel, testExports)\n\n //// run the it\n let success: boolean | null\n let hasError = false\n let error: unknown\n const startTime = new Date().getTime()\n try {\n await it.test(testParcel)\n success = true\n } catch (e) {\n success = false\n hasError = true\n error = e\n }\n\n const time = new Date().getTime() - startTime\n\n const itResult: ItResult = {\n counter: it.counter,\n should: it.should,\n success,\n time,\n logs\n }\n if (hasError) itResult.error = error\n\n // run after test/it\n if (typeof afterEachTestFunc === 'function') await afterEachTestFunc()\n await configAfterEachTest(config, testExports)\n\n return itResult\n })\n })\n}\n\nasync function configBeforeEachTest(config: FinalConfig, exports: TaskExports): Promise<void> {\n if (config.beforeEachTest !== undefined) {\n const theExports = await runTasks(config.beforeEachTest, undefined, 'beforeEachTest')\n if (theExports) addExports(exports, theExports, 'beforeEachTest')\n }\n}\n\nasync function configAfterEachTest(config: FinalConfig, exports: TaskExports): Promise<void> {\n if (config.afterEachTest !== undefined) {\n await runTasks(config.afterEachTest, exports, 'afterEachTest')\n }\n}\n"]}