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,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import type { WatchEvent } from './watchFilesNodeWatch.js';
|
|
3
|
-
export declare function watchFilesChokidar(config: FinalConfig, onEvent: WatchEvent): Promise<import('chokidar').FSWatcher>;
|
|
1
|
+
export {};
|
|
4
2
|
//# sourceMappingURL=watchFilesChokidar.d.ts.map
|
|
@@ -1,44 +1,53 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
1
|
+
// import chokidar, { type FSWatcher } from 'chokidar'
|
|
2
|
+
// import minimatch from 'minimatch'
|
|
3
|
+
export {};
|
|
4
|
+
// import type { FinalConfig } from '../../types.js'
|
|
5
|
+
// import type { WatchEvent } from './watchFilesNodeWatch.js'
|
|
6
|
+
// import { createTimeProfiler } from '../../packages/timeProfiler.js'
|
|
7
|
+
// import { showTimeProfiling } from '../../config.js'
|
|
8
|
+
// import slash from '../../packages/slash.js'
|
|
9
|
+
// import { out, debug } from '../../output.js'
|
|
10
|
+
// import { addBasePath } from './addBasePath.js'
|
|
11
|
+
// import { globArgCombine } from './globArgCombine.js'
|
|
12
|
+
// const { timeProfileAsync } = createTimeProfiler(showTimeProfiling)
|
|
13
|
+
// export function watchFilesChokidar(config: FinalConfig, onEvent: WatchEvent): Promise<FSWatcher> {
|
|
14
|
+
// return timeProfileAsync('start watching', () => {
|
|
15
|
+
// if (config.watch.watchFilesBase === '') {
|
|
16
|
+
// out('No config.watch.watchFilesBase provided, defaulting to \'.\'')
|
|
17
|
+
// config.watch.watchFilesBase = '.'
|
|
18
|
+
// }
|
|
19
|
+
// // watch globs are relative to watchFilesBase, and chokidar reports paths
|
|
20
|
+
// // including the base, so bring the globs up to the same base
|
|
21
|
+
// const watchGlobs = addBasePath(config.watch.watchFilesBase, config.watch.watchFiles)
|
|
22
|
+
// const ignoreGlob = config.watch.watchFilesIgnore.length > 0
|
|
23
|
+
// ? addBasePath(config.watch.watchFilesBase, config.watch.watchFilesIgnore)
|
|
24
|
+
// : undefined
|
|
25
|
+
// // chokidar has no include option, and ignoring non-matching paths would stop it
|
|
26
|
+
// // descending into directories, so watchFiles is applied to the events instead
|
|
27
|
+
// const included = (file: string): boolean =>
|
|
28
|
+
// watchGlobs.length === 0 || minimatch(file, globArgCombine(watchGlobs))
|
|
29
|
+
// const watcher = chokidar.watch(
|
|
30
|
+
// config.watch.watchFilesBase,
|
|
31
|
+
// {
|
|
32
|
+
// ignored: ignoreGlob,
|
|
33
|
+
// ignoreInitial: true
|
|
34
|
+
// }
|
|
35
|
+
// )
|
|
36
|
+
// watcher.on('all', (event, filename) => {
|
|
37
|
+
// filename = slash(filename)
|
|
38
|
+
// if (!included(filename)) return
|
|
39
|
+
// debug('[watch event]', filename, event)
|
|
40
|
+
// onEvent(
|
|
41
|
+
// filename,
|
|
42
|
+
// (event === 'unlink') ? 'remove' : event
|
|
43
|
+
// )
|
|
44
|
+
// })
|
|
45
|
+
// return new Promise(resolve => {
|
|
46
|
+
// watcher.on('ready', () => {
|
|
47
|
+
// debug('chokidar watcher ready')
|
|
48
|
+
// resolve(watcher)
|
|
49
|
+
// })
|
|
50
|
+
// })
|
|
51
|
+
// })
|
|
52
|
+
// }
|
|
44
53
|
//# sourceMappingURL=watchFilesChokidar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watchFilesChokidar.js","sourceRoot":"","sources":["../../../src/cli/lib/watchFilesChokidar.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"watchFilesChokidar.js","sourceRoot":"","sources":["../../../src/cli/lib/watchFilesChokidar.ts"],"names":[],"mappings":"AACA,sDAAsD;AACtD,oCAAoC;;AAEpC,oDAAoD;AACpD,6DAA6D;AAC7D,sEAAsE;AACtE,sDAAsD;AACtD,8CAA8C;AAC9C,+CAA+C;AAC/C,iDAAiD;AACjD,uDAAuD;AAGvD,qEAAqE;AAErE,qGAAqG;AACrG,wDAAwD;AACxD,oDAAoD;AACpD,kFAAkF;AAClF,gDAAgD;AAChD,YAAY;AAEZ,oFAAoF;AACpF,wEAAwE;AACxE,+FAA+F;AAE/F,sEAAsE;AACtE,wFAAwF;AACxF,0BAA0B;AAE1B,2FAA2F;AAC3F,yFAAyF;AACzF,sDAAsD;AACtD,qFAAqF;AAErF,0CAA0C;AAC1C,2CAA2C;AAC3C,gBAAgB;AAChB,uCAAuC;AACvC,sCAAsC;AACtC,gBAAgB;AAChB,YAAY;AAEZ,mDAAmD;AACnD,yCAAyC;AACzC,8CAA8C;AAC9C,sDAAsD;AACtD,uBAAuB;AACvB,4BAA4B;AAC5B,0DAA0D;AAC1D,gBAAgB;AAChB,aAAa;AAEb,0CAA0C;AAC1C,0CAA0C;AAC1C,kDAAkD;AAClD,mCAAmC;AACnC,iBAAiB;AACjB,aAAa;AACb,SAAS;AACT,IAAI","sourcesContent":["\n// import chokidar, { type FSWatcher } from 'chokidar'\n// import minimatch from 'minimatch'\n\n// import type { FinalConfig } from '../../types.js'\n// import type { WatchEvent } from './watchFilesNodeWatch.js'\n// import { createTimeProfiler } from '../../packages/timeProfiler.js'\n// import { showTimeProfiling } from '../../config.js'\n// import slash from '../../packages/slash.js'\n// import { out, debug } from '../../output.js'\n// import { addBasePath } from './addBasePath.js'\n// import { globArgCombine } from './globArgCombine.js'\n\n\n// const { timeProfileAsync } = createTimeProfiler(showTimeProfiling)\n\n// export function watchFilesChokidar(config: FinalConfig, onEvent: WatchEvent): Promise<FSWatcher> {\n// return timeProfileAsync('start watching', () => {\n// if (config.watch.watchFilesBase === '') {\n// out('No config.watch.watchFilesBase provided, defaulting to \\'.\\'')\n// config.watch.watchFilesBase = '.'\n// }\n\n// // watch globs are relative to watchFilesBase, and chokidar reports paths\n// // including the base, so bring the globs up to the same base\n// const watchGlobs = addBasePath(config.watch.watchFilesBase, config.watch.watchFiles)\n\n// const ignoreGlob = config.watch.watchFilesIgnore.length > 0\n// ? addBasePath(config.watch.watchFilesBase, config.watch.watchFilesIgnore)\n// : undefined\n\n// // chokidar has no include option, and ignoring non-matching paths would stop it\n// // descending into directories, so watchFiles is applied to the events instead\n// const included = (file: string): boolean =>\n// watchGlobs.length === 0 || minimatch(file, globArgCombine(watchGlobs))\n\n// const watcher = chokidar.watch(\n// config.watch.watchFilesBase,\n// {\n// ignored: ignoreGlob,\n// ignoreInitial: true\n// }\n// )\n\n// watcher.on('all', (event, filename) => {\n// filename = slash(filename)\n// if (!included(filename)) return\n// debug('[watch event]', filename, event)\n// onEvent(\n// filename,\n// (event === 'unlink') ? 'remove' : event\n// )\n// })\n\n// return new Promise(resolve => {\n// watcher.on('ready', () => {\n// debug('chokidar watcher ready')\n// resolve(watcher)\n// })\n// })\n// })\n// }\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
+
import type { Watcher } from 'node-watch';
|
|
1
2
|
import type { FinalConfig } from '../../types.js';
|
|
2
|
-
export
|
|
3
|
-
on(event: 'ready', listener: () => void): void;
|
|
4
|
-
}
|
|
3
|
+
export type NodeWatchWatcher = Watcher;
|
|
5
4
|
export type WatchEvent = (filename: string, event: string) => void;
|
|
6
5
|
export declare function watchFilesNodeWatch(config: FinalConfig, onEvent: WatchEvent): Promise<NodeWatchWatcher>;
|
|
7
6
|
//# sourceMappingURL=watchFilesNodeWatch.d.ts.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import * as nodeWatchNS from 'node-watch';
|
|
2
|
+
import minimatch from 'minimatch';
|
|
1
3
|
import { createTimeProfiler } from '../../packages/timeProfiler.js';
|
|
2
4
|
import { showTimeProfiling } from '../../config.js';
|
|
3
|
-
import minimatch from 'minimatch';
|
|
4
5
|
import slash from '../../packages/slash.js';
|
|
5
|
-
import * as nodeWatchNS from 'node-watch';
|
|
6
6
|
import { out, debug } from '../../output.js';
|
|
7
7
|
import { globArgCombine } from './globArgCombine.js';
|
|
8
8
|
import { addBasePath } from './addBasePath.js';
|
|
9
9
|
const { timeProfileAsync } = createTimeProfiler(showTimeProfiling);
|
|
10
|
-
const nodeWatch = nodeWatchNS.default;
|
|
10
|
+
const nodeWatch = nodeWatchNS.default; // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion
|
|
11
11
|
export function watchFilesNodeWatch(config, onEvent) {
|
|
12
12
|
return timeProfileAsync('start watching', async () => {
|
|
13
13
|
if (config.watch.watchFilesBase === '') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watchFilesNodeWatch.js","sourceRoot":"","sources":["../../../src/cli/lib/watchFilesNodeWatch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"watchFilesNodeWatch.js","sourceRoot":"","sources":["../../../src/cli/lib/watchFilesNodeWatch.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,WAAW,MAAM,YAAY,CA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eAC5E,CACC,gBAAgB,CAAC,MAAM,KAAK,CAAC;mBAC1B,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,cAAc,CAAC,gBAAgB,CAAC,CAAC,CAC/D,CAAA;QAEL,MAAM,OAAO,GAAG,SAAS,CACrB,MAAM,CAAC,KAAK,CAAC,cAAc,EAC3B;YACI,SAAS,EAAE,IAAI;YACf,MAAM,EAAE,WAAW;SACtB,EACD,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;YAChB,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAA;YAC1B,KAAK,CAAC,aAAa,CAAC,CAAA;YACpB,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;QAC5B,CAAC,CACJ,CAAA;QAED,kCAAkC;QAClC,MAAM,IAAI,OAAO,CAAO,OAAO,CAAC,EAAE;YAC9B,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAChC,CAAC,CAAC,CAAA;QAEF,OAAO,OAAO,CAAA;IAClB,CAAC,CAAC,CAAA;AACN,CAAC","sourcesContent":["\nimport type { Watcher } from 'node-watch'\nimport * as nodeWatchNS from 'node-watch'\nimport minimatch from 'minimatch'\n\nimport type { FinalConfig } from '../../types.js'\nimport { createTimeProfiler } from '../../packages/timeProfiler.js'\nimport { showTimeProfiling } from '../../config.js'\nimport slash from '../../packages/slash.js'\nimport { out, debug } from '../../output.js'\nimport { globArgCombine } from './globArgCombine.js'\nimport { addBasePath } from './addBasePath.js'\n\n\nconst { timeProfileAsync } = createTimeProfiler(showTimeProfiling)\n\n// only the default export is mistyped, so the package's own Watcher type is usable as is\nexport type NodeWatchWatcher = Watcher\n\n// node-watch's shipped .d.ts mistypes the default export under NodeNext CJS interop\n// (resolves to the module namespace type, not the function) - cast at the call site.\ntype NodeWatchFn = (\n pathName: string,\n options: { recursive?: boolean; filter?: (file: string) => boolean },\n callback: (event: string, filename: string) => void\n) => NodeWatchWatcher\nconst nodeWatch = nodeWatchNS.default as unknown as NodeWatchFn // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion\n\nexport type WatchEvent = (filename: string, event: string) => void\n\nexport function watchFilesNodeWatch(\n config: FinalConfig,\n onEvent: WatchEvent\n): Promise<NodeWatchWatcher> {\n return timeProfileAsync('start watching', async () => {\n if (config.watch.watchFilesBase === '') {\n out('No config.watch.watchFilesBase provided, defaulting to \\'.\\'')\n config.watch.watchFilesBase = '.'\n }\n\n // watch globs are relative to watchFilesBase, but node-watch's filter is given\n // paths including the base, so bring the globs up to the same base\n const watchGlobs = addBasePath(config.watch.watchFilesBase, config.watch.watchFiles)\n const watchIgnoreGlobs = addBasePath(config.watch.watchFilesBase, config.watch.watchFilesIgnore)\n\n // identify a file we should be watching and responding to\n const watchFilter = (file: string): boolean =>\n (watchGlobs.length === 0 || minimatch(slash(file), globArgCombine(watchGlobs)))\n && (\n watchIgnoreGlobs.length === 0\n || !minimatch(slash(file), globArgCombine(watchIgnoreGlobs))\n )\n\n const watcher = nodeWatch(\n config.watch.watchFilesBase,\n {\n recursive: true,\n filter: watchFilter\n },\n (event, filename) => {\n filename = slash(filename)\n debug('watch event')\n onEvent(filename, event)\n }\n )\n\n // wait until the watcher is ready\n await new Promise<void>(resolve => {\n watcher.on('ready', resolve)\n })\n\n return watcher\n })\n}\n"]}
|
package/dist/cli/once.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"once.js","sourceRoot":"","sources":["../../src/cli/once.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,sBAAsB,CAAA;AAExC,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC3D,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAGvC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAA;AAClE,OAAO,EAAE,iBA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AS;QAAE,GAAG,CAAC,KAAK,CAAC,UAAU,CAAA,kBAAkB,CAAC,CAAA;IACvD,MAAM,WAAW,GAAG,MAAM,QAAQ,CAC9B,MAAM,EAAE,SAAS,EACjB,SAAS,EACT,WAAW,EACX,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,EACxC,OAAO,EACP;QACI,EAAE,EAAE,QAAQ;QACZ,QAAQ,EAAE,cAAc;KAC3B,CACJ,CAAA;IACD,kFAAkF;IAClF,6EAA6E;IAC7E,MAAM,QAAQ,GAAG,CAAC,WAAW,KAAK,IAAI,CAAC;QACnC,CAAC,CAAC,SAAS,CAAC,eAAe;QAC3B,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,UAAU,CAAA;IAE7D,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,SAAS,CAAA;IAC7C,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAA,KAAK,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,CAAA;IAEpD,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,MAAM,CAAC,yBAAyB,CAAC,CAAA;IAClE,MAAM,cAAc,CAAC,MAAM,CAAC,CAAA;IAE5B,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;AAC1B,CAAC","sourcesContent":["\nimport chalk from '../packages/chalk.js'\n\nimport { packageName, configFileNames } from '../config.js'\nimport { out, log } from '../output.js'\n\nimport type { AllowedArguments, OutFn } from '../types.js'\nimport { setEnv } from './lib/setEnv.js'\nimport { findingTestsMessage } from './lib/findingTestsMessage.js'\nimport { foundTestsMessage } from './lib/foundTestsMessage.js'\n//import { isTest } from './lib/isTest.js'\nimport { exitCodes } from './lib/exitCodes.js'\nimport { envFlag } from '../envFlag.js'\nimport { alwaysCacheBust } from './lib/alwaysCacheBust.js'\nimport { Concurrency } from './lib/runTests.js'\n\n\nexport async function once(): Promise<void> {\n const startTime = new Date().getTime()\n\n const { parseCommandLineArguments } = await import('./lib/parseCommandLineArguments.js')\n const allowedClArguments: AllowedArguments = {\n config: {\n flag: 'c',\n hasValue: true\n },\n 'test-files': {\n flag: 't',\n hasValue: true\n },\n filter: {\n flag: 'f',\n hasValue: true\n },\n 'filter-it': {\n flag: 'i',\n hasValue: true\n },\n 'filter-describe': {\n flag: 'd',\n hasValue: true\n },\n 'fail-fast': {\n flag: 'x',\n hasValue: false\n },\n 'agent': {\n hasValue: false\n }\n }\n const clArguments = parseCommandLineArguments(allowedClArguments)\n //debug('clArguments', clArguments)\n\n // agent mode owns stdout: the usual per-test output is routed into a sink, leaving the\n // failures and the summary. Announced before the config loads, as in watch mode.\n const agentMode = clArguments.agent === true\n const {\n agentInit, agentFound, agentRunStart, agentDone, agentSetRunReason, agentSilentOut\n } = await import('./lib/agentReport.js')\n agentInit(agentMode)\n agentSetRunReason('once')\n const agentOut: OutFn = (agentMode) ? agentSilentOut : out\n const runsOut = (agentMode) ? agentSilentOut : undefined\n\n agentOut(chalk.brightblue`[${packageName}]...`)\n\n setEnv()\n\n const { loadConfig } = await import('./lib/loadConfig.js')\n const userConfig = (typeof clArguments.config === 'string')\n ? await loadConfig(clArguments.config)\n : await loadConfig()\n\n if ('test-files' in clArguments) {\n const testFilesPattern = clArguments['test-files']\n if (typeof testFilesPattern !== 'string' || testFilesPattern === '') {\n throw new Error('No pattern specified for --test-files or -t argument')\n }\n //console.log('Looking for tests using pattern: ' + testFilesPattern) // eslint-disable-line no-console\n userConfig.tests = testFilesPattern\n }\n\n if ('filter' in clArguments) {\n const filter = clArguments.filter\n if (typeof filter !== 'string' || filter === '') {\n throw new Error('No pattern specified for --filter or -f argument')\n }\n //console.log('Filtering tests using pattern: ' + filter) // eslint-disable-line no-console\n userConfig.testsFilter = filter\n }\n\n const filterIt = clArguments['filter-it']\n const filterDescribe = clArguments['filter-describe']\n if (filterIt === true || filterIt === '') throw new Error('No substring specified for --filter-it')\n if (filterDescribe === true || filterDescribe === '') {\n throw new Error('No substring specified for --filter-describe')\n }\n\n const { applyConfigDefaults } = await import('./lib/applyConfigDefaults.js')\n const config = applyConfigDefaults(userConfig)\n // both flags are the only source: assigned rather than or'd, so a config file cannot\n // silently truncate every run, or swap the output format out from under a caller\n config.failFast = clArguments['fail-fast'] === true\n config.watch.agent = agentMode\n\n const { validateConfig } = await import('./lib/validateConfig.js')\n validateConfig(config)\n\n //console.log('run setup')\n //console.log(util.inspect(config))\n const { doUserSetup } = await import('./lib/doUserSetup.js')\n await doUserSetup(config, agentOut)\n //console.log('ran setup')\n \n agentOut(chalk.brightblue(findingTestsMessage(config)))\n const { findTestFiles } = await import('./lib/findTestFiles.js')\n const testFiles = await findTestFiles(config)\n agentFound(config, testFiles.size)\n\n if (testFiles.size === 0) {\n agentOut(chalk.mediumred(`[${packageName}] Found no tests.`\n + '\\nCreate tests matching the patterns, '\n + `\\nor set new patterns in ${configFileNames.map(x => `${x}.js/cjs/mjs`).join(' or ')}`))\n\n const endTime = new Date().getTime()\n const time = endTime - startTime\n agentOut(chalk.brightblue(`[${packageName}] time: ${time.toLocaleString()}ms`))\n\n // reported as a run, so a reader waiting on a done line always gets one\n const { statusCodes } = await import('./lib/statusFile.js')\n const run = agentRunStart(config, 0)\n agentDone(config, run, statusCodes.couldNotRun, 'no test files found', null, time, 0)\n\n // setup has already run by this point, so teardown must run too, or its side\n // effects are left behind\n const { doUserTeardown } = await import('./lib/doUserTeardown.js')\n await doUserTeardown(config)\n\n process.exit(exitCodes.noTestFiles)\n }\n\n agentOut(chalk.brightblue(foundTestsMessage(testFiles.size)))\n\n const concurrency: Concurrency = { limit: -1 }\n\n process.setSourceMapsEnabled(true) // enable source mapping\n \n // testFiles.size is guaranteed non-zero here - the no-tests case exited above\n const { runTests } = await import('./lib/runTests.js')\n if (!agentMode) log(chalk.brightblue`running tests...`)\n const testsResult = await runTests(\n config, testFiles,\n undefined,\n concurrency,\n (alwaysCacheBust) ? 'refresh' : 'cached',\n runsOut,\n {\n it: filterIt,\n describe: filterDescribe\n }\n )\n // a distinct code from noTestFiles, so callers can tell \"no test file matched the\n // pattern\" from \"the files matched but the filters selected nothing in them\"\n const exitCode = (testsResult === null)\n ? exitCodes.noMatchingTests\n : (testsResult) ? exitCodes.passed : exitCodes.testErrors\n\n const time = new Date().getTime() - startTime\n agentOut(chalk.grey`\\n${time.toLocaleString()}ms\\n`)\n\n const { doUserTeardown } = await import('./lib/doUserTeardown.js')\n await doUserTeardown(config)\n\n process.exit(exitCode)\n}\n"]}
|
|
1
|
+
{"version":3,"file":"once.js","sourceRoot":"","sources":["../../src/cli/once.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,sBAAsB,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC3D,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAA;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,0CAA0C;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAG1D,MAAM,CAAC,KAAK,UAAU,IAAI;IACtB,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAA;IAEtC,MAAM,EAAE,yBAAyB,EAAE,GAAG,MAAM,MAAM,CAAC,oCAAoC,CAAC,CAAA;IACxF,MAAM,kBAAkB,GAAqB;QACzC,MAAM,EAAE;YACJ,IAAI,EAAE,GAAG;YACT,QAAQ,EAAE,IAAI;SACjB;QACD,YAAY,EAAE;YACV,IAAI,EAAE,GAAG;YACT,QAAQ,EAAE,IAA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AC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,UAAU,CAAA;IAE7D,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,SAAS,CAAA;IAC7C,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAA,KAAK,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,CAAA;IAEpD,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,MAAM,CAAC,yBAAyB,CAAC,CAAA;IAClE,MAAM,cAAc,CAAC,MAAM,CAAC,CAAA;IAE5B,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;AAC1B,CAAC","sourcesContent":["\nimport type { OutFn } from '../types.js'\nimport type { AllowedArguments } from './cliTypes.js'\nimport type { Concurrency } from './lib/runTests.js'\nimport chalk from '../packages/chalk.js'\nimport { packageName, configFileNames } from '../config.js'\nimport { out, log } from '../output.js'\nimport { setEnv } from './lib/setEnv.js'\nimport { findingTestsMessage } from './lib/findingTestsMessage.js'\nimport { foundTestsMessage } from './lib/foundTestsMessage.js'\n//import { isTest } from './lib/isTest.js'\nimport { exitCodes } from './lib/exitCodes.js'\nimport { alwaysCacheBust } from './lib/alwaysCacheBust.js'\n\n\nexport async function once(): Promise<void> {\n const startTime = new Date().getTime()\n\n const { parseCommandLineArguments } = await import('./lib/parseCommandLineArguments.js')\n const allowedClArguments: AllowedArguments = {\n config: {\n flag: 'c',\n hasValue: true\n },\n 'test-files': {\n flag: 't',\n hasValue: true\n },\n filter: {\n flag: 'f',\n hasValue: true\n },\n 'filter-it': {\n flag: 'i',\n hasValue: true\n },\n 'filter-describe': {\n flag: 'd',\n hasValue: true\n },\n 'fail-fast': {\n flag: 'x',\n hasValue: false\n },\n 'agent': {\n hasValue: false\n }\n }\n const clArguments = parseCommandLineArguments(allowedClArguments)\n //debug('clArguments', clArguments)\n\n // agent mode owns stdout: the usual per-test output is routed into a sink, leaving the\n // failures and the summary. Announced before the config loads, as in watch mode.\n const agentMode = clArguments.agent === true\n const {\n agentInit, agentFound, agentRunStart, agentDone, agentSetRunReason, agentSilentOut\n } = await import('./lib/agentReport.js')\n agentInit(agentMode)\n agentSetRunReason('once')\n const agentOut: OutFn = (agentMode) ? agentSilentOut : out\n const runsOut = (agentMode) ? agentSilentOut : undefined\n\n agentOut(chalk.brightblue`[${packageName}]...`)\n\n setEnv()\n\n const { loadConfig } = await import('./lib/loadConfig.js')\n const userConfig = (typeof clArguments.config === 'string')\n ? await loadConfig(clArguments.config)\n : await loadConfig()\n\n if ('test-files' in clArguments) {\n const testFilesPattern = clArguments['test-files']\n if (typeof testFilesPattern !== 'string' || testFilesPattern === '') {\n throw new Error('No pattern specified for --test-files or -t argument')\n }\n //console.log('Looking for tests using pattern: ' + testFilesPattern) // eslint-disable-line no-console\n userConfig.tests = testFilesPattern\n }\n\n if ('filter' in clArguments) {\n const filter = clArguments.filter\n if (typeof filter !== 'string' || filter === '') {\n throw new Error('No pattern specified for --filter or -f argument')\n }\n //console.log('Filtering tests using pattern: ' + filter) // eslint-disable-line no-console\n userConfig.testsFilter = filter\n }\n\n const filterIt = clArguments['filter-it']\n const filterDescribe = clArguments['filter-describe']\n if (filterIt === true || filterIt === '') throw new Error('No substring specified for --filter-it')\n if (filterDescribe === true || filterDescribe === '') {\n throw new Error('No substring specified for --filter-describe')\n }\n\n const { applyConfigDefaults } = await import('./lib/applyConfigDefaults.js')\n const config = applyConfigDefaults(userConfig)\n // both flags are the only source: assigned rather than or'd, so a config file cannot\n // silently truncate every run, or swap the output format out from under a caller\n config.failFast = clArguments['fail-fast'] === true\n config.watch.agent = agentMode\n\n const { validateConfig } = await import('./lib/validateConfig.js')\n validateConfig(config)\n\n //console.log('run setup')\n //console.log(util.inspect(config))\n const { doUserSetup } = await import('./lib/doUserSetup.js')\n await doUserSetup(config, agentOut)\n //console.log('ran setup')\n \n agentOut(chalk.brightblue(findingTestsMessage(config)))\n const { findTestFiles } = await import('./lib/findTestFiles.js')\n const testFiles = await findTestFiles(config)\n agentFound(config, testFiles.size)\n\n if (testFiles.size === 0) {\n agentOut(chalk.mediumred(`[${packageName}] Found no tests.`\n + '\\nCreate tests matching the patterns, '\n + `\\nor set new patterns in ${configFileNames.map(x => `${x}.js/cjs/mjs`).join(' or ')}`))\n\n const endTime = new Date().getTime()\n const time = endTime - startTime\n agentOut(chalk.brightblue(`[${packageName}] time: ${time.toLocaleString()}ms`))\n\n // reported as a run, so a reader waiting on a done line always gets one\n const { statusCodes } = await import('./lib/statusFile.js')\n const run = agentRunStart(config, 0)\n agentDone(config, run, statusCodes.couldNotRun, 'no test files found', null, time, 0)\n\n // setup has already run by this point, so teardown must run too, or its side\n // effects are left behind\n const { doUserTeardown } = await import('./lib/doUserTeardown.js')\n await doUserTeardown(config)\n\n process.exit(exitCodes.noTestFiles)\n }\n\n agentOut(chalk.brightblue(foundTestsMessage(testFiles.size)))\n\n const concurrency: Concurrency = { limit: -1 }\n\n process.setSourceMapsEnabled(true) // enable source mapping\n \n // testFiles.size is guaranteed non-zero here - the no-tests case exited above\n const { runTests } = await import('./lib/runTests.js')\n if (!agentMode) log(chalk.brightblue`running tests...`)\n const testsResult = await runTests(\n config, testFiles,\n undefined,\n concurrency,\n (alwaysCacheBust) ? 'refresh' : 'cached',\n runsOut,\n {\n it: filterIt,\n describe: filterDescribe\n }\n )\n // a distinct code from noTestFiles, so callers can tell \"no test file matched the\n // pattern\" from \"the files matched but the filters selected nothing in them\"\n const exitCode = (testsResult === null)\n ? exitCodes.noMatchingTests\n : (testsResult) ? exitCodes.passed : exitCodes.testErrors\n\n const time = new Date().getTime() - startTime\n agentOut(chalk.grey`\\n${time.toLocaleString()}ms\\n`)\n\n const { doUserTeardown } = await import('./lib/doUserTeardown.js')\n await doUserTeardown(config)\n\n process.exit(exitCode)\n}\n"]}
|
package/dist/cli/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/cli/version.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/cli/version.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAGlC,2FAA2F;AAC3F,0FAA0F;AAC1F,gCAAgC;AAChC,MAAM,UAAU,OAAO;IACnB,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;IAE7E,IAAI,aAAa,GAAG,SAAS,CAAA;IAC7B,IAAI,CAAC;QACD,MAAM,GAAG,GAAG,YAAY,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAAA;QACnE,mEAAmE;QACnE,MAAM,WAAW,GAAyB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QACzD,aAAa,GAAG,WAAW,CAAC,OAAO,IAAI,SAAS,CAAA;IACpD,CAAC;IAAC,MAAM,CAAC;QACL,iEAAiE;IACrE,CAAC;IAED,GAAG,CAAC,GAAG,WAAW,IAAI,aAAa,EAAE,CAAC,CAAA;AAC1C,CAAC","sourcesContent":["\nimport { readFileSync } from 'node:fs'\nimport { dirname, join } from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nimport { packageName } from '../config.js'\nimport { out } from '../output.js'\n\n\n// Read at run time rather than baked in at build time, so it cannot drift from the version\n// actually installed. dist/cli/version.js sits two levels under the package root, both in\n// this repo and once published.\nexport function version(): void {\n const packageRoot = join(dirname(fileURLToPath(import.meta.url)), '..', '..')\n\n let versionNumber = 'unknown'\n try {\n const raw = readFileSync(join(packageRoot, 'package.json'), 'utf8')\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const packageJson: { version?: string } = JSON.parse(raw)\n versionNumber = packageJson.version ?? 'unknown'\n } catch {\n // reporting \"unknown\" beats failing to answer `--version` at all\n }\n\n out(`${packageName} ${versionNumber}`)\n}\n"]}
|
package/dist/cli/watch.d.ts
CHANGED
package/dist/cli/watch.js
CHANGED
|
@@ -9,6 +9,10 @@ import { makeRunManagerState } from './lib/makeWatchRunState.js';
|
|
|
9
9
|
import { makeReRunManager } from './lib/reRunManager.js';
|
|
10
10
|
import { alwaysCacheBust } from './lib/alwaysCacheBust.js';
|
|
11
11
|
export async function watch() {
|
|
12
|
+
await doWatch();
|
|
13
|
+
await new Promise(() => { });
|
|
14
|
+
}
|
|
15
|
+
export async function doWatch() {
|
|
12
16
|
const startTime = new Date().getTime();
|
|
13
17
|
const { parseCommandLineArguments } = await import('./lib/parseCommandLineArguments.js');
|
|
14
18
|
const allowedClArguments = {
|
|
@@ -52,6 +56,7 @@ export async function watch() {
|
|
|
52
56
|
const runsOut = (agentMode) ? agentSilentOut : undefined;
|
|
53
57
|
agentOut(chalk.brightblue `[${packageName}]...`);
|
|
54
58
|
setEnv();
|
|
59
|
+
const stopFns = [];
|
|
55
60
|
const { loadConfig } = await import('./lib/loadConfig.js');
|
|
56
61
|
const userConfig = (typeof clArguments.config === 'string')
|
|
57
62
|
? await loadConfig(clArguments.config)
|
|
@@ -105,10 +110,11 @@ export async function watch() {
|
|
|
105
110
|
// out. Registered here so it pairs with the setup above and covers the initial run too.
|
|
106
111
|
const { doUserTeardown } = await import('./lib/doUserTeardown.js');
|
|
107
112
|
const { registerShutdownHandlers } = await import('./lib/shutdown.js');
|
|
108
|
-
registerShutdownHandlers(config, {
|
|
113
|
+
const unregisterShutdownHandlers = registerShutdownHandlers(config, {
|
|
109
114
|
teardown: doUserTeardown,
|
|
110
115
|
exit: code => process.exit(code)
|
|
111
116
|
});
|
|
117
|
+
stopFns.push(unregisterShutdownHandlers);
|
|
112
118
|
agentOut(chalk.brightblue(findingTestsMessage(config)));
|
|
113
119
|
const { findTestFiles } = await import('./lib/findTestFiles.js');
|
|
114
120
|
const testFiles = await findTestFiles(config);
|
|
@@ -124,8 +130,6 @@ export async function watch() {
|
|
|
124
130
|
lastTestFiles: testFiles
|
|
125
131
|
}), runsOut);
|
|
126
132
|
process.setSourceMapsEnabled(true); // enable source mapping
|
|
127
|
-
const { runTests } = await import('./lib/runTests.js');
|
|
128
|
-
let initialTestRun = null;
|
|
129
133
|
if (testFiles.size > 0) {
|
|
130
134
|
agentOut(chalk.brightblue(foundTestsMessage(testFiles.size)));
|
|
131
135
|
// the trees are only consulted to narrow a run, so with evaluation off building them
|
|
@@ -135,17 +139,32 @@ export async function watch() {
|
|
|
135
139
|
agentOut(chalk.brightblue `finding initial dependency trees...`);
|
|
136
140
|
dependencyTrees = await buildDependencyTrees(config, testFiles);
|
|
137
141
|
}
|
|
142
|
+
}
|
|
143
|
+
// live before the first test runs, for two reasons. A change landing during the initial
|
|
144
|
+
// run (a compiler emit, typically) is seen rather than lost. And the watcher starts on a
|
|
145
|
+
// quiet loop: node-watch probes for native recursive support with a 200ms timeout, and a
|
|
146
|
+
// loop busy running tests fails the probe, so it falls back to a sync walk of every
|
|
147
|
+
// directory - which then starved the tests' own timers (a 10ms interval fired once in 45ms)
|
|
148
|
+
const { watchFilesAndRunTests } = await import('./lib/watchFilesAndRunTests.js');
|
|
149
|
+
const stopWatcher = await watchFilesAndRunTests(config,
|
|
150
|
+
//testFiles,
|
|
151
|
+
dependencyTrees, failingTests, // CHECK this should also be in state
|
|
152
|
+
reRunManager,
|
|
153
|
+
//watchRunState,
|
|
154
|
+
runsOut, executionFilters);
|
|
155
|
+
stopFns.push(stopWatcher);
|
|
156
|
+
const { runTests } = await import('./lib/runTests.js');
|
|
157
|
+
let initialTestRun = null;
|
|
158
|
+
if (testFiles.size > 0) {
|
|
138
159
|
if (config.watch.runAllOnStartup) {
|
|
139
160
|
agentOut(chalk.brightblue `running initial tests...`);
|
|
140
|
-
initialTestRun = runTests(config, testFiles, reRunManager, concurrency, (alwaysCacheBust) ? 'refresh' : 'cached', runsOut, executionFilters).then(
|
|
161
|
+
initialTestRun = runTests(config, testFiles, reRunManager, concurrency, (alwaysCacheBust) ? 'refresh' : 'cached', runsOut, executionFilters).then(testsResult => {
|
|
141
162
|
const time = new Date().getTime() - startTime;
|
|
142
163
|
//await new Promise((resolve) => setTimeout(resolve, 100))
|
|
143
164
|
agentOut(chalk.grey `\n${time.toLocaleString()}ms`);
|
|
144
165
|
return testsResult;
|
|
145
166
|
});
|
|
146
167
|
reRunManager.state.currentRun = initialTestRun;
|
|
147
|
-
// do we need to catch errors like this?
|
|
148
|
-
initialTestRun.catch(err => `Error during initial test run: ${err}`);
|
|
149
168
|
}
|
|
150
169
|
}
|
|
151
170
|
else {
|
|
@@ -155,21 +174,27 @@ export async function watch() {
|
|
|
155
174
|
const run = agentRunStart(config, 0);
|
|
156
175
|
agentDone(config, run, statusCodes.couldNotRun, 'no test files found', null, new Date().getTime() - startTime, 0);
|
|
157
176
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
reRunManager,
|
|
163
|
-
//watchRunState,
|
|
164
|
-
runsOut, executionFilters);
|
|
177
|
+
// announced once the initial run is over, so `watching` marks a real milestone: startup is
|
|
178
|
+
// complete and the watcher is live. A failed run is reported by listenToUser below.
|
|
179
|
+
if (initialTestRun !== null)
|
|
180
|
+
await initialTestRun.catch(() => null);
|
|
165
181
|
agentOut(chalk.brightblue `watching...`);
|
|
166
182
|
agentWatching(config, testFiles.size);
|
|
167
183
|
const { listenToUser } = await import('./lib/listenToUser.js');
|
|
168
|
-
listenToUser(reRunManager, files => () => {
|
|
184
|
+
const disposeTty = listenToUser(reRunManager, files => () => {
|
|
169
185
|
return runTests(config, files, reRunManager, concurrency, 'refresh', runsOut, executionFilters);
|
|
170
|
-
}, config.watch.ttyActionsOnKeypress, initialTestRun, process.stdin, runsOut)
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
186
|
+
}, config.watch.ttyActionsOnKeypress, initialTestRun, process.stdin, runsOut);
|
|
187
|
+
stopFns.push(disposeTty);
|
|
188
|
+
const dispose = () => {
|
|
189
|
+
for (const stop of stopFns) {
|
|
190
|
+
stop();
|
|
191
|
+
}
|
|
192
|
+
stopFns.length = 0; // Idempotencize
|
|
193
|
+
};
|
|
194
|
+
return dispose;
|
|
195
|
+
// (async () => {
|
|
196
|
+
// await new Promise<void>(() => {})
|
|
197
|
+
// })()
|
|
198
|
+
//await new Promise<void>(() => {})
|
|
174
199
|
}
|
|
175
200
|
//# sourceMappingURL=watch.js.map
|
package/dist/cli/watch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watch.js","sourceRoot":"","sources":["../../src/cli/watch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,sBAAsB,CAAA;AAExC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AAGzC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAA;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,0CAA0C;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAG1D,MAAM,CAAC,KAAK,UAAU,KAAK;IACvB,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAA;IAEtC,MAAM,EAAE,yBAAyB,EAAE,GAAG,MAAM,MAAM,CAAC,oCA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B,EAC3D,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,SAAS,EAAE,CAAC,CAC5C,CAAA;IACL,CAAC;IAED,MAAM,EAAE,qBAAqB,EAAE,GAAG,MAAM,MAAM,CAAC,gCAAgC,CAAC,CAAA;IAChF,MAAM,qBAAqB,CACvB,MAAM;IACN,YAAY;IACZ,eAAe,EACf,YAAY,EAAE,qCAAqC;IACnD,YAAY;IACZ,gBAAgB;IAChB,OAAO,EACP,gBAAgB,CACnB,CAAA;IAGD,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAA,aAAa,CAAC,CAAA;IACvC,aAAa,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,CAAA;IAErC,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,MAAM,CAAC,uBAAuB,CAAC,CAAA;IAC9D,YAAY,CACR,YAAY,EACZ,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE;QACV,OAAO,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAA;IACnG,CAAC,EACD,MAAM,CAAC,KAAK,CAAC,oBAAoB,EACjC,cAAc,EACd,OAAO,CAAC,KAAK,EACb,OAAO,CACV,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,CAAA,CAAC,CAAC,CAAC,CAAA;IAGzB,0FAA0F;IAC1F,+CAA+C;IAC/C,MAAM,IAAI,OAAO,CAAO,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;AACrC,CAAC","sourcesContent":["import chalk from '../packages/chalk.js'\n\nimport { packageName } from '../config.js'\nimport { out, debug } from '../output.js'\n\nimport type { AllowedArguments, DependencyTrees, OutFn } from '../types.js'\nimport { setEnv } from './lib/setEnv.js'\nimport { findingTestsMessage } from './lib/findingTestsMessage.js'\nimport { foundTestsMessage } from './lib/foundTestsMessage.js'\n//import { isTest } from './lib/isTest.js'\nimport { makeRunManagerState } from './lib/makeWatchRunState.js'\nimport { makeReRunManager } from './lib/reRunManager.js'\nimport { alwaysCacheBust } from './lib/alwaysCacheBust.js'\nimport { Concurrency } from './lib/runTests.js'\n\nexport async function watch(): Promise<void> {\n const startTime = new Date().getTime()\n\n const { parseCommandLineArguments } = await import('./lib/parseCommandLineArguments.js')\n const allowedClArguments: AllowedArguments = {\n 'config': {\n flag: 'c',\n hasValue: true\n },\n 'test-files': {\n flag: 't',\n hasValue: true\n },\n 'filter': {\n flag: 'f',\n hasValue: true\n },\n 'filter-it': {\n flag: 'i',\n hasValue: true\n },\n 'filter-describe': {\n flag: 'd',\n hasValue: true\n },\n 'status-file': {\n flag: 's',\n hasValue: true\n },\n 'agent': {\n hasValue: false\n }\n }\n const clArguments = parseCommandLineArguments(allowedClArguments)\n //debug('clArguments', clArguments)\n\n // agent mode owns stdout, so the banner and every later message below is routed through\n // agentOut - a sink when the flag is on. Announced before the config loads, so a reader\n // sees the process is alive even if startup is slow.\n const agentMode = clArguments.agent === true\n const {\n agentInit, agentFound, agentRunStart, agentDone, agentWatching, agentSilentOut\n } = await import('./lib/agentReport.js')\n agentInit(agentMode)\n const agentOut: OutFn = (agentMode) ? agentSilentOut : out\n const runsOut = (agentMode) ? agentSilentOut : undefined\n\n agentOut(chalk.brightblue`[${packageName}]...`)\n\n setEnv()\n\n const { loadConfig } = await import('./lib/loadConfig.js')\n const userConfig = (typeof clArguments.config === 'string')\n ? await loadConfig(clArguments.config)\n : await loadConfig()\n\n if ('test-files' in clArguments) {\n const testFilesPattern = clArguments['test-files']\n if (typeof testFilesPattern !== 'string' || testFilesPattern === '') {\n throw new Error('No pattern specified for --test-files or -t argument')\n }\n userConfig.tests = testFilesPattern\n }\n\n if ('filter' in clArguments) {\n const filter = clArguments.filter\n if (typeof filter !== 'string' || filter === '') {\n throw new Error('No pattern specified for --filter or -f argument')\n }\n userConfig.testsFilter = filter\n }\n\n if ('status-file' in clArguments) {\n const statusFile = clArguments['status-file']\n if (typeof statusFile !== 'string' || statusFile === '') {\n throw new Error('No file path specified for --status-file or -s argument')\n }\n userConfig.watch = { ...userConfig.watch, statusFile }\n }\n\n const filterIt = clArguments['filter-it']\n const filterDescribe = clArguments['filter-describe']\n if (filterIt === true || filterIt === '') throw new Error('No substring specified for --filter-it')\n if (filterDescribe === true || filterDescribe === '') {\n throw new Error('No substring specified for --filter-describe')\n }\n const executionFilters = { it: filterIt, describe: filterDescribe }\n\n const { applyConfigDefaults } = await import('./lib/applyConfigDefaults.js')\n const config = applyConfigDefaults(userConfig)\n if (agentMode) config.watch.agent = true\n // there is no watch flag for it, and a config file must not enable it here: a truncated\n // run would still report covers=all, and failing files would drop out of `failing`\n config.failFast = false\n\n // not silenced in agent mode - a config error is fatal, so losing the message is worse\n // than breaking the one-line-per-event contract\n const { validateConfig } = await import('./lib/validateConfig.js')\n validateConfig(config)\n\n // no run has finished yet, so the status file starts at -1 rather than stale\n const { resetStatusFile, statusCodes, writeStatusFile } = await import('./lib/statusFile.js')\n resetStatusFile(config)\n\n const { doUserSetup } = await import('./lib/doUserSetup.js')\n await doUserSetup(config, agentOut)\n\n // watch mode never reaches an end of its own, so teardown only gets a chance on the way\n // out. Registered here so it pairs with the setup above and covers the initial run too.\n const { doUserTeardown } = await import('./lib/doUserTeardown.js')\n const { registerShutdownHandlers } = await import('./lib/shutdown.js')\n registerShutdownHandlers(config, {\n teardown: doUserTeardown,\n exit: code => process.exit(code)\n })\n\n agentOut(chalk.brightblue(findingTestsMessage(config)))\n const { findTestFiles } = await import('./lib/findTestFiles.js')\n const testFiles = await findTestFiles(config)\n debug(testFiles)\n agentFound(config, testFiles.size)\n\n // global store of the dependencies of tests\n let dependencyTrees: DependencyTrees = {}\n // store failing tests so we can re-run them.\n const failingTests: string[] = []\n \n const concurrency: Concurrency = { limit: -1 }\n\n const reRunManager = makeReRunManager(\n null,\n makeRunManagerState({\n allTestFiles: testFiles,\n lastTestFiles: testFiles\n }),\n runsOut\n )\n\n process.setSourceMapsEnabled(true) // enable source mapping\n\n const { runTests } = await import('./lib/runTests.js')\n let initialTestRun: Promise<boolean | null> | null = null\n if (testFiles.size > 0) {\n agentOut(chalk.brightblue(foundTestsMessage(testFiles.size)))\n\n // the trees are only consulted to narrow a run, so with evaluation off building them\n // is pure cost - and it is the slowest part of startup on a large suite\n if (config.watch.dependencyEvaluation) {\n const { buildDependencyTrees } = await import('./lib/buildDependencyTrees.js')\n agentOut(chalk.brightblue`finding initial dependency trees...`)\n dependencyTrees = await buildDependencyTrees(config, testFiles)\n }\n\n if (config.watch.runAllOnStartup) {\n agentOut(chalk.brightblue`running initial tests...`)\n initialTestRun = runTests(\n config, testFiles,\n reRunManager,\n concurrency,\n (alwaysCacheBust) ? 'refresh' : 'cached',\n runsOut, executionFilters\n ).then(async testsResult => {\n const time = new Date().getTime() - startTime\n //await new Promise((resolve) => setTimeout(resolve, 100))\n agentOut(chalk.grey`\\n${time.toLocaleString()}ms`)\n return testsResult\n })\n reRunManager.state.currentRun = initialTestRun\n // do we need to catch errors like this?\n initialTestRun.catch(err => `Error during initial test run: ${err}`)\n }\n } else {\n agentOut(chalk.orange`no test files found`)\n writeStatusFile(config, statusCodes.couldNotRun, 'no test files found')\n // still reported as a run, so a reader waiting on a done line always gets one\n const run = agentRunStart(config, 0)\n agentDone(\n config, run, statusCodes.couldNotRun, 'no test files found',\n null, new Date().getTime() - startTime, 0\n )\n }\n\n const { watchFilesAndRunTests } = await import('./lib/watchFilesAndRunTests.js')\n await watchFilesAndRunTests(\n config,\n //testFiles,\n dependencyTrees,\n failingTests, // CHECK this should also be in state\n reRunManager,\n //watchRunState,\n runsOut,\n executionFilters\n )\n\n\n agentOut(chalk.brightblue`watching...`)\n agentWatching(config, testFiles.size)\n\n const { listenToUser } = await import('./lib/listenToUser.js')\n listenToUser(\n reRunManager,\n files => () => {\n return runTests(config, files, reRunManager, concurrency, 'refresh', runsOut, executionFilters)\n },\n config.watch.ttyActionsOnKeypress,\n initialTestRun,\n process.stdin,\n runsOut\n ).catch(e => { throw e })\n\n\n // park forever - watch mode ends by being signalled, and the shutdown handlers registered\n // above run the user's teardown on the way out\n await new Promise<void>(() => {})\n}\n"]}
|
|
1
|
+
{"version":3,"file":"watch.js","sourceRoot":"","sources":["../../src/cli/watch.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,sBAAsB,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAA;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,0CAA0C;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAK1D,MAAM,CAAC,KAAK,UAAU,KAAK;IACvB,MAAM,OAAO,EAAE,CAAA;IACf,MAAM,IAAI,OAAO,CAAO,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;AACrC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,OAAO;IACzB,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAA;IAEtC,MAAM,EAAE,yBAAyB,EAAE,GAAG,MAAM,MAAM,CAAC,oCAAoC,CAAC,CAAA;IACxF,MAAM,kBAAkB,GAAqB;QACzC,QAAQ,EAAE;YACN,IAAI,EAAE,GAAG;YACT,QAAQ,EAAE,IAAI;SACjB;QACD,YAAY,EAAE;YACV,IAAI,EAAE,GAAG;YACT,QAAQ,EAAE,IAAI;SACjB;QACD,QAAQ,EAAE;YACN,IAAI,EAAE,GAAG;YACT,QAAQ,EAAE,IAA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ACvC,CAAC","sourcesContent":["\nimport type { DependencyTrees, OutFn } from '../types.js'\nimport type { AllowedArguments } from './cliTypes.js'\nimport type { Concurrency } from './lib/runTests.js'\nimport chalk from '../packages/chalk.js'\nimport { packageName } from '../config.js'\nimport { out, debug } from '../output.js'\nimport { setEnv } from './lib/setEnv.js'\nimport { findingTestsMessage } from './lib/findingTestsMessage.js'\nimport { foundTestsMessage } from './lib/foundTestsMessage.js'\n//import { isTest } from './lib/isTest.js'\nimport { makeRunManagerState } from './lib/makeWatchRunState.js'\nimport { makeReRunManager } from './lib/reRunManager.js'\nimport { alwaysCacheBust } from './lib/alwaysCacheBust.js'\n\n\nexport type StopFn = () => void\n\nexport async function watch(): Promise<void> {\n await doWatch()\n await new Promise<void>(() => {})\n}\n\nexport async function doWatch(): Promise<StopFn> {\n const startTime = new Date().getTime()\n\n const { parseCommandLineArguments } = await import('./lib/parseCommandLineArguments.js')\n const allowedClArguments: AllowedArguments = {\n 'config': {\n flag: 'c',\n hasValue: true\n },\n 'test-files': {\n flag: 't',\n hasValue: true\n },\n 'filter': {\n flag: 'f',\n hasValue: true\n },\n 'filter-it': {\n flag: 'i',\n hasValue: true\n },\n 'filter-describe': {\n flag: 'd',\n hasValue: true\n },\n 'status-file': {\n flag: 's',\n hasValue: true\n },\n 'agent': {\n hasValue: false\n }\n }\n const clArguments = parseCommandLineArguments(allowedClArguments)\n //debug('clArguments', clArguments)\n\n // agent mode owns stdout, so the banner and every later message below is routed through\n // agentOut - a sink when the flag is on. Announced before the config loads, so a reader\n // sees the process is alive even if startup is slow.\n const agentMode = clArguments.agent === true\n const {\n agentInit, agentFound, agentRunStart, agentDone, agentWatching, agentSilentOut\n } = await import('./lib/agentReport.js')\n agentInit(agentMode)\n const agentOut: OutFn = (agentMode) ? agentSilentOut : out\n const runsOut = (agentMode) ? agentSilentOut : undefined\n\n agentOut(chalk.brightblue`[${packageName}]...`)\n\n setEnv()\n\n const stopFns: StopFn[] = []\n\n const { loadConfig } = await import('./lib/loadConfig.js')\n const userConfig = (typeof clArguments.config === 'string')\n ? await loadConfig(clArguments.config)\n : await loadConfig()\n\n if ('test-files' in clArguments) {\n const testFilesPattern = clArguments['test-files']\n if (typeof testFilesPattern !== 'string' || testFilesPattern === '') {\n throw new Error('No pattern specified for --test-files or -t argument')\n }\n userConfig.tests = testFilesPattern\n }\n\n if ('filter' in clArguments) {\n const filter = clArguments.filter\n if (typeof filter !== 'string' || filter === '') {\n throw new Error('No pattern specified for --filter or -f argument')\n }\n userConfig.testsFilter = filter\n }\n\n if ('status-file' in clArguments) {\n const statusFile = clArguments['status-file']\n if (typeof statusFile !== 'string' || statusFile === '') {\n throw new Error('No file path specified for --status-file or -s argument')\n }\n userConfig.watch = { ...userConfig.watch, statusFile }\n }\n\n const filterIt = clArguments['filter-it']\n const filterDescribe = clArguments['filter-describe']\n if (filterIt === true || filterIt === '') throw new Error('No substring specified for --filter-it')\n if (filterDescribe === true || filterDescribe === '') {\n throw new Error('No substring specified for --filter-describe')\n }\n const executionFilters = { it: filterIt, describe: filterDescribe }\n\n const { applyConfigDefaults } = await import('./lib/applyConfigDefaults.js')\n const config = applyConfigDefaults(userConfig)\n if (agentMode) config.watch.agent = true\n // there is no watch flag for it, and a config file must not enable it here: a truncated\n // run would still report covers=all, and failing files would drop out of `failing`\n config.failFast = false\n\n // not silenced in agent mode - a config error is fatal, so losing the message is worse\n // than breaking the one-line-per-event contract\n const { validateConfig } = await import('./lib/validateConfig.js')\n validateConfig(config)\n\n // no run has finished yet, so the status file starts at -1 rather than stale\n const { resetStatusFile, statusCodes, writeStatusFile } = await import('./lib/statusFile.js')\n resetStatusFile(config)\n\n const { doUserSetup } = await import('./lib/doUserSetup.js')\n await doUserSetup(config, agentOut)\n\n // watch mode never reaches an end of its own, so teardown only gets a chance on the way\n // out. Registered here so it pairs with the setup above and covers the initial run too.\n const { doUserTeardown } = await import('./lib/doUserTeardown.js')\n const { registerShutdownHandlers } = await import('./lib/shutdown.js')\n \n const unregisterShutdownHandlers = registerShutdownHandlers(config, {\n teardown: doUserTeardown,\n exit: code => process.exit(code)\n })\n stopFns.push(unregisterShutdownHandlers)\n\n agentOut(chalk.brightblue(findingTestsMessage(config)))\n const { findTestFiles } = await import('./lib/findTestFiles.js')\n const testFiles = await findTestFiles(config)\n debug(testFiles)\n agentFound(config, testFiles.size)\n\n // global store of the dependencies of tests\n let dependencyTrees: DependencyTrees = {}\n // store failing tests so we can re-run them.\n const failingTests: string[] = []\n \n const concurrency: Concurrency = { limit: -1 }\n\n const reRunManager = makeReRunManager(\n null,\n makeRunManagerState({\n allTestFiles: testFiles,\n lastTestFiles: testFiles\n }),\n runsOut\n )\n\n process.setSourceMapsEnabled(true) // enable source mapping\n\n if (testFiles.size > 0) {\n agentOut(chalk.brightblue(foundTestsMessage(testFiles.size)))\n\n // the trees are only consulted to narrow a run, so with evaluation off building them\n // is pure cost - and it is the slowest part of startup on a large suite\n if (config.watch.dependencyEvaluation) {\n const { buildDependencyTrees } = await import('./lib/buildDependencyTrees.js')\n agentOut(chalk.brightblue`finding initial dependency trees...`)\n dependencyTrees = await buildDependencyTrees(config, testFiles)\n }\n }\n\n // live before the first test runs, for two reasons. A change landing during the initial\n // run (a compiler emit, typically) is seen rather than lost. And the watcher starts on a\n // quiet loop: node-watch probes for native recursive support with a 200ms timeout, and a\n // loop busy running tests fails the probe, so it falls back to a sync walk of every\n // directory - which then starved the tests' own timers (a 10ms interval fired once in 45ms)\n const { watchFilesAndRunTests } = await import('./lib/watchFilesAndRunTests.js')\n const stopWatcher = await watchFilesAndRunTests(\n config,\n //testFiles,\n dependencyTrees,\n failingTests, // CHECK this should also be in state\n reRunManager,\n //watchRunState,\n runsOut,\n executionFilters\n )\n stopFns.push(stopWatcher)\n\n const { runTests } = await import('./lib/runTests.js')\n let initialTestRun: Promise<boolean | null> | null = null\n if (testFiles.size > 0) {\n if (config.watch.runAllOnStartup) {\n agentOut(chalk.brightblue`running initial tests...`)\n initialTestRun = runTests(\n config, testFiles,\n reRunManager,\n concurrency,\n (alwaysCacheBust) ? 'refresh' : 'cached',\n runsOut, executionFilters\n ).then(testsResult => {\n const time = new Date().getTime() - startTime\n //await new Promise((resolve) => setTimeout(resolve, 100))\n agentOut(chalk.grey`\\n${time.toLocaleString()}ms`)\n return testsResult\n })\n reRunManager.state.currentRun = initialTestRun\n }\n } else {\n agentOut(chalk.orange`no test files found`)\n writeStatusFile(config, statusCodes.couldNotRun, 'no test files found')\n // still reported as a run, so a reader waiting on a done line always gets one\n const run = agentRunStart(config, 0)\n agentDone(\n config, run, statusCodes.couldNotRun, 'no test files found',\n null, new Date().getTime() - startTime, 0\n )\n }\n\n // announced once the initial run is over, so `watching` marks a real milestone: startup is\n // complete and the watcher is live. A failed run is reported by listenToUser below.\n if (initialTestRun !== null) await initialTestRun.catch(() => null)\n\n agentOut(chalk.brightblue`watching...`)\n agentWatching(config, testFiles.size)\n\n const { listenToUser } = await import('./lib/listenToUser.js')\n const disposeTty = listenToUser(\n reRunManager,\n files => () => {\n return runTests(config, files, reRunManager, concurrency, 'refresh', runsOut, executionFilters)\n },\n config.watch.ttyActionsOnKeypress,\n initialTestRun,\n process.stdin,\n runsOut\n )\n stopFns.push(disposeTty)\n\n const dispose = () => {\n for (const stop of stopFns) {\n stop()\n }\n stopFns.length = 0 // Idempotencize\n }\n return dispose\n\n\n // (async () => {\n // await new Promise<void>(() => {})\n // })()\n //await new Promise<void>(() => {})\n}\n"]}
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAGtC,MAAM,CAAC,MAAM,WAAW,GAAG,iBAAiB,CAAA;AAE5C,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAA;AAE7B,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,aAAa,EAAE,wBAAwB,CAAC,CAAA;AACxE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAA,CAAC,2DAA2D;AAEzG,oBAAoB;AACpB,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,CAAA;AAE9B,sEAAsE;AACtE,6EAA6E;AAC7E,MAAM,CAAC,MAAM,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAA","sourcesContent":["\nimport { envFlag } from './envFlag.js'\n\n\nexport const packageName = 'sxy-test-runner'\n\nexport const cliName = 'sxyt'\n\nexport const configFileNames = ['sxyt.config', 'sxy-test-runner.config']\nexport const configLocations = ['', 'config'] // locations where the configs may be placed in proj folder\n\n// used in output.ts\nexport const debugging = false\n\n// Toggle per-phase timing output with the SXYT_TIME_PROFILING env var\n// (SXYT_TIME_PROFILING=true | 1). Defaults to off so normal runs stay clean.\nexport const showTimeProfiling = envFlag(process.env.SXYT_TIME_PROFILING)\n"]}
|
package/dist/describe.js
CHANGED
|
@@ -18,7 +18,7 @@ export function describe(theThing, testsOrMeta, possiblyTests) {
|
|
|
18
18
|
else {
|
|
19
19
|
checkMeta(`describe('${theThing}')`, testsOrMeta, ['parallelTests', 'sequentialTests']);
|
|
20
20
|
meta = testsOrMeta;
|
|
21
|
-
tests = possiblyTests; // eslint-disable-line
|
|
21
|
+
tests = possiblyTests; // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion
|
|
22
22
|
}
|
|
23
23
|
global.__sxy_test_runner__.describes.push({
|
|
24
24
|
counter: thisDescribeCounter,
|
package/dist/describe.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"describe.js","sourceRoot":"","sources":["../src/describe.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"describe.js","sourceRoot":"","sources":["../src/describe.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,qBAAqB,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAOnC,MAAM,UAAU,QAAQ,CACpB,QAAgB,EAAE,WAA4C,EAAE,aAAgC;IAEhG,IAAI,CAAC,MAAM,CAAC,mBAAmB,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CACX,oFAAoF;cAClF,0DAA0D;cAC1D,+CAA+C,CACpD,CAAA;QACD,gFAAgF;IACpF,CAAC;IAED,MAAM,mBAAmB,GAAG,MAAM,CAAC,mBAAmB,CAAC,eAAe,CAAA;IACtE,MAAM,CAAC,mBAAmB,CAAC,eAAe,EAAE,CAAA;IAE5C,IAAI,IAAI,GAAG,SAAS,CAAA;IACpB,IAAI,KAAK,CAAA;IACT,IAAI,OAAO,WAAW,KAAK,UAAU,EAAE,CAAC;QACpC,KAAK,GAAG,WAAW,CAAA;IACvB,CAAC;SAAM,CAAC;QACJ,SAAS,CAAC,aAAa,QAAQ,IAAI,EAAE,WAAW,EAAE,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAAC,CAAA;QACvF,IAAI,GAAG,WAAW,CAAA;QAClB,KAAK,GAAG,aAAiC,CAAA,CAAC,kEAAkE;IAChH,CAAC;IACD,MAAM,CAAC,mBAAmB,CAAC,SAAS,CAAC,IAAI,CAAC;QACtC,OAAO,EAAE,mBAAmB;QAC5B,KAAK,EAAE,QAAQ;QACf,IAAI;QACJ,KAAK;KACR,CAAC,CAAA;IAEF,KAAK,CACD,KAAK,CAAC,SAAS,CAAA,GAAG,mBAAmB,GAAG;UAClC,KAAK,CAAC,SAAS,CAAA,aAAa,GAAG,KAAK,CAAC,UAAU,CAAA,GAAG,QAAQ,IAAI,CACvE,CAAA;AACL,CAAC","sourcesContent":["\nimport type { DescribeCallback } from './types.js'\nimport chalk from './packages/chalk.js'\nimport { checkMeta } from './checkMeta.js'\nimport { debug } from './output.js'\n\n\nexport type DescribeMeta = { parallelTests: boolean } | { sequentialTests: boolean }\n\nexport function describe(theThing: string, tests: DescribeCallback): void\nexport function describe(theThing: string, meta: DescribeMeta, tests: DescribeCallback): void\nexport function describe(\n theThing: string, testsOrMeta: DescribeCallback | DescribeMeta, possiblyTests?: DescribeCallback\n): void {\n if (!global.__sxy_test_runner__) {\n throw new Error(\n 'sxy-test-runner describe() was called, but the test framework has not initialized.'\n + ' This might be because you have run a test file directly'\n + ', instead of running \\'pnpm sxy-test-runner\\''\n )\n // todo - maybe we can initialise the framework and just run only this test file\n }\n\n const thisDescribeCounter = global.__sxy_test_runner__.describeCounter\n global.__sxy_test_runner__.describeCounter++\n\n let meta = undefined\n let tests\n if (typeof testsOrMeta === 'function') {\n tests = testsOrMeta\n } else {\n checkMeta(`describe('${theThing}')`, testsOrMeta, ['parallelTests', 'sequentialTests'])\n meta = testsOrMeta\n tests = possiblyTests as DescribeCallback // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion\n }\n global.__sxy_test_runner__.describes.push({\n counter: thisDescribeCounter,\n thing: theThing,\n meta,\n tests\n })\n\n debug(\n chalk.lightgrey`${thisDescribeCounter})`\n + chalk.lightgrey` Done with ` + chalk.brightblue`${theThing}\\n`\n )\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexNumberToLetters.js","sourceRoot":"","sources":["../src/indexNumberToLetters.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"indexNumberToLetters.js","sourceRoot":"","sources":["../src/indexNumberToLetters.ts"],"names":[],"mappings":"AACA,MAAM,UAAU,oBAAoB,CAAC,MAAc,EAAE,SAAS,GAAG,KAAK;IAClE,MAAM,aAAa,GAAG,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;IACzC,IAAI,IAAI,GAAG,EAAE,CAAA;IACb,IAAI,WAAmB,CAAA;IAEvB,OAAO,MAAM,GAAG,CAAC,EAAE,CAAC;QAChB,WAAW,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,CAAA;QAC/B,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC,aAAa,GAAG,WAAW,CAAC,GAAG,IAAI,CAAA;QAC9D,MAAM,GAAG,CAAC,CAAC,MAAM,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;IAC9C,CAAC;IACD,OAAO,IAAI,IAAI,SAAS,CAAA;AAC5B,CAAC","sourcesContent":["\nexport function indexNumberToLetters(number: number, uppercase = false): string | undefined {\n const charCodeStart = uppercase ? 65 : 97\n let text = ''\n let letterIndex: number\n\n while (number > 0) {\n letterIndex = (number - 1) % 26\n text = String.fromCharCode(charCodeStart + letterIndex) + text\n number = ((number - letterIndex) / 26) | 0\n }\n return text || undefined\n}\n"]}
|
package/dist/meta.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.js","sourceRoot":"","sources":["../src/meta.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"meta.js","sourceRoot":"","sources":["../src/meta.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAO1C,MAAM,UAAU,IAAI,CAAC,OAAiB;IAClC,IAAI,CAAC,MAAM,CAAC,mBAAmB,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CACX,gFAAgF;cAC9E,0DAA0D;cAC1D,+CAA+C,CACpD,CAAA;IACL,CAAC;IAED,SAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAC,mBAAmB,EAAE,qBAAqB,CAAC,CAAC,CAAA;IAE1E,MAAM,CAAC,mBAAmB,CAAC,QAAQ,GAAG,OAAO,CAAA;AACjD,CAAC","sourcesContent":["\nimport { checkMeta } from './checkMeta.js'\n\n\nexport type FileMeta\n = { parallelDescribes: boolean }\n | { sequentialDescribes: boolean }\n\nexport function meta(theMeta: FileMeta): void {\n if (!global.__sxy_test_runner__) {\n throw new Error(\n 'sxy-test-runner meta() was called, but the test framework has not initialized.'\n + ' This might be because you have run a test file directly'\n + ', instead of running \\'pnpm sxy-test-runner\\''\n )\n }\n\n checkMeta('meta()', theMeta, ['parallelDescribes', 'sequentialDescribes'])\n\n global.__sxy_test_runner__.fileMeta = theMeta\n}\n"]}
|
package/dist/output.js
CHANGED
|
@@ -5,9 +5,11 @@ export function out(...texts) {
|
|
|
5
5
|
}
|
|
6
6
|
export function warn(...texts) {
|
|
7
7
|
console.log(...texts);
|
|
8
|
+
//console.error(...texts)
|
|
8
9
|
}
|
|
9
10
|
export function error(...texts) {
|
|
10
11
|
console.log(...texts);
|
|
12
|
+
//console.error(...texts)
|
|
11
13
|
}
|
|
12
14
|
export function log(...texts) {
|
|
13
15
|
console.log(...texts);
|
package/dist/output.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.js","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AACA,+BAA+B;AAE/B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAGvC,MAAM,UAAU,GAAG,CAAC,GAAG,KAAgB;IACnC,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAA;AACzB,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,GAAG,KAAgB;IACpC,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAA;IACrB,yBAAyB;AAC7B,CAAC;AAED,MAAM,UAAU,KAAK,CAAC,GAAG,KAAgB;IACrC,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAA;IACrB,yBAAyB;AAC7B,CAAC;AAED,MAAM,UAAU,GAAG,CAAC,GAAG,KAAgB;IACnC,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAA;AACzB,CAAC;AAED,MAAM,CAAC,MAAM,KAAK,GAAkC,CAAC,SAAS,CAAC;IAC3D,CAAC,CAAC,SAAS,KAAK,CAAC,GAAG,KAAgB;QAChC,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAA;IACzB,CAAC;IACD,CAAC,CAAC,SAAS,KAAK;QACZ,mCAAmC;IACvC,CAAC,CAAA","sourcesContent":["\n/* eslint-disable no-console */\n\nimport { debugging } from './config.js'\n\n\nexport function out(...texts: unknown[]): void {\n console.log(...texts)\n}\n\nexport function warn(...texts: unknown[]): void {\n console.log(...texts)\n //console.error(...texts)\n}\n\nexport function error(...texts: unknown[]): void {\n console.log(...texts)\n //console.error(...texts)\n}\n\nexport function log(...texts: unknown[]): void {\n console.log(...texts)\n}\n\nexport const debug: (...texts: unknown[]) => void = (debugging)\n ? function debug(...texts: unknown[]) {\n console.log(...texts)\n }\n : function debug() {\n // no-op when debugging is disabled\n }\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chalk.js","sourceRoot":"","sources":["../../src/packages/chalk.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chalk.js","sourceRoot":"","sources":["../../src/packages/chalk.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,gFAAgF;AAChF,gFAAgF;AAChF,iFAAiF;AACjF,iFAAiF;AACjF,mCAAmC;AACnC,EAAE;AACF,+EAA+E;AAC/E,gFAAgF;AAChF,6DAA6D;AAC7D,eAAe;IACX,GAAG,EAAE,KAAK,CAAC,GAAG;IACd,IAAI,EAAE,KAAK,CAAC,IAAI;IAChB,MAAM,EAAE,KAAK,CAAC,MAAM;IACpB,IAAI,EAAE,KAAK,CAAC,IAAI;IAChB,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,EAAO,0CAA0C;IAC7E,UAAU,EAAE,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,EAAG,0CAA0C;IAC7E,SAAS,EAAE,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,EAAI,sCAAsC;IACzE,WAAW,EAAE,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,mCAAmC;IACtE,SAAS,EAAE,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAI,mCAAmC;CACzE,CAAA","sourcesContent":["\nimport chalk from 'chalk'\n\n\n// Local replacement for `chalk-extensions`. That package monkey-patches chalk's\n// shared singleton with dozens of named colours; we only use a handful, so this\n// is a small facade that delegates to chalk and adds just those. Each entry is a\n// chalk instance, so both call form (`chalk.orange(x)`) and tagged-template form\n// (`chalk.mediumgreen\\`…\\``) work.\n//\n// The custom colours reproduce chalk-extensions' exact definitions. It defined\n// several via chalk's CSS-keyword helper; the equivalent hex is inlined here so\n// output is identical without loading chalk's keyword table.\nexport default {\n red: chalk.red,\n grey: chalk.grey,\n yellow: chalk.yellow,\n blue: chalk.blue,\n orange: chalk.hex('#FF8C00'), // chalk-extensions: keyword('darkorange')\n brightblue: chalk.hex('#1E90FF'), // chalk-extensions: keyword('dodgerblue')\n lightgrey: chalk.hex('#C0C0C0'), // chalk-extensions: keyword('silver')\n mediumgreen: chalk.hex('#20d970'), // chalk-extensions: hex('#20d970')\n mediumred: chalk.hex('#e0444c') // chalk-extensions: hex('#e0444c')\n}\n"]}
|