sxy-test-runner 2.5.1 → 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.
- package/AGENTS.md +8 -0
- package/dist/cli/init.js +3 -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 +1 -0
- package/dist/cli/lib/defaultConfig.js.map +1 -1
- package/dist/cli/lib/failureEntries.js +5 -2
- 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/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 +3 -0
- package/dist/cli/lib/validateConfig.js.map +1 -1
- package/dist/cli/watch.d.ts +1 -1
- package/dist/cli/watch.js +4 -3
- 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 +1 -0
- package/dist/types.js.map +1 -1
- package/package.json +2 -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
|
@@ -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
|
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
|
|
package/dist/cli/init.js.map
CHANGED
|
@@ -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,CAAA;YAC9D,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;gBACrB,mBAAmB,CAAC,GAAG,CAAC,CAAA;YAC5B,CAAC;YACD,GAAG,GAAG,IAAI,CAAC,UAAU,EAAE,cAAc,EAAE,cAAc,GAAG,MAAM,CAAC,CAAA;YAC/D,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;gBACrB,mBAAmB,CAAC,GAAG,CAAC,CAAA;YAC5B,CAAC;YACD,GAAG,GAAG,IAAI,CAAC,UAAU,EAAE,cAAc,EAAE,cAAc,GAAG,MAAM,CAAC,CAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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 +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,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,8 +45,10 @@ 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
|
-
|
|
48
|
-
|
|
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
53
|
const messageLimit = 500;
|
|
51
54
|
// lines after the first often carry the point - node:assert's values, ensure's sightings - so
|
|
@@ -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;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,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;gBACxC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OAAO,GAAG,IAAI,KAAK,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAA;IACjD,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC,KAAK,CAAC,CAAA;IACtD,wEAAwE;IACxE,OAAO,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAA;AAC/D,CAAC;AAED,MAAM,YAAY,GAAG,GAAG,CAAA;AAExB,8FAA8F;AAC9F,iFAAiF;AACjF,SAAS,SAAS,CAAC,IAAY;IAC3B,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): 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 +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,CAAA;QACjB,MAAM,GAAG,GAAS,EAAE,CAAA;QAEpB,gCAAgC;QAEhC,gBAAgB;QAChB,IAAI,iBAA2D,CAAA;QAC/D,SAAS,aAAa,CAAC,IAAgC;YACn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ACN,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,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,O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iB,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;YAC/C,IAAI,OAAO,kBAAkB,KAAK,UAAU,EAAE,CAAC;gBAC3C,MAAM,WAAW,GAAG,MAAM,kBAAkB,EAAE,CAAA;gBAC9C,IAAI,WAAW,EAAE,C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tC,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"]}
|
package/dist/cli/lib/runTests.js
CHANGED
|
@@ -1,31 +1,16 @@
|
|
|
1
|
-
import { count } from 'sxy-lib/objects.js';
|
|
2
1
|
import { allObj as promiseAllObj } from 'sxy-lib/promises.js';
|
|
3
2
|
import { createTimeProfiler } from '../../packages/timeProfiler.js';
|
|
4
|
-
import figures from '../../packages/figures.js';
|
|
5
|
-
import chalk from '../../packages/chalk.js';
|
|
6
3
|
import { showTimeProfiling } from '../../config.js';
|
|
7
|
-
import { out as mainOut } from '../../output.js';
|
|
8
4
|
import { loadTestFile } from './loadTestFile.js';
|
|
9
5
|
import { runTest } from './runTest.js';
|
|
10
6
|
import { showTestLoadingError } from './showTestLoadingError.js';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { failureEntries } from './failureEntries.js';
|
|
14
|
-
import { agentDone, agentFailure, agentRunStart } from './agentReport.js';
|
|
7
|
+
import { showTestFileResult } from './showTestFileResult.js';
|
|
8
|
+
import { agentRunStart } from './agentReport.js';
|
|
15
9
|
import { makeStopSignal, stopIfFailFast } from './stopSignal.js';
|
|
16
|
-
import { statusCodes, writeStatusFile } from './statusFile.js';
|
|
17
10
|
import { makeRunManagerState } from './makeWatchRunState.js';
|
|
11
|
+
import { showTestResultsSummary } from './showTestResultsSummary.js';
|
|
18
12
|
const { timeProfileAsync } = createTimeProfiler(showTimeProfiling);
|
|
19
|
-
|
|
20
|
-
function joinPlain(...parts) {
|
|
21
|
-
return parts.filter(part => part !== '').join(' ');
|
|
22
|
-
}
|
|
23
|
-
function plural(count, noun, verb) {
|
|
24
|
-
if (count < 1)
|
|
25
|
-
return '';
|
|
26
|
-
return `${count} ${noun}${count === 1 ? '' : 's'} ${verb}`;
|
|
27
|
-
}
|
|
28
|
-
function recordWithoutTests(state, testFile, testResult) {
|
|
13
|
+
function recordEntitiesWithoutTests(state, testFile, testResult) {
|
|
29
14
|
const describes = testResult.describeResults
|
|
30
15
|
.filter(describeResult => describeResult.success === null)
|
|
31
16
|
.map(describeResult => describeResult.thing);
|
|
@@ -48,7 +33,7 @@ refresh = 'refresh', customOut, filters = {}) {
|
|
|
48
33
|
}
|
|
49
34
|
const state = reRunManager?.state || makeRunManagerState();
|
|
50
35
|
const runStartTime = new Date().getTime();
|
|
51
|
-
const
|
|
36
|
+
const runNumber = agentRunStart(config, testFiles.size);
|
|
52
37
|
const stop = makeStopSignal();
|
|
53
38
|
//console.log('new runTests:', watchRunState?.activeRuns)
|
|
54
39
|
//console.log(inspect(testFiles))
|
|
@@ -74,7 +59,7 @@ refresh = 'refresh', customOut, filters = {}) {
|
|
|
74
59
|
else {
|
|
75
60
|
const testRunPromise = runTest(config, test, filters, stop);
|
|
76
61
|
testRunPromises[testFile] = testRunPromise;
|
|
77
|
-
testRunOutPromises[testFile] = testRunPromise.then(
|
|
62
|
+
testRunOutPromises[testFile] = testRunPromise.then(testResult => {
|
|
78
63
|
if (testResult.success === true || testResult.success === null) {
|
|
79
64
|
state.failedTestFiles.delete(testResult.file);
|
|
80
65
|
}
|
|
@@ -84,9 +69,9 @@ refresh = 'refresh', customOut, filters = {}) {
|
|
|
84
69
|
const executionFilterActive = filters.describe !== undefined || filters.it !== undefined;
|
|
85
70
|
// a filter makes files and describes look empty when they are not
|
|
86
71
|
if (!executionFilterActive)
|
|
87
|
-
|
|
72
|
+
recordEntitiesWithoutTests(state, testFile, testResult);
|
|
88
73
|
if (!executionFilterActive || testResult.describeResultsSummary.itsTotal > 0) {
|
|
89
|
-
|
|
74
|
+
showTestFileResult(config, testResult, customOut);
|
|
90
75
|
}
|
|
91
76
|
});
|
|
92
77
|
// wait for the test to complete before proceeding if we are in 'sequential' mode
|
|
@@ -102,171 +87,7 @@ refresh = 'refresh', customOut, filters = {}) {
|
|
|
102
87
|
// wait for the output to complete
|
|
103
88
|
await promiseAllObj(testRunOutPromises);
|
|
104
89
|
});
|
|
105
|
-
return
|
|
106
|
-
const out = customOut ?? mainOut;
|
|
107
|
-
const testsResultsSummary = {
|
|
108
|
-
total: 0,
|
|
109
|
-
passes: 0,
|
|
110
|
-
invalid: 0,
|
|
111
|
-
describesTotal: 0,
|
|
112
|
-
describesPasses: 0,
|
|
113
|
-
describesInvalid: 0,
|
|
114
|
-
itsTotal: 0,
|
|
115
|
-
itsPasses: 0
|
|
116
|
-
// itsInvalid: 0 // we don't check whether tests run any asserts (we don't control the assertion lib)
|
|
117
|
-
};
|
|
118
|
-
let describesThrownCount = 0;
|
|
119
|
-
for (const testFile in runTestResults) {
|
|
120
|
-
const runTestResult = runTestResults[testFile];
|
|
121
|
-
if (!runTestResult)
|
|
122
|
-
continue;
|
|
123
|
-
testsResultsSummary.total += +(runTestResult.success !== null);
|
|
124
|
-
testsResultsSummary.passes += +(runTestResult.success ?? false);
|
|
125
|
-
testsResultsSummary.invalid += +(runTestResult.success === null);
|
|
126
|
-
testsResultsSummary.describesTotal += runTestResult.describeResultsSummary.total;
|
|
127
|
-
testsResultsSummary.describesPasses += runTestResult.describeResultsSummary.passes;
|
|
128
|
-
testsResultsSummary.describesInvalid += runTestResult.describeResultsSummary.invalid;
|
|
129
|
-
testsResultsSummary.itsTotal += runTestResult.describeResultsSummary.itsTotal;
|
|
130
|
-
testsResultsSummary.itsPasses += runTestResult.describeResultsSummary.itsPasses;
|
|
131
|
-
describesThrownCount += runTestResult.describeResults
|
|
132
|
-
.filter(describeResult => describeResult.error !== undefined)
|
|
133
|
-
.length;
|
|
134
|
-
}
|
|
135
|
-
const failedToLoadCount = count(erroringTests);
|
|
136
|
-
testsResultsSummary.total += failedToLoadCount;
|
|
137
|
-
if ((filters.describe !== undefined || filters.it !== undefined)
|
|
138
|
-
&& testsResultsSummary.itsTotal === 0
|
|
139
|
-
&& failedToLoadCount === 0
|
|
140
|
-
&& describesThrownCount === 0) {
|
|
141
|
-
out(chalk.orange('No tests matched the describe/test filters.'));
|
|
142
|
-
const durationMs = new Date().getTime() - runStartTime;
|
|
143
|
-
writeStatusFile(config, statusCodes.couldNotRun, 'no tests matched the describe/test filters', [], durationMs);
|
|
144
|
-
agentDone(config, agentRun, statusCodes.couldNotRun, 'no tests matched the describe/test filters', testsResultsSummary, durationMs, state.failedTestFiles.size);
|
|
145
|
-
return null;
|
|
146
|
-
}
|
|
147
|
-
out(config.compact ? '' : '\n');
|
|
148
|
-
const allPassed = (testsResultsSummary.passes === testsResultsSummary.total
|
|
149
|
-
&& testsResultsSummary.describesPasses === testsResultsSummary.describesTotal
|
|
150
|
-
&& testsResultsSummary.itsPasses === testsResultsSummary.itsTotal);
|
|
151
|
-
if (allPassed) {
|
|
152
|
-
out(chalk.mediumgreen(`${figures.tick}`));
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
155
|
-
out(chalk.mediumred(`${figures.cross}`));
|
|
156
|
-
}
|
|
157
|
-
// number of tests successful
|
|
158
|
-
const testsText = `Tests: ${testsResultsSummary.itsPasses}/${testsResultsSummary.itsTotal}`;
|
|
159
|
-
if (testsResultsSummary.itsPasses === testsResultsSummary.itsTotal) {
|
|
160
|
-
if (testsResultsSummary.itsTotal === 0) {
|
|
161
|
-
out(chalk.grey(`${testsText}`));
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
out(chalk.mediumgreen(`${testsText}`));
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
else {
|
|
168
|
-
out(chalk.mediumred(`${testsText}`));
|
|
169
|
-
}
|
|
170
|
-
// number of items successful
|
|
171
|
-
const describesText = `Items: ${testsResultsSummary.describesPasses}/${testsResultsSummary.describesTotal}`;
|
|
172
|
-
const invalidDescribesPlain = (testsResultsSummary.describesInvalid >= 1)
|
|
173
|
-
? (testsResultsSummary.describesInvalid === 1)
|
|
174
|
-
? '(+1 describe without tests)'
|
|
175
|
-
: `(+${testsResultsSummary.describesInvalid} describes without tests)`
|
|
176
|
-
: '';
|
|
177
|
-
const describesThrownPlain = (describesThrownCount >= 1)
|
|
178
|
-
? (describesThrownCount === 1)
|
|
179
|
-
? '(1 describe errored)'
|
|
180
|
-
: `(${describesThrownCount} describes errored)`
|
|
181
|
-
: '';
|
|
182
|
-
const describesDetailsText = [
|
|
183
|
-
chalk.mediumred(describesThrownPlain), chalk.grey(invalidDescribesPlain)
|
|
184
|
-
]
|
|
185
|
-
.filter(text => text !== '')
|
|
186
|
-
.join(' ');
|
|
187
|
-
const describesDetailsSuffix = describesDetailsText === '' ? '' : ` ${describesDetailsText}`;
|
|
188
|
-
if (testsResultsSummary.describesPasses === testsResultsSummary.describesTotal) {
|
|
189
|
-
if (testsResultsSummary.describesTotal === 0) {
|
|
190
|
-
out(chalk.grey(`${describesText}`) + describesDetailsSuffix);
|
|
191
|
-
}
|
|
192
|
-
else {
|
|
193
|
-
out(chalk.mediumgreen(`${describesText}`) + describesDetailsSuffix);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
else {
|
|
197
|
-
out(chalk.mediumred(`${describesText}`) + describesDetailsSuffix);
|
|
198
|
-
}
|
|
199
|
-
// number of test files successful
|
|
200
|
-
const testFilesText = `Test Files: ${testsResultsSummary.passes}/${testsResultsSummary.total}`;
|
|
201
|
-
const invalidTestFilesPlain = (testsResultsSummary.invalid >= 1)
|
|
202
|
-
? (testsResultsSummary.invalid === 1)
|
|
203
|
-
? '(+1 file without tests)'
|
|
204
|
-
: `(+${testsResultsSummary.invalid} files without tests)`
|
|
205
|
-
: '';
|
|
206
|
-
const failedToLoadPlain = (failedToLoadCount >= 1)
|
|
207
|
-
? (failedToLoadCount === 1)
|
|
208
|
-
? '(1 file failed to load, or errored)'
|
|
209
|
-
: `(${failedToLoadCount} files failed to load, or errored)`
|
|
210
|
-
: '';
|
|
211
|
-
const testFilesDetailsText = [
|
|
212
|
-
chalk.mediumred(failedToLoadPlain), chalk.grey(invalidTestFilesPlain)
|
|
213
|
-
]
|
|
214
|
-
.filter(text => text !== '')
|
|
215
|
-
.join(' ');
|
|
216
|
-
const testFilesDetailsSuffix = testFilesDetailsText === '' ? '' : ` ${testFilesDetailsText}`;
|
|
217
|
-
if (testsResultsSummary.passes === testsResultsSummary.total) {
|
|
218
|
-
if (testsResultsSummary.describesTotal === 0) {
|
|
219
|
-
out(chalk.grey(`${testFilesText}`) + testFilesDetailsSuffix);
|
|
220
|
-
}
|
|
221
|
-
else {
|
|
222
|
-
out(chalk.mediumgreen(`${testFilesText}`) + testFilesDetailsSuffix);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
else {
|
|
226
|
-
out(chalk.mediumred(`${testFilesText}`) + testFilesDetailsSuffix);
|
|
227
|
-
}
|
|
228
|
-
// the tallies only cover what ran, so say the run was cut short - otherwise
|
|
229
|
-
// "Tests: 0/1" reads as a one test suite
|
|
230
|
-
const stoppedPlain = (stop.stopped)
|
|
231
|
-
? 'stopped at the first failure (failFast)'
|
|
232
|
-
: '';
|
|
233
|
-
if (stoppedPlain !== '')
|
|
234
|
-
out(chalk.orange(stoppedPlain));
|
|
235
|
-
const summaryLines = [
|
|
236
|
-
testsText,
|
|
237
|
-
joinPlain(describesText, describesThrownPlain, invalidDescribesPlain),
|
|
238
|
-
joinPlain(testFilesText, failedToLoadPlain, invalidTestFilesPlain),
|
|
239
|
-
...(stoppedPlain === '') ? [] : [stoppedPlain]
|
|
240
|
-
];
|
|
241
|
-
const durationMs = new Date().getTime() - runStartTime;
|
|
242
|
-
if (allPassed) {
|
|
243
|
-
writeStatusFile(config, statusCodes.passed, 'all tests passed', summaryLines, durationMs);
|
|
244
|
-
agentDone(config, agentRun, statusCodes.passed, 'all tests passed', testsResultsSummary, durationMs, state.failedTestFiles.size);
|
|
245
|
-
}
|
|
246
|
-
else {
|
|
247
|
-
const abortedFiles = Object.keys(erroringTests);
|
|
248
|
-
// a file that would not load, or a describe that threw, means the run died
|
|
249
|
-
// partway - a different problem from tests that ran and failed
|
|
250
|
-
const aborted = abortedFiles.length > 0 || describesThrownCount > 0;
|
|
251
|
-
const failedTestsCount = testsResultsSummary.itsTotal - testsResultsSummary.itsPasses;
|
|
252
|
-
const description = ([
|
|
253
|
-
plural(abortedFiles.length, 'test file', 'failed to load or errored'),
|
|
254
|
-
plural(describesThrownCount, 'describe', 'errored'),
|
|
255
|
-
plural(failedTestsCount, 'test', 'failed')
|
|
256
|
-
].filter(part => part !== '').join(', ') || 'test run failed')
|
|
257
|
-
+ ((stop.stopped) ? ', stopped at the first failure' : '');
|
|
258
|
-
const code = (aborted) ? statusCodes.aborted : statusCodes.failed;
|
|
259
|
-
const failures = failureEntries(Object.values(runTestResults), erroringTests);
|
|
260
|
-
writeStatusFile(config, code, description, [...summaryLines, ...failureLines(Object.values(runTestResults), erroringTests)], durationMs);
|
|
261
|
-
// failures first, so the done line is a complete end of run marker
|
|
262
|
-
for (const failure of failures)
|
|
263
|
-
agentFailure(config, agentRun, failure);
|
|
264
|
-
agentDone(config, agentRun, code, description, testsResultsSummary, durationMs, state.failedTestFiles.size);
|
|
265
|
-
}
|
|
266
|
-
// full success?
|
|
267
|
-
// true/false gets returned to the caller of runTests()
|
|
268
|
-
return allPassed;
|
|
269
|
-
});
|
|
90
|
+
return showTestResultsSummary(runTestResults, erroringTests, runStartTime, config, runNumber, state, stop, filters, customOut);
|
|
270
91
|
}
|
|
271
92
|
finally {
|
|
272
93
|
if (reRunManager !== undefined)
|