sxy-test-runner 2.4.11 → 2.4.13
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/dist/checkMeta.js.map +1 -1
- package/dist/cli/cliTypes.d.ts +12 -0
- package/dist/cli/cliTypes.js +3 -0
- package/dist/cli/cliTypes.js.map +1 -0
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/init.js +1 -1
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/lib/addBasePath.js.map +1 -1
- package/dist/cli/lib/addExports.js +6 -1
- package/dist/cli/lib/addExports.js.map +1 -1
- package/dist/cli/lib/agentReport.d.ts +2 -1
- package/dist/cli/lib/agentReport.js.map +1 -1
- package/dist/cli/lib/alwaysCacheBust.js.map +1 -1
- package/dist/cli/lib/applyConfigDefaults.js.map +1 -1
- package/dist/cli/lib/buildDependencyTree.js.map +1 -1
- package/dist/cli/lib/buildDependencyTrees.js.map +1 -1
- package/dist/cli/lib/consoleCapture.js.map +1 -1
- package/dist/cli/lib/defaultConfig.js.map +1 -1
- package/dist/cli/lib/doUserSetup.js +1 -1
- package/dist/cli/lib/doUserSetup.js.map +1 -1
- package/dist/cli/lib/doUserTeardown.js +1 -1
- package/dist/cli/lib/doUserTeardown.js.map +1 -1
- package/dist/cli/lib/exitCodes.js.map +1 -1
- package/dist/cli/lib/failureEntries.d.ts +2 -1
- package/dist/cli/lib/failureEntries.js +2 -0
- package/dist/cli/lib/failureEntries.js.map +1 -1
- package/dist/cli/lib/failureLines.d.ts +2 -1
- package/dist/cli/lib/failureLines.js.map +1 -1
- package/dist/cli/lib/filter.js.map +1 -1
- package/dist/cli/lib/findTestFiles.js.map +1 -1
- package/dist/cli/lib/findingTestsMessage.d.ts +1 -1
- package/dist/cli/lib/findingTestsMessage.js.map +1 -1
- package/dist/cli/lib/getAllowedFlags.d.ts +1 -1
- package/dist/cli/lib/getAllowedFlags.js.map +1 -1
- package/dist/cli/lib/globArgCombine.js.map +1 -1
- package/dist/cli/lib/handleUserInput.d.ts +2 -2
- package/dist/cli/lib/handleUserInput.js +1 -1
- package/dist/cli/lib/handleUserInput.js.map +1 -1
- package/dist/cli/lib/injectProperties.js.map +1 -1
- package/dist/cli/lib/isTest.js.map +1 -1
- package/dist/cli/lib/listenToUser.d.ts +3 -3
- package/dist/cli/lib/listenToUser.js +33 -8
- package/dist/cli/lib/listenToUser.js.map +1 -1
- package/dist/cli/lib/loadConfig.js.map +1 -1
- package/dist/cli/lib/loadTestFile.d.ts +10 -1
- package/dist/cli/lib/loadTestFile.js +23 -11
- package/dist/cli/lib/loadTestFile.js.map +1 -1
- package/dist/cli/lib/makeWatchRunState.js.map +1 -1
- package/dist/cli/lib/parseCommandLineArguments.d.ts +1 -1
- package/dist/cli/lib/parseCommandLineArguments.js.map +1 -1
- package/dist/cli/lib/parseDescribe.js +3 -3
- package/dist/cli/lib/parseDescribe.js.map +1 -1
- package/dist/cli/lib/reRunManager.d.ts +1 -1
- package/dist/cli/lib/reRunManager.js +1 -1
- package/dist/cli/lib/reRunManager.js.map +1 -1
- package/dist/cli/lib/reservedExportKeys.js.map +1 -1
- package/dist/cli/lib/resolveCommand.js.map +1 -1
- package/dist/cli/lib/runDescribe.d.ts +16 -1
- package/dist/cli/lib/runDescribe.js.map +1 -1
- package/dist/cli/lib/runDescribeRun.d.ts +2 -1
- package/dist/cli/lib/runDescribeRun.js +1 -1
- package/dist/cli/lib/runDescribeRun.js.map +1 -1
- package/dist/cli/lib/runIt.d.ts +9 -1
- package/dist/cli/lib/runIt.js +11 -7
- package/dist/cli/lib/runIt.js.map +1 -1
- package/dist/cli/lib/runTasks.d.ts +1 -1
- package/dist/cli/lib/runTasks.js +6 -4
- package/dist/cli/lib/runTasks.js.map +1 -1
- package/dist/cli/lib/runTest.d.ts +19 -1
- package/dist/cli/lib/runTest.js +4 -3
- package/dist/cli/lib/runTest.js.map +1 -1
- package/dist/cli/lib/runTests.d.ts +15 -3
- package/dist/cli/lib/runTests.js +25 -8
- package/dist/cli/lib/runTests.js.map +1 -1
- package/dist/cli/lib/showTestLoadingError.d.ts +2 -1
- package/dist/cli/lib/showTestLoadingError.js +1 -1
- package/dist/cli/lib/showTestLoadingError.js.map +1 -1
- package/dist/cli/lib/showTestResult.d.ts +2 -1
- package/dist/cli/lib/showTestResult.js +48 -45
- package/dist/cli/lib/showTestResult.js.map +1 -1
- package/dist/cli/lib/showTtyHelp.js.map +1 -1
- package/dist/cli/lib/shutdown.d.ts +1 -1
- package/dist/cli/lib/shutdown.js +11 -3
- package/dist/cli/lib/shutdown.js.map +1 -1
- package/dist/cli/lib/statusFile.js.map +1 -1
- package/dist/cli/lib/stopSignal.js.map +1 -1
- package/dist/cli/lib/timeProfier.js.map +1 -1
- package/dist/cli/lib/validateConfig.js.map +1 -1
- package/dist/cli/lib/watchFilesAndRunTests.js.map +1 -1
- package/dist/cli/lib/watchFilesAndRunTestsChokidar.js +3 -3
- package/dist/cli/lib/watchFilesAndRunTestsChokidar.js.map +1 -1
- package/dist/cli/lib/watchFilesAndRunTestsNodeWatch.d.ts +5 -3
- package/dist/cli/lib/watchFilesAndRunTestsNodeWatch.js +18 -11
- package/dist/cli/lib/watchFilesAndRunTestsNodeWatch.js.map +1 -1
- package/dist/cli/lib/watchFilesChokidar.d.ts +1 -3
- package/dist/cli/lib/watchFilesChokidar.js +52 -43
- package/dist/cli/lib/watchFilesChokidar.js.map +1 -1
- package/dist/cli/lib/watchFilesNodeWatch.d.ts +2 -3
- package/dist/cli/lib/watchFilesNodeWatch.js +3 -3
- package/dist/cli/lib/watchFilesNodeWatch.js.map +1 -1
- package/dist/cli/once.js.map +1 -1
- package/dist/cli/version.js.map +1 -1
- package/dist/cli/watch.d.ts +2 -0
- package/dist/cli/watch.js +43 -18
- package/dist/cli/watch.js.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/describe.js +1 -1
- package/dist/describe.js.map +1 -1
- package/dist/indexNumberToLetters.js.map +1 -1
- package/dist/meta.js.map +1 -1
- package/dist/output.js +2 -0
- package/dist/output.js.map +1 -1
- package/dist/packages/chalk.js.map +1 -1
- package/dist/packages/esmReload.js.map +1 -1
- package/dist/packages/figures.js.map +1 -1
- package/dist/packages/loadConfig.js.map +1 -1
- package/dist/packages/mergeStructuredConfig.js.map +1 -1
- package/dist/packages/slash.js.map +1 -1
- package/dist/packages/timeProfiler.js.map +1 -1
- package/dist/types.d.ts +13 -81
- package/dist/types.js.map +1 -1
- package/package.json +5 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ReRunManager } from './reRunManager.js';
|
|
2
|
-
import { RunTestsPromise } from './runTests.js';
|
|
3
1
|
import type { OutFn } from '../../types.js';
|
|
2
|
+
import { type ReRunManager } from './reRunManager.js';
|
|
3
|
+
import type { RunTestsPromise } from './runTests.js';
|
|
4
4
|
export type RerunTestsFactory = (testFiles: Set<string>) => () => RunTestsPromise;
|
|
5
|
-
export declare function listenToUser(rerunManager: ReRunManager, rerunTestsCallback: RerunTestsFactory, ttyActionsOnKeypress: boolean | undefined, initialTestRun: Promise<boolean | null> | null, input?: NodeJS.ReadStream, customOut?: OutFn):
|
|
5
|
+
export declare function listenToUser(rerunManager: ReRunManager, rerunTestsCallback: RerunTestsFactory, ttyActionsOnKeypress: boolean | undefined, initialTestRun: Promise<boolean | null> | null, input?: NodeJS.ReadStream, customOut?: OutFn): () => void;
|
|
6
6
|
//# sourceMappingURL=listenToUser.d.ts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createInterface, emitKeypressEvents } from 'node:readline';
|
|
2
2
|
import { showTtyHelp } from './showTtyHelp.js';
|
|
3
3
|
import { handleUserInput } from './handleUserInput.js';
|
|
4
|
-
import { out as mainOut } from '../../output.js';
|
|
5
|
-
export
|
|
4
|
+
import { out as mainOut, error as printError } from '../../output.js';
|
|
5
|
+
export function listenToUser(
|
|
6
6
|
//allTestFiles: Set<string>,
|
|
7
7
|
//failingTests: Set<string>,
|
|
8
8
|
rerunManager, rerunTestsCallback, ttyActionsOnKeypress = false, initialTestRun, input = process.stdin, customOut) {
|
|
@@ -12,9 +12,11 @@ rerunManager, rerunTestsCallback, ttyActionsOnKeypress = false, initialTestRun,
|
|
|
12
12
|
//console.log('initia test run', initialTestRun)
|
|
13
13
|
//console.log('listen to user')
|
|
14
14
|
//setInterval(() => console.log('active runs: ', rerunManager.state.activeRuns), 10_000)
|
|
15
|
+
// set by whichever branch attaches listeners below
|
|
16
|
+
let disposeInput = () => { };
|
|
15
17
|
if (!input.isTTY) {
|
|
16
18
|
out('No TTY available, not receiving cli input');
|
|
17
|
-
return
|
|
19
|
+
return () => { };
|
|
18
20
|
}
|
|
19
21
|
if (ttyActionsOnKeypress) {
|
|
20
22
|
//console.log('ttyActionsOnKeypress')
|
|
@@ -36,7 +38,7 @@ rerunManager, rerunTestsCallback, ttyActionsOnKeypress = false, initialTestRun,
|
|
|
36
38
|
input.once('close', restoreRawMode);
|
|
37
39
|
if (input === process.stdin)
|
|
38
40
|
process.once('exit', restoreRawMode);
|
|
39
|
-
|
|
41
|
+
const onKeypress = (keypressInput, key) => {
|
|
40
42
|
//console.log('keypress', keypressInput)
|
|
41
43
|
if (key.ctrl === true && key.name === 'c') {
|
|
42
44
|
restoreRawMode();
|
|
@@ -49,7 +51,17 @@ rerunManager, rerunTestsCallback, ttyActionsOnKeypress = false, initialTestRun,
|
|
|
49
51
|
return;
|
|
50
52
|
}
|
|
51
53
|
handleUserInput(keypressInput, rerunManager, rerunTestsCallback);
|
|
52
|
-
}
|
|
54
|
+
};
|
|
55
|
+
input.on('keypress', onKeypress);
|
|
56
|
+
disposeInput = () => {
|
|
57
|
+
input.off('keypress', onKeypress);
|
|
58
|
+
// a `once` listener that never fired is still attached
|
|
59
|
+
input.off('close', restoreRawMode);
|
|
60
|
+
process.off('exit', restoreRawMode);
|
|
61
|
+
restoreRawMode();
|
|
62
|
+
// undoes the resume above, so stdin stops holding the event loop open
|
|
63
|
+
input.pause();
|
|
64
|
+
};
|
|
53
65
|
}
|
|
54
66
|
else {
|
|
55
67
|
//console.log('no ttyActionsOnKeypress')
|
|
@@ -58,10 +70,23 @@ rerunManager, rerunTestsCallback, ttyActionsOnKeypress = false, initialTestRun,
|
|
|
58
70
|
//console.log('line input', input)
|
|
59
71
|
handleUserInput(input, rerunManager, rerunTestsCallback);
|
|
60
72
|
});
|
|
73
|
+
disposeInput = () => {
|
|
74
|
+
// close() takes readline's own data/end/error listeners off the stream
|
|
75
|
+
userInput.close();
|
|
76
|
+
input.pause();
|
|
77
|
+
};
|
|
61
78
|
}
|
|
79
|
+
let stopped = false;
|
|
62
80
|
//console.log('initialTestRun 2', initialTestRun)
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
81
|
+
initialTestRun
|
|
82
|
+
?.then(() => { if (!stopped)
|
|
83
|
+
showTtyHelp(input.isTTY, out); }, e => printError('Error in initial test run', e))
|
|
84
|
+
.catch(e => { printError('Error showing TTY help', e); });
|
|
85
|
+
return () => {
|
|
86
|
+
if (!stopped) {
|
|
87
|
+
stopped = true;
|
|
88
|
+
disposeInput();
|
|
89
|
+
}
|
|
90
|
+
};
|
|
66
91
|
}
|
|
67
92
|
//# sourceMappingURL=listenToUser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listenToUser.js","sourceRoot":"","sources":["../../../src/cli/lib/listenToUser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAY,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"listenToUser.js","sourceRoot":"","sources":["../../../src/cli/lib/listenToUser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAY,MAAM,eAAe,CAAA;AAK7E,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,GAAG,IAAI,OAAO,EAAE,KAAK,IAAI,UAAU,EAAE,MA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nB,iDAAiD;IACjD,cAAc;QACV,EAAE,IAAI,CACF,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO;QAAE,WAAW,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA,CAAC,CAAC,EACrD,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,2BAA2B,EAAE,CAAC,CAAC,CAClD;SACA,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,UAAU,CAAC,wBAAwB,EAAE,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAA;IAE5D,OAAO,GAAG,EAAE;QACR,IAAI,CAAC,OAAO,EAAE,CAAC;YACX,OAAO,GAAG,IAAI,CAAA;YACd,YAAY,EAAE,CAAA;QAClB,CAAC;IACL,CAAC,CAAA;AACL,CAAC","sourcesContent":["\nimport { createInterface, emitKeypressEvents, type Key } from 'node:readline'\n\nimport type { OutFn } from '../../types.js'\nimport { type ReRunManager } from './reRunManager.js'\nimport type { RunTestsPromise } from './runTests.js'\nimport { showTtyHelp } from './showTtyHelp.js'\nimport { handleUserInput } from './handleUserInput.js'\nimport { out as mainOut, error as printError } from '../../output.js'\n\n\nexport type RerunTestsFactory = (testFiles: Set<string>) => () => RunTestsPromise\n\nexport function listenToUser(\n //allTestFiles: Set<string>,\n //failingTests: Set<string>,\n rerunManager: ReRunManager,\n rerunTestsCallback: RerunTestsFactory,\n ttyActionsOnKeypress = false,\n initialTestRun: Promise<boolean | null> | null,\n input: NodeJS.ReadStream = process.stdin,\n customOut?: OutFn\n): () => void {\n // an agent spawned session has no TTY, so these notices would otherwise be the only\n // lines in agent mode that are not agent events\n const out = customOut ?? mainOut\n\n //console.log('initia test run', initialTestRun)\n //console.log('listen to user')\n\n //setInterval(() => console.log('active runs: ', rerunManager.state.activeRuns), 10_000)\n\n // set by whichever branch attaches listeners below\n let disposeInput = (): void => {}\n\n if (!input.isTTY) {\n out('No TTY available, not receiving cli input')\n return () => {}\n }\n\n if (ttyActionsOnKeypress) {\n \n //console.log('ttyActionsOnKeypress')\n\n emitKeypressEvents(input)\n\n const wasRaw = input.isRaw\n const restoreRawMode = (): void => {\n //console.log('restoreRawMode')\n if (input.isRaw === wasRaw) return\n try {\n input.setRawMode(wasRaw)\n } catch {\n // The terminal stream may already be closed during process shutdown.\n }\n }\n\n input.setRawMode(true)\n input.resume()\n input.once('close', restoreRawMode)\n if (input === process.stdin) process.once('exit', restoreRawMode)\n\n const onKeypress = (keypressInput: string, key: Key): void => {\n //console.log('keypress', keypressInput)\n if (key.ctrl === true && key.name === 'c') {\n restoreRawMode()\n // process.kill(process.pid, 'SIGINT') terminates unconditionally on Windows\n // rather than raising the event, which skips the shutdown handlers and so\n // skips the user's teardown. Emitting reaches them on every platform.\n // Nothing listening means nobody will exit for us, so do it here.\n if (!process.emit('SIGINT', 'SIGINT')) process.exit(130)\n return\n }\n\n handleUserInput(keypressInput, rerunManager, rerunTestsCallback)\n }\n input.on('keypress', onKeypress)\n\n disposeInput = () => {\n input.off('keypress', onKeypress)\n // a `once` listener that never fired is still attached\n input.off('close', restoreRawMode)\n process.off('exit', restoreRawMode)\n restoreRawMode()\n // undoes the resume above, so stdin stops holding the event loop open\n input.pause()\n }\n } else {\n //console.log('no ttyActionsOnKeypress')\n\n const userInput = createInterface({ input })\n\n userInput.on('line', input => {\n //console.log('line input', input)\n handleUserInput(input, rerunManager, rerunTestsCallback)\n })\n\n disposeInput = () => {\n // close() takes readline's own data/end/error listeners off the stream\n userInput.close()\n input.pause()\n }\n }\n\n let stopped = false\n\n //console.log('initialTestRun 2', initialTestRun)\n initialTestRun\n ?.then(\n () => { if (!stopped) showTtyHelp(input.isTTY, out) },\n e => printError('Error in initial test run', e)\n )\n .catch(e => { printError('Error showing TTY help', e) })\n\n return () => {\n if (!stopped) {\n stopped = true\n disposeInput()\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadConfig.js","sourceRoot":"","sources":["../../../src/cli/lib/loadConfig.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loadConfig.js","sourceRoot":"","sources":["../../../src/cli/lib/loadConfig.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,IAAI,aAAa,EAAE,eAAe,IAAI,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AACjH,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACxF,OAAO,KAAK,MAAM,yBAAyB,CAAA;AAC3C,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA;AAGrC,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,cAAuB;IACpD,MAAM,YAAY,GAAG,CAAC,cAAc,KAAK,SAAS,CAAC;QAC/C,CAAC,CAAC,MAAM,kBAAkB,CAAa,cAAc,CAAC;QACtD,CAAC,CAAC,MAAM,aAAa,CAAa,eAAe,EAAE,eAAe,CAAC,CAAA;IAEvE,IAAI,CAAC,YAAY,EAAE,CAAC;QAChB,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,WAAW,oBAAoB;cAC9C,qBAAqB,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;cAC/E,+CAA+C;cAC/C,kBAAkB,OAAO,wBAAwB,CAAC,CAAC,CAAA;QACzD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACnB,CAAC;IAED,OAAO,YAAY,CAAA;AACvB,CAAC","sourcesContent":["\nimport type { UserConfig, UserConfigInternal } from '../../types.js'\nimport { loadConfig as sxyLoadConfig, loadConfigExact as sxyLoadConfigExact } from '../../packages/loadConfig.js'\nimport { packageName, cliName, configFileNames, configLocations } from '../../config.js'\nimport chalk from '../../packages/chalk.js'\nimport { out } from '../../output.js'\n\n\nexport async function loadConfig(customLocation?: string): Promise<UserConfigInternal> {\n const configOrNull = (customLocation !== undefined)\n ? await sxyLoadConfigExact<UserConfig>(customLocation)\n : await sxyLoadConfig<UserConfig>(configFileNames, configLocations)\n\n if (!configOrNull) {\n out(chalk.orange(`[${packageName}] No config found.`\n + `\\nPlease create a ${configFileNames.map(x => `${x}.js/cjs/mjs`).join(' or ')}`\n + ' file in your project root or /config folder.'\n + `\\nOr run \\`npx ${cliName} init\\` to create one.`))\n process.exit(0)\n }\n\n return configOrNull\n}\n"]}
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
+
import type { Describe, FinalConfig } from '../../types.js';
|
|
2
|
+
import type { FileMeta } from '../../meta.js';
|
|
1
3
|
import '../../packages/esmReload.js';
|
|
2
|
-
|
|
4
|
+
export type TestFile = {
|
|
5
|
+
file: string;
|
|
6
|
+
sourceFile?: string;
|
|
7
|
+
describes?: Describe[];
|
|
8
|
+
meta?: FileMeta;
|
|
9
|
+
error?: string | false;
|
|
10
|
+
logs?: unknown[][];
|
|
11
|
+
};
|
|
3
12
|
export declare function loadTestFile(config: FinalConfig, testFile: string, refresh?: 'refresh' | 'cached'): Promise<TestFile>;
|
|
4
13
|
//# sourceMappingURL=loadTestFile.d.ts.map
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { findSourceMap } from 'node:module';
|
|
3
|
+
import { join, relative } from 'node:path';
|
|
4
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
2
5
|
import chalk from '../../packages/chalk.js';
|
|
6
|
+
import slash from '../../packages/slash.js';
|
|
3
7
|
import { createTimeProfiler } from '../../packages/timeProfiler.js';
|
|
4
8
|
import '../../packages/esmReload.js'; // registers the test module reload hook
|
|
5
9
|
import { showTimeProfiling } from '../../config.js';
|
|
@@ -8,8 +12,16 @@ import { captureLogs } from './consoleCapture.js';
|
|
|
8
12
|
const { timeProfileAsync } = createTimeProfiler(showTimeProfiling);
|
|
9
13
|
let loading = null;
|
|
10
14
|
let importIteration = 1;
|
|
11
|
-
|
|
12
|
-
|
|
15
|
+
// reads the map Node already parsed for stack traces, which is keyed by the exact import URL
|
|
16
|
+
function mappedSourceFile(moduleUrl) {
|
|
17
|
+
const sources = findSourceMap(moduleUrl)?.payload.sources;
|
|
18
|
+
const source = sources?.length === 1 ? sources[0] : undefined;
|
|
19
|
+
if (source === undefined || !source.startsWith('file:'))
|
|
20
|
+
return undefined;
|
|
21
|
+
const sourcePath = fileURLToPath(source);
|
|
22
|
+
if (!existsSync(sourcePath))
|
|
23
|
+
return undefined;
|
|
24
|
+
return slash(relative(process.cwd(), sourcePath));
|
|
13
25
|
}
|
|
14
26
|
export async function loadTestFile(config, testFile, refresh = 'refresh') {
|
|
15
27
|
if (loading !== null) {
|
|
@@ -19,23 +31,20 @@ export async function loadTestFile(config, testFile, refresh = 'refresh') {
|
|
|
19
31
|
}
|
|
20
32
|
const loadPromise = timeProfileAsync(`load test ${testFile}`, async () => {
|
|
21
33
|
const projectDir = process.cwd();
|
|
22
|
-
// eslint-disable-next-line camelcase
|
|
23
34
|
global.__sxy_test_runner__ = {
|
|
24
35
|
describes: [],
|
|
25
36
|
describeCounter: 1
|
|
26
37
|
};
|
|
27
|
-
const testFileFullUrl =
|
|
38
|
+
const testFileFullUrl = pathToFileURL(join(projectDir, testFile)).href;
|
|
39
|
+
const importUrl = refresh === 'refresh'
|
|
40
|
+
? testFileFullUrl + `?sxyt-instance=${importIteration++}`
|
|
41
|
+
: testFileFullUrl;
|
|
28
42
|
const test = { file: testFile };
|
|
29
43
|
//// capture console.log output
|
|
30
44
|
const logs = [];
|
|
31
45
|
await captureLogs(logs, async () => {
|
|
32
46
|
try {
|
|
33
|
-
|
|
34
|
-
await importFresh(testFileFullUrl);
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
await import(testFileFullUrl);
|
|
38
|
-
}
|
|
47
|
+
await import(importUrl);
|
|
39
48
|
test.describes = global.__sxy_test_runner__?.describes ?? [];
|
|
40
49
|
test.meta = global.__sxy_test_runner__?.fileMeta;
|
|
41
50
|
test.error = false;
|
|
@@ -44,6 +53,9 @@ export async function loadTestFile(config, testFile, refresh = 'refresh') {
|
|
|
44
53
|
test.error = `Error loading file\n${String(e)}`;
|
|
45
54
|
}
|
|
46
55
|
});
|
|
56
|
+
const sourceFile = mappedSourceFile(importUrl);
|
|
57
|
+
if (sourceFile !== undefined)
|
|
58
|
+
test.sourceFile = sourceFile;
|
|
47
59
|
test.logs = logs;
|
|
48
60
|
////
|
|
49
61
|
return test;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadTestFile.js","sourceRoot":"","sources":["../../../src/cli/lib/loadTestFile.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loadTestFile.js","sourceRoot":"","sources":["../../../src/cli/lib/loadTestFile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAC1C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAIvD,OAAO,KAAK,MAAM,yBAAyB,CAAA;AAC3C,OAAO,KAAK,MAAM,yBAAyB,CAAA;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACnE,OAAO,6BAA6B,CAAA,CAAC,wCAAwC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAGjD,MAAM,EAAE,gBAAgB,EAAE,GAAG,kBAAkB,CAAC,iBAAiB,CAAC,CAAA;AAYlE,IAAI,OAAO,GAA6B,IAAI,CAAA;AAE5C,IAAI,eAAe,GAAG,CAAC,CAAA;AAEvB,6FAA6F;AAC7F,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Ae,GAAG,kBAAkB,eAAe,EAAE,EAAE;YACzD,CAAC,CAAC,eAAe,CAAA;QAErB,MAAM,IAAI,GAAa,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAA;QAEzC,+BAA+B;QAC/B,MAAM,IAAI,GAAgB,EAAE,CAAA;QAC5B,MAAM,WAAW,CAAC,IAAI,EAAE,KAAK,IAAI,EAAE;YAC/B,IAAI,CAAC;gBACD,MAAM,MAAM,CAAC,SAAS,CAAC,CAAA;gBACvB,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,mBAAmB,EAAE,SAAS,IAAI,EAAE,CAAA;gBAC5D,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,mBAAmB,EAAE,QAAQ,CAAA;gBAChD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;YACtB,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACT,IAAI,CAAC,KAAK,GAAG,uBAAuB,MAAM,CAAC,CAAC,CAAC,EAAE,CAAA;YACnD,CAAC;QACL,CAAC,CAAC,CAAA;QACF,MAAM,UAAU,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAA;QAC9C,IAAI,UAAU,KAAK,SAAS;YAAE,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC1D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI;QAEJ,OAAO,IAAI,CAAA;IACf,CAAC,CAAC,CAAA;IAEF,OAAO,GAAG,WAAW,CAAA;IAErB,OAAO,MAAM,WAAW,CAAA;AAC5B,CAAC","sourcesContent":["\nimport { existsSync } from 'node:fs'\nimport { findSourceMap } from 'node:module'\nimport { join, relative } from 'node:path'\nimport { fileURLToPath, pathToFileURL } from 'node:url'\n\nimport type { Describe, FinalConfig } from '../../types.js'\nimport type { FileMeta } from '../../meta.js'\nimport chalk from '../../packages/chalk.js'\nimport slash from '../../packages/slash.js'\nimport { createTimeProfiler } from '../../packages/timeProfiler.js'\nimport '../../packages/esmReload.js' // registers the test module reload hook\nimport { showTimeProfiling } from '../../config.js'\nimport { debug } from '../../output.js'\nimport { captureLogs } from './consoleCapture.js'\n\n\nconst { timeProfileAsync } = createTimeProfiler(showTimeProfiling)\n\nexport type TestFile = {\n file: string\n // project relative, from the file's source map\n sourceFile?: string\n describes?: Describe[]\n meta?: FileMeta\n error?: string | false\n logs?: unknown[][]\n}\n\nlet loading: Promise<TestFile> | null = null\n\nlet importIteration = 1\n\n// reads the map Node already parsed for stack traces, which is keyed by the exact import URL\nfunction mappedSourceFile(moduleUrl: string): string | undefined {\n const sources = findSourceMap(moduleUrl)?.payload.sources\n const source = sources?.length === 1 ? sources[0] : undefined\n if (source === undefined || !source.startsWith('file:')) return undefined\n const sourcePath = fileURLToPath(source)\n if (!existsSync(sourcePath)) return undefined\n return slash(relative(process.cwd(), sourcePath))\n}\n\nexport async function loadTestFile(\n config: FinalConfig,\n testFile: string,\n refresh: 'refresh' | 'cached' = 'refresh'\n): Promise<TestFile> {\n if (loading !== null) {\n debug(chalk.yellow`loadTestFile - another file is loading - waiting for it to finish`)\n await loading\n debug(chalk.yellow`previous file complete - will now load the file`)\n }\n\n const loadPromise = timeProfileAsync(`load test ${testFile}`, async () => {\n const projectDir = process.cwd()\n\n global.__sxy_test_runner__ = {\n describes: [],\n describeCounter: 1\n }\n\n const testFileFullUrl = pathToFileURL(join(projectDir, testFile)).href\n const importUrl = refresh === 'refresh'\n ? testFileFullUrl + `?sxyt-instance=${importIteration++}`\n : testFileFullUrl\n\n const test: TestFile = { file: testFile }\n\n //// capture console.log output\n const logs: unknown[][] = []\n await captureLogs(logs, async () => {\n try {\n await import(importUrl)\n test.describes = global.__sxy_test_runner__?.describes ?? []\n test.meta = global.__sxy_test_runner__?.fileMeta\n test.error = false\n } catch (e) {\n test.error = `Error loading file\\n${String(e)}`\n }\n })\n const sourceFile = mappedSourceFile(importUrl)\n if (sourceFile !== undefined) test.sourceFile = sourceFile\n test.logs = logs\n ////\n\n return test\n })\n\n loading = loadPromise\n\n return await loadPromise\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeWatchRunState.js","sourceRoot":"","sources":["../../../src/cli/lib/makeWatchRunState.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"makeWatchRunState.js","sourceRoot":"","sources":["../../../src/cli/lib/makeWatchRunState.ts"],"names":[],"mappings":"AAaA,gBAAgB;AAEhB,MAAM,UAAU,mBAAmB,CAAC,YAAuB,EAAE;IACzD,MAAM,CAAC,GAAG;QACN,YAAY,EAAE,IAAI,GAAW;QAC7B,aAAa,EAAE,IAAI,GAAW;QAC9B,eAAe,EAAE,IAAI,GAAW;QAChC,aAAa,EAAE,IAAI,GAAW;QAC9B,UAAU,EAAE,CAAC;QACb,UAAU,EAAE,IAAI;KACnB,CAAA;IAED,IAAI,SAAS,CAAC,YAAY;QAAE,CAAC,CAAC,YAAY,GAAG,SAAS,CAAC,YAAY,CAAA;IACnE,IAAI,SAAS,CAAC,eAAe;QAAE,CAAC,CAAC,eAAe,GAAG,SAAS,CAAC,eAAe,CAAA;IAC5E,IAAI,SAAS,CAAC,aAAa;QAAE,CAAC,CAAC,aAAa,GAAG,SAAS,CAAC,aAAa,CAAA;IAEtE,OAAO,CAAC,CAAA;AACZ,CAAC","sourcesContent":["\r\nexport type Overrides = Partial<Pick<ReRunManageState, 'allTestFiles' | 'failedTestFiles' | 'lastTestFiles'>>\r\n\r\nexport type ReRunManageState = {\r\n allTestFiles: Set<string>\r\n lastTestFiles: Set<string>\r\n failedTestFiles: Set<string>\r\n untestedFiles: Set<string>\r\n activeRuns: number // N/A\r\n currentRun: Promise<boolean | null> | null // N/A - manager\r\n}\r\n\r\n\r\n// lastTestFiles\r\n\r\nexport function makeRunManagerState(overrides: Overrides = {}): ReRunManageState {\r\n const s = {\r\n allTestFiles: new Set<string>,\r\n lastTestFiles: new Set<string>,\r\n failedTestFiles: new Set<string>,\r\n untestedFiles: new Set<string>,\r\n activeRuns: 0,\r\n currentRun: null,\r\n }\r\n\r\n if (overrides.allTestFiles) s.allTestFiles = overrides.allTestFiles\r\n if (overrides.failedTestFiles) s.failedTestFiles = overrides.failedTestFiles\r\n if (overrides.lastTestFiles) s.lastTestFiles = overrides.lastTestFiles\r\n\r\n return s\r\n}\r\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { AllowedArguments, ParsedArguments } from '
|
|
1
|
+
import type { AllowedArguments, ParsedArguments } from '../cliTypes.js';
|
|
2
2
|
export declare function parseCommandLineArguments(allowedArguments: AllowedArguments): ParsedArguments;
|
|
3
3
|
//# sourceMappingURL=parseCommandLineArguments.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseCommandLineArguments.js","sourceRoot":"","sources":["../../../src/cli/lib/parseCommandLineArguments.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"parseCommandLineArguments.js","sourceRoot":"","sources":["../../../src/cli/lib/parseCommandLineArguments.ts"],"names":[],"mappings":"AACA,SAAS;AACT,QAAQ;AACR,6BAA6B;AAG7B,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAG3D,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,MAAM,yBAAyB,CAAA;AAG3C,MAAM,UAAU,yBAAyB,CAAC,gBAAkC;IACxE,MAAM,YAAY,GAAG,eAAe,CAAC,gBAAgB,CAAC,CAAA;IAEtD,MAAM,UAAU,GAAoB,EAAE,CAAA;IACtC,uFAAuF;IACvF,wCAAwC;IACxC,MAAM,WAAW,GAAa,EAAE,CAAA;IAEhC,KAAK,IAAI,QAAQ,GAAG,CAAC,EAAE,QAAQ,GAAG,2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EAAE,CAAC;QACzB,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,OAAO,uCAAuC,CAAC,CAAC,CAAA;QAC1E,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAA;IACtC,CAAC;IAED,OAAO,UAAU,CAAA;AACrB,CAAC","sourcesContent":["\n// watch:\n// once:\n// // --config configLocation\n\n\nimport { reduce as objectReduce } from 'sxy-lib/objects.js'\n\nimport type { AllowedArguments, ParsedArguments } from '../cliTypes.js'\nimport { packageName, cliName } from '../../config.js'\nimport { log } from '../../output.js'\nimport { exitCodes } from './exitCodes.js'\nimport { getAllowedFlags } from './getAllowedFlags.js'\nimport chalk from '../../packages/chalk.js'\n\n\nexport function parseCommandLineArguments(allowedArguments: AllowedArguments): ParsedArguments {\n const allowedFlags = getAllowedFlags(allowedArguments)\n\n const returnArgs: ParsedArguments = {}\n // collected rather than reported one at a time, so a mistyped command line is fixed in\n // one go rather than one option per run\n const unknownArgs: string[] = []\n\n for (let position = 0; position < __sxyt_commandLineArguments.length; position++) {\n const arg = __sxyt_commandLineArguments[position]\n if (arg === undefined) continue\n if (arg.slice(0, 2) === '--') {\n const longFlag = arg.slice(2)\n const allowedArgument = allowedArguments[longFlag]\n if (allowedArgument) {\n if (allowedArgument.hasValue) {\n const value = __sxyt_commandLineArguments[++position]\n if (value !== undefined) returnArgs[longFlag] = value\n } else {\n returnArgs[longFlag] = true\n }\n } else {\n unknownArgs.push(`--${longFlag}`)\n log(chalk.mediumred(`[${packageName}] Unknown option --${longFlag}`))\n if (\n longFlag.length === 1\n && objectReduce(\n allowedArguments,\n (prev: boolean, _key: string, value: {\n flag?: string\n hasValue: boolean\n }) => {\n if (value.flag === longFlag) return true\n return prev\n },\n false\n )\n ) {\n log(chalk.mediumred(`I think you meant -${longFlag}`))\n }\n }\n } else if (arg.slice(0, 1) === '-') {\n const shortFlag = arg.slice(1)\n const longFlag = allowedFlags[shortFlag]\n if (longFlag !== undefined) {\n if (longFlag in returnArgs) {\n log(chalk.orange(\n `[${packageName}] Option --${longFlag} already set, being overwritten by -${shortFlag}`\n ))\n }\n\n const allowedArgument = allowedArguments[longFlag]\n if (allowedArgument?.hasValue === true) {\n const value = __sxyt_commandLineArguments[++position]\n if (value !== undefined) returnArgs[longFlag] = value\n } else {\n returnArgs[longFlag] = true\n }\n } else {\n unknownArgs.push(`-${shortFlag}`)\n log(chalk.mediumred(`[${packageName}] Unknown flag -${shortFlag}`))\n if (shortFlag.length > 1 && shortFlag in allowedArguments) {\n log(chalk.mediumred(`I think you meant --${shortFlag}`))\n }\n }\n }\n }\n\n // stop rather than run something other than what was asked for: an ignored option can\n // mean the wrong tests, or a whole suite where a single filtered test was wanted\n if (unknownArgs.length > 0) {\n log(chalk.orange(`Run \\`${cliName} help\\` to see the available options.`))\n process.exit(exitCodes.usageError)\n }\n\n return returnArgs\n}\n"]}
|
|
@@ -67,7 +67,7 @@ export function parseDescribe(config, describe, itFilter) {
|
|
|
67
67
|
const beforeDescribeExports = {};
|
|
68
68
|
await configBeforeEachDescribe(config, beforeDescribeExports);
|
|
69
69
|
const describeParcel = { it, test: it, afterDescribe, beforeEachTest, afterEachTest };
|
|
70
|
-
addExports(describeParcel, beforeDescribeExports);
|
|
70
|
+
addExports(describeParcel, beforeDescribeExports, 'beforeEachDescribe');
|
|
71
71
|
let error;
|
|
72
72
|
try {
|
|
73
73
|
await describe.tests(describeParcel);
|
|
@@ -87,9 +87,9 @@ export function parseDescribe(config, describe, itFilter) {
|
|
|
87
87
|
}
|
|
88
88
|
async function configBeforeEachDescribe(config, exports) {
|
|
89
89
|
if (config.beforeEachDescribe !== undefined) {
|
|
90
|
-
const theExports = await runTasks(config.beforeEachDescribe, undefined);
|
|
90
|
+
const theExports = await runTasks(config.beforeEachDescribe, undefined, 'beforeEachDescribe');
|
|
91
91
|
if (theExports)
|
|
92
|
-
addExports(exports, theExports);
|
|
92
|
+
addExports(exports, theExports, 'beforeEachDescribe');
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
//# sourceMappingURL=parseDescribe.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseDescribe.js","sourceRoot":"","sources":["../../../src/cli/lib/parseDescribe.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"parseDescribe.js","sourceRoot":"","sources":["../../../src/cli/lib/parseDescribe.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAG5C,MAAM,qBAAsB,SAAQ,KAAK;IACrC,IAAI,GAAG,uBAAuB,CAAA;CACjC;AACD,MAAM,uBAAwB,SAAQ,KAAK;IACvC,IAAI,GAAG,yBAAyB,CAAA;CACnC;AAED,SAAS,yBAAyB,CAAC,KAAa,EAAE,IAAa;IAC3D,MAAM,IAAI,qBAAqB,CAAC,GAAG,KAAK,gCAAgC,KAAK,wBAAwB;UAC/F,aAAa,OAAO,IAAI,EAAE,CAAC,CAAA;AACrC,CAAC;AAED,SAAS,wBAAwB,CAAC,KAAa;IAC3C,MAAM,IAAI,uBAAuB,CAAC,GAAG,KAAK,aAAa,KAAK,+BAA+B;UACrF,iCAAiC,CAAC,CAAA;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;YACnD,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE,CAAC;gBAC7B,yBAAyB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,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 './timeProfier.js'\nimport { runTasks } from './runTasks.js'\nimport { addExports } from './addExports.js'\n\n\nclass SxytNotAFunctionError extends Error {\n name = 'SxytNotAFunctionError'\n}\nclass SxytAlreadyDefinedError extends Error {\n name = 'SxytAlreadyDefinedError'\n}\n\nfunction throwMustBeAFunctionError(fname: string, func: unknown): never {\n throw new SxytNotAFunctionError(`${fname}() error, argument passed to ${fname}() must be a function,`\n + ` received ${typeof func}`)\n}\n\nfunction throwAlreadyDefinedError(fname: string): never {\n throw new SxytAlreadyDefinedError(`${fname}() error, ${fname} function is already defined.`\n + ' Only one function is permitted')\n}\n\nexport function parseDescribe(\n config: FinalConfig,\n describe: Describe,\n itFilter?: string\n): Promise<ParsedDescribe> {\n return timeProfileAsync(`parse its from describe ${describe.thing}`, async () => {\n let itCounter = 1\n const its: It[] = []\n\n // create functions to pass back\n\n // afterDescribe\n let afterDescribeFunc: (() => void | Promise<void>) | undefined\n function afterDescribe(func: () => void | Promise<void>): void {\n if (typeof func !== 'function') {\n throwMustBeAFunctionError('afterDescribe', func)\n }\n if (afterDescribeFunc !== undefined) {\n throwAlreadyDefinedError('afterDescribe')\n }\n afterDescribeFunc = func\n }\n\n // beforeEachTest\n let beforeEachTestFunc: (() => TaskExports | void | Promise<TaskExports | void>) | undefined\n function beforeEachTest(func: () => TaskExports | void | Promise<TaskExports | void>): void {\n if (typeof func !== 'function') {\n throwMustBeAFunctionError('beforeEachTest', func)\n }\n if (beforeEachTestFunc !== undefined) {\n throwAlreadyDefinedError('beforeEachTest')\n }\n beforeEachTestFunc = func\n }\n\n // afterEachTest\n let afterEachTestFunc: (() => void | Promise<void>) | undefined\n function afterEachTest(func: () => void | Promise<void>): void {\n if (typeof func !== 'function') {\n throwMustBeAFunctionError('afterEachTest', func)\n }\n if (afterEachTestFunc !== undefined) {\n throwAlreadyDefinedError('afterEachTest')\n }\n afterEachTestFunc = func\n }\n\n // it\n function it(should: string, test: It['test']): void {\n const thisItCounter = itCounter++\n if (itFilter !== undefined && !should.toLowerCase().includes(itFilter.toLowerCase())) return\n its.push({\n counter: thisItCounter,\n should,\n test\n })\n }\n\n const beforeDescribeExports: TaskExports = {}\n await configBeforeEachDescribe(config, beforeDescribeExports)\n\n const describeParcel: DescribeParcel = { it, test: it, afterDescribe, beforeEachTest, afterEachTest }\n addExports(describeParcel, beforeDescribeExports, 'beforeEachDescribe')\n\n let error: unknown\n try {\n await describe.tests(describeParcel)\n } catch (e) {\n error = e\n }\n\n return {\n its,\n beforeDescribeExports,\n afterDescribeFunc,\n beforeEachTestFunc,\n afterEachTestFunc,\n error\n }\n })\n}\n\nasync function configBeforeEachDescribe(config: FinalConfig, exports: TaskExports): Promise<void> {\n if (config.beforeEachDescribe !== undefined) {\n const theExports = await runTasks(config.beforeEachDescribe, undefined, 'beforeEachDescribe')\n if (theExports) addExports(exports, theExports, 'beforeEachDescribe')\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReRunManageState } from './makeWatchRunState.js';
|
|
1
|
+
import type { ReRunManageState } from './makeWatchRunState.js';
|
|
2
2
|
import type { RunTestsPromise } from './runTests.js';
|
|
3
3
|
import type { OutFn } from '../../types.js';
|
|
4
4
|
export type RunType = 'auto' | 'all' | 'last' | 'failed';
|
|
@@ -87,7 +87,7 @@ customOut) {
|
|
|
87
87
|
}
|
|
88
88
|
debug('added to queue', inspect(queue));
|
|
89
89
|
// see if we can run it
|
|
90
|
-
return processQueue()
|
|
90
|
+
return processQueue().catch(err => log(`processQueue threw an error: ${err}`));
|
|
91
91
|
},
|
|
92
92
|
__test
|
|
93
93
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reRunManager.js","sourceRoot":"","sources":["../../../src/cli/lib/reRunManager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"reRunManager.js","sourceRoot":"","sources":["../../../src/cli/lib/reRunManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAK9B,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,IAAI,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,KAAK,MAAM,yBAAyB,CAAA;AAuB3C,MAAM,UAAU,gBAAgB,CAC5B,UAAkC,EAClC,KAAuB;AACvB,iCAAiC;AACjC,2BAA2B;AAC3B,SAAiB;IAEjB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qBACX,CAAC,CAAA;YACN,CAAC;YACD,KAAK,CAAC,gBAAgB,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAA;YACvC,uBAAuB;YACvB,OAAO,YAAY,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,gCAAgC,GAAG,EAAE,CAAC,CAAC,CAAA;QAClF,CAAC;QACD,MAAM;KACT,CAAA;AACL,CAAC","sourcesContent":["\nimport { inspect } from 'util'\n\nimport type { ReRunManageState } from './makeWatchRunState.js'\nimport type { RunTestsPromise } from './runTests.js'\nimport type { OutFn } from '../../types.js'\nimport { debug, log, out as mainOut } from '../../output.js'\nimport { agentSetRunReason } from './agentReport.js'\nimport chalk from '../../packages/chalk.js'\n\n\nexport type RunType = 'auto' | 'all' | 'last' | 'failed'\n\ntype RunReqest = {\n type: RunType\n //tests: string[] | Set<string>\n callback: () => RunTestsPromise\n}\n\n//export type ReRunManager = ReturnType<typeof makeReRunManager>\n\nexport type ReRunManager = {\n state: ReRunManageState\n requestRun: (type: RunType, callback: () => RunTestsPromise) => Promise<void>\n __test: {\n waiting: boolean\n queue: RunReqest[]\n }\n}\n\n\nexport function makeReRunManager(\n currentRun: RunTestsPromise | null,\n state: ReRunManageState,\n //callback: () => RunTestsPromise\n //concurrency: Concurrency,\n customOut?: OutFn\n): ReRunManager {\n // agent mode passes a sink - runTests reports the run instead\n const out = customOut ?? mainOut\n let queue: RunReqest[] = []\n let waiting = false\n\n const __test = {\n waiting,\n queue\n }\n\n async function processQueue() {\n \n debug('processing queue')\n\n if (waiting) return // do nothing if another processQueue is already waiting\n __test.waiting = waiting = true // mark that we are waiting\n await currentRun // wait for current run\n __test.waiting = waiting = false\n\n debug('done waitinng')\n\n // see if there is a request waiting\n debug('the queue', inspect(queue))\n const runReqest = queue.shift()\n debug('runReqest', runReqest)\n if (runReqest === undefined) return\n\n // tells the run about to start why it is running, for the agent `why=` field\n agentSetRunReason(runReqest.type)\n\n switch (runReqest.type) {\n case 'all': {\n out(chalk.brightblue`re-running all tests...`)\n break\n }\n case 'last': {\n out(chalk.brightblue`re-running last tests...`)\n break\n }\n case 'failed': {\n out(chalk.brightblue`re-running failed tests...`)\n break\n }\n case 'auto': {\n out(chalk.brightblue`running tests due to file changes`)\n break\n }\n default: throw new Error('Unrecognised run type')\n }\n\n // run it and save it\n debug('calling', runReqest.callback.toString())\n currentRun = runReqest.callback()\n state.currentRun = currentRun\n // wait for the run then trigger another processQueue\n await currentRun\n // if one has already been started by a run request\n // then this won't start a new one. This is used to\n // clear a queue if it has built it\n processQueue().catch(err => log(`processQueue threw an error: ${err}`))\n }\n\n return {\n state,\n requestRun(type: RunType, callback: () => RunTestsPromise) {\n\n // if it's type auto, we only want to keep one, but\n // we want it to include all relevant tests when it runs\n\n // if it's a human triggered type, we'll replace other\n // human requests, but leave the auto, so the user\n // can see update to changed code that would be hidden\n // otherwise\n \n if (type === 'auto') {\n __test.queue = queue = queue.filter(x => x.type !== 'auto')\n queue.push({\n type,\n //tests,\n callback\n })\n } else {\n __test.queue = queue = queue.filter(x => x.type === 'auto')\n __test.queue = queue = [{\n type,\n //tests,\n callback\n }]\n }\n debug('added to queue', inspect(queue))\n // see if we can run it\n return processQueue().catch(err => log(`processQueue threw an error: ${err}`))\n },\n __test\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reservedExportKeys.js","sourceRoot":"","sources":["../../../src/cli/lib/reservedExportKeys.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"reservedExportKeys.js","sourceRoot":"","sources":["../../../src/cli/lib/reservedExportKeys.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAC9B,UAAU;IACV,MAAM;IACN,IAAI;IACJ,QAAQ;IACR,OAAO;IACP,YAAY;IACZ,WAAW;IACX,WAAW;IACX,UAAU;CACb,CAAA","sourcesContent":["\nexport const reservedExportKeys = [\n 'describe',\n 'test',\n 'it',\n 'before',\n 'after',\n 'beforeEach',\n 'afterEach',\n 'beforeAll',\n 'afterAll'\n]\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveCommand.js","sourceRoot":"","sources":["../../../src/cli/lib/resolveCommand.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolveCommand.js","sourceRoot":"","sources":["../../../src/cli/lib/resolveCommand.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,CAAU,CAAA;AAS7E,SAAS,SAAS,CAAC,KAAa;IAC5B,OAAQ,QAA8B,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;AAC1D,CAAC;AAED,4FAA4F;AAC5F,2FAA2F;AAC3F,uEAAuE;AACvE,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC;IAC7B,UAAU,EAAE,IAAI;IAChB,cAAc,EAAE,IAAI;IACpB,UAAU,EAAE,IAAI;IAChB,aAAa,EAAE,IAAI;IACnB,mBAAmB,EAAE,IAAI;IACzB,eAAe,EAAE,IAAI;CACxB,CAAC,CAAA;AAEF,4FAA4F;AAC5F,gDAAgD;AAChD,SAAS,mBAAmB,CAAC,WAAqB;IAC9C,KAAK,IAAI,QAAQ,GAAG,CAAC,EAAE,QAAQ,GAAG,WAAW,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE,CAAC;QAC/D,MAAM,GAAG,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAA;QACjC,IAAI,GAAG,KAAK,SAAS;YAAE,SAAQ;QAC/B,IAAI,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YAC5B,QAAQ,EAAE,CAAA,CAAC,yCAAyC;YACpD,SAAQ;QACZ,CAAC;QACD,IAAI,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI;YAAE,OAAO,MAAM,CAAA;QACnD,IAAI,GAAG,KAAK,WAAW,IAAI,GAAG,KAAK,IAAI;YAAE,OAAO,SAAS,CAAA;IAC7D,CAAC;IACD,OAAO,SAAS,CAAA;AACpB,CAAC;AAED,4FAA4F;AAC5F,wEAAwE;AACxE,MAAM,UAAU,cAAc,CAAC,IAAc;IACzC,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;IAErB,IAAI,KAAK,KAAK,SAAS,IAAI,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1C,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;QACjC,OAAO,EAAE,OAAO,EAAE,mBAAmB,CAAC,WAAW,CAAC,IAAI,KAAK,EAAE,WAAW,EAAE,CAAA;IAC9E,CAAC;IAED,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7E,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;QACjC,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAY,CAAA;QACzC,OAAO,EAAE,OAAO,EAAE,mBAAmB,CAAC,WAAW,CAAC,IAAI,OAAO,EAAE,WAAW,EAAE,CAAA;IAChF,CAAC;IAED,8DAA8D;IAC9D,OAAO,EAAE,OAAO,EAAE,mBAAmB,CAAC,IAAI,CAAC,IAAI,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,CAAA;AAC/E,CAAC","sourcesContent":["\nexport const commands = ['init', 'once', 'watch', 'help', 'version'] as const\n\nexport type Command = typeof commands[number]\n\nexport interface ResolvedCommand {\n command: Command\n commandArgs: string[]\n}\n\nfunction isCommand(value: string): value is Command {\n return (commands as readonly string[]).includes(value)\n}\n\n// The options that consume the next argument, so `--filter-it -h` is understood as a filter\n// for \"-h\" rather than a request for help. Worst case if this drifts from the option lists\n// in watch.ts and once.ts is that such an argument shows help instead.\nconst valueTakingFlags = new Set([\n '--config', '-c',\n '--test-files', '-t',\n '--filter', '-f',\n '--filter-it', '-i',\n '--filter-describe', '-d',\n '--status-file', '-s'\n])\n\n// --help and --version describe the tool rather than asking it to do anything, so they take\n// over from whatever command they were given to\nfunction interceptingCommand(commandArgs: string[]): Command | undefined {\n for (let position = 0; position < commandArgs.length; position++) {\n const arg = commandArgs[position]\n if (arg === undefined) continue\n if (valueTakingFlags.has(arg)) {\n position++ // skip the value, whatever it looks like\n continue\n }\n if (arg === '--help' || arg === '-h') return 'help'\n if (arg === '--version' || arg === '-v') return 'version'\n }\n return undefined\n}\n\n// Routes the raw argv tail to a command. Extracted from the entry module so the routing can\n// be tested without running a command as a side effect of importing it.\nexport function resolveCommand(args: string[]): ResolvedCommand {\n const first = args[0]\n\n if (first !== undefined && isCommand(first)) {\n const commandArgs = args.slice(1)\n return { command: interceptingCommand(commandArgs) ?? first, commandArgs }\n }\n\n if (first !== undefined && first.startsWith('--') && isCommand(first.slice(2))) {\n const commandArgs = args.slice(1)\n const command = first.slice(2) as Command\n return { command: interceptingCommand(commandArgs) ?? command, commandArgs }\n }\n\n // no command given - everything is an argument to the default\n return { command: interceptingCommand(args) ?? 'watch', commandArgs: args }\n}\n"]}
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
+
import type { FinalConfig, Describe } from '../../types.js';
|
|
2
|
+
import type { ItResult } from './runIt.js';
|
|
1
3
|
import { type StopSignal } from './stopSignal.js';
|
|
2
|
-
|
|
4
|
+
export type ItResultsSummary = {
|
|
5
|
+
total: number;
|
|
6
|
+
passes: number;
|
|
7
|
+
};
|
|
8
|
+
export type DescribeResult = {
|
|
9
|
+
counter: number;
|
|
10
|
+
thing: string;
|
|
11
|
+
success: boolean | null;
|
|
12
|
+
time: number;
|
|
13
|
+
itResults: ItResult[];
|
|
14
|
+
itResultsSummary: ItResultsSummary;
|
|
15
|
+
logs?: unknown[][];
|
|
16
|
+
error?: unknown;
|
|
17
|
+
};
|
|
3
18
|
export declare function runDescribe(config: FinalConfig, describe: Describe, itFilter?: string, stop?: StopSignal): Promise<DescribeResult>;
|
|
4
19
|
//# sourceMappingURL=runDescribe.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runDescribe.js","sourceRoot":"","sources":["../../../src/cli/lib/runDescribe.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runDescribe.js","sourceRoot":"","sources":["../../../src/cli/lib/runDescribe.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,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 './timeProfier.js'\nimport { parseDescribe } from './parseDescribe.js'\nimport { runDescribeRun } from './runDescribeRun.js'\nimport { captureLogs } from './consoleCapture.js'\nimport { makeStopSignal, stopIfFailFast, type StopSignal } from './stopSignal.js'\n\n\nexport type ItResultsSummary = { total: number, passes: number }\nexport type DescribeResult = {\n counter: number\n thing: string\n success: boolean | null\n // total elapsed for the whole describe, filled in by runDescribe once it has finished\n time: number\n itResults: ItResult[]\n itResultsSummary: ItResultsSummary\n logs?: unknown[][]\n error?: unknown\n}\n\nfunction createDescribeErrorResult(describe: Describe, error: unknown): DescribeResult {\n return {\n counter: describe.counter,\n thing: describe.thing,\n success: false,\n time: 0, // overwritten by runDescribe\n itResults: [],\n itResultsSummary: {\n total: 0,\n passes: 0\n },\n error\n }\n}\n\nexport function runDescribe(\n config: FinalConfig,\n describe: Describe,\n itFilter?: string,\n stop: StopSignal = makeStopSignal()\n): Promise<DescribeResult> {\n return timeProfileAsync(`run describe ${describe.thing}`, async () => {\n const logs: unknown[][] = []\n\n const startTime = new Date().getTime()\n\n const describeResult = await captureLogs(logs, async () => {\n try {\n const parsedDescribe = await parseDescribe(config, describe, itFilter)\n return parsedDescribe.error !== undefined\n ? createDescribeErrorResult(describe, parsedDescribe.error)\n : await runDescribeRun(config, describe, parsedDescribe, stop)\n } catch (e) {\n return createDescribeErrorResult(describe, e)\n }\n })\n\n describeResult.time = new Date().getTime() - startTime\n describeResult.logs = logs\n\n // a describe that threw stops the run just as a failing test does\n stopIfFailFast(config, stop, describeResult.error !== undefined)\n\n return describeResult\n })\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import type { FinalConfig, Describe, ParsedDescribe } from '../../types.js';
|
|
2
|
+
import type { DescribeResult } from './runDescribe.js';
|
|
1
3
|
import { type StopSignal } from './stopSignal.js';
|
|
2
|
-
import type { FinalConfig, Describe, DescribeResult, ParsedDescribe } from '../../types.js';
|
|
3
4
|
export declare function runDescribeRun(config: FinalConfig, describe: Describe, parsedIts: ParsedDescribe, stop?: StopSignal): Promise<DescribeResult>;
|
|
4
5
|
//# sourceMappingURL=runDescribeRun.d.ts.map
|
|
@@ -51,7 +51,7 @@ export function runDescribeRun(config, describe, parsedIts, stop = makeStopSigna
|
|
|
51
51
|
}
|
|
52
52
|
async function configAfterEachDescribe(config, exports) {
|
|
53
53
|
if (config.afterEachDescribe !== undefined) {
|
|
54
|
-
await runTasks(config.afterEachDescribe, exports);
|
|
54
|
+
await runTasks(config.afterEachDescribe, exports, 'afterEachDescribe');
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
//# sourceMappingURL=runDescribeRun.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runDescribeRun.js","sourceRoot":"","sources":["../../../src/cli/lib/runDescribeRun.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runDescribeRun.js","sourceRoot":"","sources":["../../../src/cli/lib/runDescribeRun.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,KAAK,EAAiB,MAAM,YAAY,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAmB,MAAM,iBAAiB,CAAA;AAGjF,MAAM,UAAU,cAAc,CAC1B,MAAmB,EACnB,QAAkB,EAClB,SAAyB,EACzB,OAAmB,cAAc,EAAE;IAEnC,OAAO,gBAAgB,CAAC,yBAAyB,QAAQ,CAAC,KAAK,EAAE,EAAE,KAAK,IAAI,EAAE;QAC1E,MAAM,EAAE,GAAG,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,GAAG,SAAS,CAAA;QAE1G,iFAAiF;QACjF,sBAAsB;QACtB,MAAM,gBAAgB,GAAG,QAAQ,CAAC,IAAI,KAAK,SAAS;YAChD,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,eAAe,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAA;QAErG,MAAM,UAAU,GAAG,gBAAgB,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,KAAK,UAAU,CAAA;QAE5E,MAAM,UAAU,GAA6B,EAAE,CAAA;QAC/C,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC;YAC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A6B;YACtC,SAAS;YACT,gBAAgB;SACnB,CAAA;QAED,YAAY;QACZ,IAAI,OAAO,iBAAiB,KAAK,UAAU;YAAE,MAAM,iBAAiB,EAAE,CAAA;QACtE,MAAM,uBAAuB,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAA;QAE5D,OAAO,cAAc,CAAA;IACzB,CAAC,CAAC,CAAA;AACN,CAAC;AAED,KAAK,UAAU,uBAAuB,CAAC,MAAmB,EAAE,OAAoB;IAC5E,IAAI,MAAM,CAAC,iBAAiB,KAAK,SAAS,EAAE,CAAC;QACzC,MAAM,QAAQ,CAAC,MAAM,CAAC,iBAAiB,EAAE,OAAO,EAAE,mBAAmB,CAAC,CAAA;IAC1E,CAAC;AACL,CAAC","sourcesContent":["\nimport type {\n FinalConfig, Describe, ParsedDescribe, TaskExports\n} from '../../types.js'\nimport type { DescribeResult } from './runDescribe.js'\nimport { timeProfileAsync } from './timeProfier.js'\nimport { runTasks } from './runTasks.js'\nimport { debug } from '../../output.js'\nimport { runIt, type ItResult } from './runIt.js'\nimport { makeStopSignal, stopIfFailFast, type StopSignal } from './stopSignal.js'\n\n\nexport function runDescribeRun(\n config: FinalConfig,\n describe: Describe,\n parsedIts: ParsedDescribe,\n stop: StopSignal = makeStopSignal()\n): Promise<DescribeResult> {\n return timeProfileAsync(`run describe, run its ${describe.thing}`, async () => {\n const { its, beforeDescribeExports, afterDescribeFunc, beforeEachTestFunc, afterEachTestFunc } = parsedIts\n\n // describe() rejects a meta naming neither key, so the else branch can only be a\n // sequentialTests one\n const parallelOverride = describe.meta === undefined\n ? undefined\n : 'parallelTests' in describe.meta ? describe.meta.parallelTests : !describe.meta.sequentialTests\n\n const isParallel = parallelOverride ?? config.execution.tests === 'parallel'\n\n const itPromises: Array<Promise<ItResult>> = []\n for (const it of its) {\n // checked before starting, so the failing test is the last one that runs\n if (stop.stopped) break\n const itPromise = runIt(config, it, beforeEachTestFunc, afterEachTestFunc)\n itPromises.push(itPromise)\n if (!isParallel) stopIfFailFast(config, stop, (await itPromise).success === false)\n }\n const itResults = await Promise.all(itPromises)\n\n // in parallel mode the tests are already in flight, so this only stops later work\n stopIfFailFast(config, stop, itResults.some(itResult => itResult.success === false))\n\n const itResultsSummary: DescribeResult['itResultsSummary'] = {\n total: 0,\n passes: 0\n }\n\n for (const itResult of itResults) {\n itResultsSummary.total += +(itResult.success !== null)\n itResultsSummary.passes += +(itResult.success ?? false)\n }\n\n debug('itResultsSummary', itResultsSummary)\n\n const describeResult: DescribeResult = {\n counter: describe.counter,\n thing: describe.thing,\n success: (itResultsSummary.total > 0) ? itResultsSummary.passes === itResultsSummary.total : null,\n time: 0, // overwritten by runDescribe\n itResults,\n itResultsSummary\n }\n\n // run after\n if (typeof afterDescribeFunc === 'function') await afterDescribeFunc()\n await configAfterEachDescribe(config, beforeDescribeExports)\n\n return describeResult\n })\n}\n\nasync function configAfterEachDescribe(config: FinalConfig, exports: TaskExports): Promise<void> {\n if (config.afterEachDescribe !== undefined) {\n await runTasks(config.afterEachDescribe, exports, 'afterEachDescribe')\n }\n}\n"]}
|
package/dist/cli/lib/runIt.d.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
import type { FinalConfig, It,
|
|
1
|
+
import type { FinalConfig, It, TaskExports } from '../../types.js';
|
|
2
|
+
export type ItResult = {
|
|
3
|
+
counter: number;
|
|
4
|
+
should: string;
|
|
5
|
+
success: boolean | null;
|
|
6
|
+
time: number;
|
|
7
|
+
error?: unknown;
|
|
8
|
+
logs: unknown[][];
|
|
9
|
+
};
|
|
2
10
|
export declare function runIt(config: FinalConfig, it: It, beforeEachTestFunc: (() => TaskExports | void | Promise<TaskExports | void>) | undefined, afterEachTestFunc: (() => void | Promise<void>) | undefined): Promise<ItResult>;
|
|
3
11
|
//# sourceMappingURL=runIt.d.ts.map
|