sxy-test-runner 2.5.1 → 2.5.3
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.
- package/AGENTS.md +15 -1
- package/dist/cli/init.js +5 -0
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/lib/addBasePath.js +1 -1
- package/dist/cli/lib/addBasePath.js.map +1 -1
- package/dist/cli/lib/buildDependencyTrees.d.ts +1 -1
- package/dist/cli/lib/buildDependencyTrees.js +2 -2
- package/dist/cli/lib/buildDependencyTrees.js.map +1 -1
- package/dist/cli/lib/defaultConfig.js +2 -0
- package/dist/cli/lib/defaultConfig.js.map +1 -1
- package/dist/cli/lib/failureEntries.d.ts +1 -1
- package/dist/cli/lib/failureEntries.js +11 -8
- package/dist/cli/lib/failureEntries.js.map +1 -1
- package/dist/cli/lib/parseDescribe.js +1 -1
- package/dist/cli/lib/parseDescribe.js.map +1 -1
- package/dist/cli/lib/runDescribe.js +1 -1
- package/dist/cli/lib/runDescribe.js.map +1 -1
- package/dist/cli/lib/runDescribeRun.js +1 -1
- package/dist/cli/lib/runDescribeRun.js.map +1 -1
- package/dist/cli/lib/runIt.js +1 -1
- package/dist/cli/lib/runIt.js.map +1 -1
- package/dist/cli/lib/runTests.js +9 -188
- package/dist/cli/lib/runTests.js.map +1 -1
- package/dist/cli/lib/setEnv.d.ts +1 -0
- package/dist/cli/lib/setEnv.js +11 -0
- package/dist/cli/lib/setEnv.js.map +1 -1
- package/dist/cli/lib/showFailuresColorized.d.ts +2 -0
- package/dist/cli/lib/showFailuresColorized.js +52 -0
- package/dist/cli/lib/showFailuresColorized.js.map +1 -0
- package/dist/cli/lib/showTestFileResult.d.ts +7 -0
- package/dist/cli/lib/{showTestResult.js → showTestFileResult.js} +15 -9
- package/dist/cli/lib/showTestFileResult.js.map +1 -0
- package/dist/cli/lib/showTestResultsSummary.d.ts +8 -0
- package/dist/cli/lib/showTestResultsSummary.js +213 -0
- package/dist/cli/lib/showTestResultsSummary.js.map +1 -0
- package/dist/cli/lib/timeProfiler.d.ts +3 -0
- package/dist/cli/lib/{timeProfier.js → timeProfiler.js} +1 -1
- package/dist/cli/lib/timeProfiler.js.map +1 -0
- package/dist/cli/lib/validateConfig.js +7 -0
- package/dist/cli/lib/validateConfig.js.map +1 -1
- package/dist/cli/once.js +2 -1
- package/dist/cli/once.js.map +1 -1
- package/dist/cli/watch.d.ts +1 -1
- package/dist/cli/watch.js +6 -4
- package/dist/cli/watch.js.map +1 -1
- package/dist/packages/timeProfiler.d.ts +1 -1
- package/dist/packages/timeProfiler.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.js.map +1 -1
- package/package.json +2 -1
- package/readme.md +8 -1
- package/dist/cli/lib/showTestResult.d.ts +0 -4
- package/dist/cli/lib/showTestResult.js.map +0 -1
- package/dist/cli/lib/timeProfier.d.ts +0 -3
- package/dist/cli/lib/timeProfier.js.map +0 -1
package/AGENTS.md
CHANGED
|
@@ -490,7 +490,12 @@ 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
|
|
493
|
+
dropped and the message is cut at `agentLineLengthLimit` characters - 500 by default,
|
|
494
|
+
`Infinity` for no cut; the terminal keeps the full diff.
|
|
495
|
+
|
|
496
|
+
Agent mode sets `SXYT_AGENT` and `SXY_TEST_RUNNER_AGENT` to `true` once the config has
|
|
497
|
+
loaded, before `setup` runs, so a config enabling it is seen too. When agent mode is off
|
|
498
|
+
both are removed, so a value inherited from a parent agent run is not mistaken for this one.
|
|
494
499
|
|
|
495
500
|
In `once`, read the process's exit code for pass/fail and the `status` on `done` for what
|
|
496
501
|
kind of failure it was - `status=failed` accompanies exit `20`. `watching` and `change`
|
|
@@ -515,7 +520,9 @@ export default {
|
|
|
515
520
|
testsIgnore: '**/node_modules/**',
|
|
516
521
|
showErrorTrace: true,
|
|
517
522
|
compact: false,
|
|
523
|
+
restateFailures: true,
|
|
518
524
|
agent: false,
|
|
525
|
+
agentLineLengthLimit: 500,
|
|
519
526
|
|
|
520
527
|
setup: undefined,
|
|
521
528
|
beforeEachFile: undefined,
|
|
@@ -548,6 +555,13 @@ export default {
|
|
|
548
555
|
Set `showErrorTrace: true` when an agent needs stack traces for test failures. With the
|
|
549
556
|
default `false`, failure output is intentionally shorter.
|
|
550
557
|
|
|
558
|
+
`restateFailures` (default `true`) repeats a failed run's failures in full under a
|
|
559
|
+
`Failures:` heading, just above the tallies, so they are still on screen after a long run.
|
|
560
|
+
It is skipped when nothing or everything failed, and when there are more than 10 failures
|
|
561
|
+
and more than `1.7 × n^0.58` of the run's `n` tests, describes that threw and files that
|
|
562
|
+
would not load. It only affects the usual output; under `--agent` the `fail` lines already
|
|
563
|
+
list every failure.
|
|
564
|
+
|
|
551
565
|
## Maintaining this repository
|
|
552
566
|
|
|
553
567
|
Source files live in `src/`; `dist/` is generated. Do not make a source fix only in
|
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
|
|
|
@@ -77,6 +80,8 @@ export default {
|
|
|
77
80
|
|
|
78
81
|
// report only minimal info, failures and results, as single lines, suited for agents
|
|
79
82
|
agent: false,
|
|
83
|
+
// the most characters of each failure's error text in agent mode, Infinity for no limit
|
|
84
|
+
agentLineLengthLimit: 500,
|
|
80
85
|
|
|
81
86
|
|
|
82
87
|
// tasks to run on startup
|
package/dist/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E,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 // the most characters of each failure's error text in agent mode, Infinity for no limit\n agentLineLengthLimit: 500,\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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addBasePath.js","sourceRoot":"","sources":["../../../src/cli/lib/addBasePath.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
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>):
|
|
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 {
|
|
5
|
+
const { timeProfile } = createTimeProfiler(showTimeProfiling);
|
|
6
6
|
export function buildDependencyTrees(config, testFiles) {
|
|
7
|
-
return
|
|
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,
|
|
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"]}
|
|
@@ -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,oBAAoB,EAAE,GAAG;IACzB,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 agentLineLengthLimit: 500,\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"]}
|
|
@@ -6,5 +6,5 @@ export interface FailureEntry {
|
|
|
6
6
|
test?: string;
|
|
7
7
|
error: string;
|
|
8
8
|
}
|
|
9
|
-
export declare function failureEntries(testResults: TestResult[], erroringTests?: Record<string, TestFile
|
|
9
|
+
export declare function failureEntries(testResults: TestResult[], erroringTests?: Record<string, TestFile>, messageLimit?: number): FailureEntry[];
|
|
10
10
|
//# sourceMappingURL=failureEntries.d.ts.map
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { inspect } from 'node:util';
|
|
2
|
+
export function failureEntries(testResults, erroringTests = {}, messageLimit = 500) {
|
|
3
|
+
const simplifyError = (error) => simplifyErrorTo(error, messageLimit);
|
|
2
4
|
const entries = [];
|
|
3
5
|
for (const [file, test] of Object.entries(erroringTests)) {
|
|
4
6
|
entries.push({ file, error: `did not load: ${loadError(test.error)}` });
|
|
@@ -31,26 +33,27 @@ export function failureEntries(testResults, erroringTests = {}) {
|
|
|
31
33
|
// preamble and keep the cause, flattened: an import error can run to several lines.
|
|
32
34
|
function loadError(error) {
|
|
33
35
|
if (typeof error !== 'string')
|
|
34
|
-
return
|
|
36
|
+
return simplifyErrorTo(error, 500);
|
|
35
37
|
const cause = error.replace(/^Error loading file\r?\n/, '').replace(/\s*[\r\n]+\s*/g, ' ').trim();
|
|
36
38
|
if (cause === '')
|
|
37
39
|
return 'Error loading file';
|
|
38
40
|
return (cause.length > 200) ? `${cause.slice(0, 200)}...` : cause;
|
|
39
41
|
}
|
|
40
|
-
function
|
|
42
|
+
function simplifyErrorTo(error, messageLimit) {
|
|
41
43
|
if (error === undefined || error === null || error === false)
|
|
42
44
|
return 'unknown error';
|
|
43
45
|
if (typeof error === 'object' && 'message' in error && typeof error.message === 'string') {
|
|
44
46
|
const name = ('name' in error && typeof error.name === 'string') ? error.name : 'Error';
|
|
45
|
-
return `${name}: ${joinLines(error.message)}`;
|
|
47
|
+
return `${name}: ${joinLines(error.message, messageLimit)}`;
|
|
46
48
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
if (typeof error === 'string')
|
|
50
|
+
return joinLines(error, messageLimit);
|
|
51
|
+
// breakLength keeps inspect from wrapping, so the result stays one line
|
|
52
|
+
return joinLines(inspect(error, { breakLength: Infinity }), messageLimit);
|
|
49
53
|
}
|
|
50
|
-
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
|
-
function joinLines(text) {
|
|
56
|
+
function joinLines(text, messageLimit) {
|
|
54
57
|
const joined = text.split(/\r?\n/).map(line => line.trim()).filter(line => line !== '')
|
|
55
58
|
.reduce((previous, line) => (previous === '')
|
|
56
59
|
? line
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"failureEntries.js","sourceRoot":"","sources":["../../../src/cli/lib/failureEntries.ts"],"names":[],"mappings":"
|
|
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,EAC5C,YAAY,GAAG,GAAG;IAElB,MAAM,aAAa,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,eAAe,CAAC,KAAK,EAAE,YAAY,CAAC,CAAA;IAC9E,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,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAA;IAC3E,CAAC;IAED,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACnC,KAAK,MAAM,cAAc,IAAI,UAAU,CAAC,eAAe,EAAE,CAAC;YACtD,IAAI,cAAc,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;gBACrC,OAAO,CAAC,IAAI,CAAC;oBACT,IAAI,EAAE,UAAU,CAAC,IAAI;oBACrB,QAAQ,EAAE,cAAc,CAAC,KAAK;oBAC9B,KAAK,EAAE,UAAU,aAAa,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE;iBACzD,CAAC,CAAA;YACN,CAAC;YAED,KAAK,MAAM,QAAQ,IAAI,cAAc,CAAC,SAAS,EAAE,CAAC;gBAC9C,IAAI,QAAQ,CAAC,OAAO,KAAK,KAAK;oBAAE,SAAQ;gBAC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AC,CAAC,OAAO,CAAA;QACvF,OAAO,GAAG,IAAI,KAAK,SAAS,CAAC,KAAK,CAAC,OAAO,EAAE,YAAY,CAAC,EAAE,CAAA;IAC/D,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC,KAAK,EAAE,YAAY,CAAC,CAAA;IACpE,wEAAwE;IACxE,OAAO,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,EAAE,YAAY,CAAC,CAAA;AAC7E,CAAC;AAED,8FAA8F;AAC9F,iFAAiF;AACjF,SAAS,SAAS,CAAC,IAAY,EAAE,YAAoB;IACjD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,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 { 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 messageLimit = 500\n): FailureEntry[] {\n const simplifyError = (error: unknown) => simplifyErrorTo(error, messageLimit)\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 simplifyErrorTo(error, 500)\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 simplifyErrorTo(error: unknown, messageLimit: number): 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, messageLimit)}`\n }\n\n if (typeof error === 'string') return joinLines(error, messageLimit)\n // breakLength keeps inspect from wrapping, so the result stays one line\n return joinLines(inspect(error, { breakLength: Infinity }), messageLimit)\n}\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, messageLimit: number): 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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseDescribe.js","sourceRoot":"","sources":["../../../src/cli/lib/parseDescribe.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,
|
|
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;IAC3C,MAAM,IAAI,uBAAuB,CAAC,GAAG,KAAK,aAAa,KAAK,+BAA+B;UACrF,iCAAiC,CAAC,CAAA;AAC5C,CAAC;AAED,MAAM,UAAU,aAAa,CACzB,MAAmB,EACnB,QAAkB,EAClB,QAAiB;IAEjB,OAAO,gBAAgB,CAAC,2BAA2B,QAAQ,CAAC,KAAK,EAAE,EAAE,KAAK,IAAI,EAAE;QAC5E,IAAI,SAAS,GAAG,CAAC,CAA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C,WAAW,EAAE,CAAC;gBAAE,OAAM;YAC5F,GAAG,CAAC,IAAI,CAAC;gBACL,OAAO,EAAE,aAAa;gBACtB,MAAM;gBACN,IAAI;aACP,CAAC,CAAA;QACN,CAAC;QAED,MAAM,qBAAqB,GAAgB,EAAE,CAAA;QAC7C,MAAM,wBAAwB,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAA;QAE7D,MAAM,cAAc,GAAmB,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,aAAa,EAAE,cAAc,EAAE,aAAa,EAAE,CAAA;QACrG,UAAU,CAAC,cAAc,EAAE,qBAAqB,EAAE,oBAAoB,CAAC,CAAA;QAEvE,IAAI,KAAc,CAAA;QAClB,IAAI,CAAC;YACD,MAAM,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,CAAA;QACxC,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACT,KAAK,GAAG,CAAC,CAAA;QACb,CAAC;QAED,OAAO;YACH,GAAG;YACH,qBAAqB;YACrB,iBAAiB;YACjB,kBAAkB;YAClB,iBAAiB;YACjB,KAAK;SACR,CAAA;IACL,CAAC,CAAC,CAAA;AACN,CAAC;AAED,KAAK,UAAU,wBAAwB,CAAC,MAAmB,EAAE,OAAoB;IAC7E,IAAI,MAAM,CAAC,kBAAkB,KAAK,SAAS,EAAE,CAAC;QAC1C,MAAM,UAAU,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,kBAAkB,EAAE,SAAS,EAAE,oBAAoB,CAAC,CAAA;QAC7F,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runDescribe.js","sourceRoot":"","sources":["../../../src/cli/lib/runDescribe.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runDescribeRun.js","sourceRoot":"","sources":["../../../src/cli/lib/runDescribeRun.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"runDescribeRun.js","sourceRoot":"","sources":["../../../src/cli/lib/runDescribeRun.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,E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AAuB,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 './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"]}
|
package/dist/cli/lib/runIt.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runIt.js","sourceRoot":"","sources":["../../../src/cli/lib/runIt.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,
|
|
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;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,CAAC,CAAA;AACN,CAAC;AAED,KAAK,UAAU,oBAAoB,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 './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"]}
|