sxy-test-runner 1.4.4 → 2.0.0
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/cli/index.js +24 -22
- package/dist/cli/init.js +41 -91
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/lib/addBasePath.d.ts.map +1 -1
- package/dist/cli/lib/addBasePath.js +12 -14
- package/dist/cli/lib/addBasePath.js.map +1 -1
- package/dist/cli/lib/addBasePath.unitTest.d.ts +2 -0
- package/dist/cli/lib/addBasePath.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/addBasePath.unitTest.js +51 -29
- package/dist/cli/lib/addBasePath.unitTest.js.map +1 -0
- package/dist/cli/lib/addExports.js +13 -11
- package/dist/cli/lib/addExports.unitTest.d.ts +2 -0
- package/dist/cli/lib/addExports.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/addExports.unitTest.js +15 -30
- package/dist/cli/lib/addExports.unitTest.js.map +1 -0
- package/dist/cli/lib/applyConfigDefaults.js +6 -42
- package/dist/cli/lib/applyConfigDefaults.js.map +1 -1
- package/dist/cli/lib/applyConfigDefaults.unitTest.d.ts +2 -0
- package/dist/cli/lib/applyConfigDefaults.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/applyConfigDefaults.unitTest.js +19 -27
- package/dist/cli/lib/applyConfigDefaults.unitTest.js.map +1 -0
- package/dist/cli/lib/buildDependencyTree.js +23 -34
- package/dist/cli/lib/buildDependencyTree.js.map +1 -1
- package/dist/cli/lib/buildDependencyTree.unitTest.d.ts +2 -0
- package/dist/cli/lib/buildDependencyTree.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/buildDependencyTree.unitTest.js +13 -11
- package/dist/cli/lib/buildDependencyTree.unitTest.js.map +1 -0
- package/dist/cli/lib/buildDependencyTrees.js +15 -34
- package/dist/cli/lib/buildDependencyTrees.js.map +1 -1
- package/dist/cli/lib/buildDependencyTrees.unitTest.d.ts +2 -0
- package/dist/cli/lib/buildDependencyTrees.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/buildDependencyTrees.unitTest.js +18 -14
- package/dist/cli/lib/buildDependencyTrees.unitTest.js.map +1 -0
- package/dist/cli/lib/defaultConfig.js +23 -21
- package/dist/cli/lib/defaultConfig.unitTest.d.ts +2 -0
- package/dist/cli/lib/defaultConfig.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/defaultConfig.unitTest.js +7 -0
- package/dist/cli/lib/defaultConfig.unitTest.js.map +1 -0
- package/dist/cli/lib/doUserSetup.d.ts +1 -1
- package/dist/cli/lib/doUserSetup.d.ts.map +1 -1
- package/dist/cli/lib/doUserSetup.js +20 -23
- package/dist/cli/lib/doUserSetup.js.map +1 -1
- package/dist/cli/lib/doUserSetup.unitTest.d.ts +7 -0
- package/dist/cli/lib/doUserSetup.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/doUserSetup.unitTest.js +41 -36
- package/dist/cli/lib/doUserSetup.unitTest.js.map +1 -0
- package/dist/cli/lib/doUserTeardown.d.ts +1 -1
- package/dist/cli/lib/doUserTeardown.d.ts.map +1 -1
- package/dist/cli/lib/doUserTeardown.js +21 -23
- package/dist/cli/lib/doUserTeardown.js.map +1 -1
- package/dist/cli/lib/doUserTeardown.unitTest.d.ts +7 -0
- package/dist/cli/lib/doUserTeardown.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/doUserTeardown.unitTest.js +41 -36
- package/dist/cli/lib/doUserTeardown.unitTest.js.map +1 -0
- package/dist/cli/lib/findTestFiles.d.ts.map +1 -1
- package/dist/cli/lib/findTestFiles.js +16 -24
- package/dist/cli/lib/findTestFiles.js.map +1 -1
- package/dist/cli/lib/findTestFiles.unitTest.d.ts +2 -0
- package/dist/cli/lib/findTestFiles.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/findTestFiles.unitTest.js +19 -19
- package/dist/cli/lib/findTestFiles.unitTest.js.map +1 -0
- package/dist/cli/lib/getAllowedFlags.js +10 -8
- package/dist/cli/lib/getAllowedFlags.unitTest.d.ts +2 -0
- package/dist/cli/lib/getAllowedFlags.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/getAllowedFlags.unitTest.js +22 -21
- package/dist/cli/lib/getAllowedFlags.unitTest.js.map +1 -0
- package/dist/cli/lib/globArgCombine.js +8 -1
- package/dist/cli/lib/globArgCombine.unitTest.d.ts +2 -0
- package/dist/cli/lib/globArgCombine.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/globArgCombine.unitTest.js +19 -18
- package/dist/cli/lib/globArgCombine.unitTest.js.map +1 -0
- package/dist/cli/lib/injectProperties.d.ts.map +1 -1
- package/dist/cli/lib/injectProperties.js +10 -10
- package/dist/cli/lib/injectProperties.js.map +1 -1
- package/dist/cli/lib/injectProperties.unitTest.d.ts +2 -0
- package/dist/cli/lib/injectProperties.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/injectProperties.unitTest.js +19 -81
- package/dist/cli/lib/injectProperties.unitTest.js.map +1 -0
- package/dist/cli/lib/loadConfig.js +14 -18
- package/dist/cli/lib/loadConfig.js.map +1 -1
- package/dist/cli/lib/loadConfig.unitTest.d.ts +2 -0
- package/dist/cli/lib/loadConfig.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/loadConfig.unitTest.js +15 -15
- package/dist/cli/lib/loadConfig.unitTest.js.map +1 -0
- package/dist/cli/lib/loadTestFile.js +48 -78
- package/dist/cli/lib/loadTestFile.js.map +1 -1
- package/dist/cli/lib/loadTestFile.unitTest.d.ts +2 -0
- package/dist/cli/lib/loadTestFile.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/loadTestFile.unitTest.js +12 -49
- package/dist/cli/lib/loadTestFile.unitTest.js.map +1 -0
- package/dist/cli/lib/parseCommandLineArguments.js +48 -42
- package/dist/cli/lib/parseCommandLineArguments.unitTest.d.ts +2 -0
- package/dist/cli/lib/parseCommandLineArguments.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/parseCommandLineArguments.unitTest.js +22 -24
- package/dist/cli/lib/parseCommandLineArguments.unitTest.js.map +1 -0
- package/dist/cli/lib/parseDescribe.d.ts.map +1 -1
- package/dist/cli/lib/parseDescribe.js +67 -81
- package/dist/cli/lib/parseDescribe.js.map +1 -1
- package/dist/cli/lib/parseDescribe.unitTest.d.ts +2 -0
- package/dist/cli/lib/parseDescribe.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/parseDescribe.unitTest.js +20 -18
- package/dist/cli/lib/parseDescribe.unitTest.js.map +1 -0
- package/dist/cli/lib/reservedExportKeys.d.ts +2 -0
- package/dist/cli/lib/reservedExportKeys.d.ts.map +1 -0
- package/dist/cli/lib/reservedExportKeys.js +12 -1
- package/dist/cli/lib/reservedExportKeys.js.map +1 -0
- package/dist/cli/lib/reservedExportKeys.unitTest.d.ts +2 -0
- package/dist/cli/lib/reservedExportKeys.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/reservedExportKeys.unitTest.js +6 -8
- package/dist/cli/lib/reservedExportKeys.unitTest.js.map +1 -0
- package/dist/cli/lib/runDescribe.d.ts.map +1 -1
- package/dist/cli/lib/runDescribe.js +39 -39
- package/dist/cli/lib/runDescribe.js.map +1 -1
- package/dist/cli/lib/runDescribe.unitTest.d.ts +2 -0
- package/dist/cli/lib/runDescribe.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/runDescribe.unitTest.js +22 -402
- package/dist/cli/lib/runDescribe.unitTest.js.map +1 -0
- package/dist/cli/lib/runDescribeRun.js +34 -49
- package/dist/cli/lib/runDescribeRun.js.map +1 -1
- package/dist/cli/lib/runDescribeRun.unitTest.d.ts +2 -0
- package/dist/cli/lib/runDescribeRun.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/runDescribeRun.unitTest.js +44 -410
- package/dist/cli/lib/runDescribeRun.unitTest.js.map +1 -0
- package/dist/cli/lib/runIt.d.ts +1 -1
- package/dist/cli/lib/runIt.d.ts.map +1 -1
- package/dist/cli/lib/runIt.js +59 -69
- package/dist/cli/lib/runIt.js.map +1 -1
- package/dist/cli/lib/runIt.unitTest.d.ts +2 -0
- package/dist/cli/lib/runIt.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/runIt.unitTest.js +73 -410
- package/dist/cli/lib/runIt.unitTest.js.map +1 -0
- package/dist/cli/lib/runTasks.d.ts +1 -1
- package/dist/cli/lib/runTasks.d.ts.map +1 -1
- package/dist/cli/lib/runTasks.js +28 -31
- package/dist/cli/lib/runTasks.js.map +1 -1
- package/dist/cli/lib/runTasks.unitTest.d.ts +5 -0
- package/dist/cli/lib/runTasks.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/runTasks.unitTest.js +35 -31
- package/dist/cli/lib/runTasks.unitTest.js.map +1 -0
- package/dist/cli/lib/runTest.js +54 -66
- package/dist/cli/lib/runTest.js.map +1 -1
- package/dist/cli/lib/runTest.unitTest.d.ts +20 -0
- package/dist/cli/lib/runTest.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/runTest.unitTest.js +274 -289
- package/dist/cli/lib/runTest.unitTest.js.map +1 -0
- package/dist/cli/lib/runTests.d.ts.map +1 -1
- package/dist/cli/lib/runTests.js +123 -141
- package/dist/cli/lib/runTests.js.map +1 -1
- package/dist/cli/lib/runTests.unitTest.d.ts +6 -0
- package/dist/cli/lib/runTests.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/runTests.unitTest.js +48 -61
- package/dist/cli/lib/runTests.unitTest.js.map +1 -0
- package/dist/cli/lib/showTestLoadingError.js +22 -33
- package/dist/cli/lib/showTestLoadingError.js.map +1 -1
- package/dist/cli/lib/showTestLoadingError.unitTest.d.ts +2 -0
- package/dist/cli/lib/showTestLoadingError.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/showTestLoadingError.unitTest.js +16 -24
- package/dist/cli/lib/showTestLoadingError.unitTest.js.map +1 -0
- package/dist/cli/lib/showTestResult.js +88 -88
- package/dist/cli/lib/showTestResult.js.map +1 -1
- package/dist/cli/lib/showTestResult.unitTest.d.ts +2 -0
- package/dist/cli/lib/showTestResult.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/showTestResult.unitTest.js +176 -184
- package/dist/cli/lib/showTestResult.unitTest.js.map +1 -0
- package/dist/cli/lib/testHelpers/makeCustomOut.d.ts +7 -0
- package/dist/cli/lib/testHelpers/makeCustomOut.d.ts.map +1 -0
- package/dist/cli/lib/testHelpers/makeCustomOut.js +10 -0
- package/dist/cli/lib/testHelpers/makeCustomOut.js.map +1 -0
- package/dist/cli/lib/timeProfier.js +4 -6
- package/dist/cli/lib/timeProfier.js.map +1 -1
- package/dist/cli/lib/validateConfig.js +21 -24
- package/dist/cli/lib/validateConfig.unitTest.d.ts +2 -0
- package/dist/cli/lib/validateConfig.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/validateConfig.unitTest.js +17 -18
- package/dist/cli/lib/validateConfig.unitTest.js.map +1 -0
- package/dist/cli/lib/{watchFiles.js → watchFiles.d.ts} +2 -1
- package/dist/cli/lib/watchFiles.d.ts.map +1 -0
- package/dist/cli/lib/watchFiles.js.map +1 -0
- package/dist/cli/lib/watchFiles.unitTest.d.ts +2 -0
- package/dist/cli/lib/watchFiles.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/watchFiles.unitTest.js.map +1 -0
- package/dist/cli/lib/watchFilesAndRunTests.js +2 -3
- package/dist/cli/lib/watchFilesAndRunTests.unitTest.d.ts +2 -0
- package/dist/cli/lib/watchFilesAndRunTests.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/watchFilesAndRunTests.unitTest.js +86 -96
- package/dist/cli/lib/watchFilesAndRunTests.unitTest.js.map +1 -0
- package/dist/cli/lib/watchFilesAndRunTestsChokidar.d.ts.map +1 -1
- package/dist/cli/lib/watchFilesAndRunTestsChokidar.js +99 -127
- package/dist/cli/lib/watchFilesAndRunTestsChokidar.js.map +1 -1
- package/dist/cli/lib/watchFilesAndRunTestsChokidar.unitTest.d.ts +2 -0
- package/dist/cli/lib/watchFilesAndRunTestsChokidar.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/watchFilesAndRunTestsChokidar.unitTest.js +90 -99
- package/dist/cli/lib/watchFilesAndRunTestsChokidar.unitTest.js.map +1 -0
- package/dist/cli/lib/watchFilesAndRunTestsNodeWatch.d.ts.map +1 -1
- package/dist/cli/lib/watchFilesAndRunTestsNodeWatch.js +108 -148
- package/dist/cli/lib/watchFilesAndRunTestsNodeWatch.js.map +1 -1
- package/dist/cli/lib/watchFilesAndRunTestsNodeWatch.unitTest.d.ts +2 -0
- package/dist/cli/lib/watchFilesAndRunTestsNodeWatch.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/watchFilesAndRunTestsNodeWatch.unitTest.js +87 -100
- package/dist/cli/lib/watchFilesAndRunTestsNodeWatch.unitTest.js.map +1 -0
- package/dist/cli/lib/watchFilesChokidar.js +30 -56
- package/dist/cli/lib/watchFilesChokidar.js.map +1 -1
- package/dist/cli/lib/watchFilesChokidar.unitTest.d.ts +2 -0
- package/dist/cli/lib/watchFilesChokidar.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/watchFilesChokidar.unitTest.js +77 -81
- package/dist/cli/lib/watchFilesChokidar.unitTest.js.map +1 -0
- package/dist/cli/lib/watchFilesNodeWatch.js +31 -41
- package/dist/cli/lib/watchFilesNodeWatch.js.map +1 -1
- package/dist/cli/lib/watchFilesNodeWatch.unitTest.d.ts +2 -0
- package/dist/cli/lib/watchFilesNodeWatch.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/watchFilesNodeWatch.unitTest.js +41 -46
- package/dist/cli/lib/watchFilesNodeWatch.unitTest.js.map +1 -0
- package/dist/cli/once.js +35 -42
- package/dist/cli/once.js.map +1 -1
- package/dist/cli/watch.js +64 -114
- package/dist/cli/watch.js.map +1 -1
- package/dist/cli/watch.unitTest.d.ts +6 -0
- package/dist/cli/watch.unitTest.d.ts.map +1 -0
- package/dist/cli/watch.unitTest.js +100 -111
- package/dist/cli/watch.unitTest.js.map +1 -0
- package/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +13 -2
- package/dist/config.js.map +1 -1
- package/dist/describe.js +20 -34
- package/dist/describe.js.map +1 -1
- package/dist/describe.unitTest.d.ts +2 -0
- package/dist/describe.unitTest.d.ts.map +1 -0
- package/dist/describe.unitTest.js +19 -23
- package/dist/describe.unitTest.js.map +1 -0
- package/dist/index.js +2 -1
- package/dist/indexNumberToLetters.js +12 -11
- package/dist/output.js +16 -18
- package/dist/packages/chalk.d.ts +14 -0
- package/dist/packages/chalk.d.ts.map +1 -0
- package/dist/packages/chalk.js +22 -0
- package/dist/packages/chalk.js.map +1 -0
- package/dist/packages/figures.d.ts +6 -0
- package/dist/packages/figures.d.ts.map +1 -0
- package/dist/packages/figures.js +24 -0
- package/dist/packages/figures.js.map +1 -0
- package/dist/packages/loadConfig.d.ts +3 -0
- package/dist/packages/loadConfig.d.ts.map +1 -0
- package/dist/packages/loadConfig.js +28 -0
- package/dist/packages/loadConfig.js.map +1 -0
- package/dist/packages/mergeStructuredConfig.d.ts +2 -0
- package/dist/packages/mergeStructuredConfig.d.ts.map +1 -0
- package/dist/packages/mergeStructuredConfig.js +26 -0
- package/dist/packages/mergeStructuredConfig.js.map +1 -0
- package/dist/packages/slash.d.ts +2 -0
- package/dist/packages/slash.d.ts.map +1 -0
- package/dist/packages/slash.js +9 -0
- package/dist/packages/slash.js.map +1 -0
- package/dist/packages/timeProfiler.d.ts +6 -0
- package/dist/packages/timeProfiler.d.ts.map +1 -0
- package/dist/packages/timeProfiler.js +32 -0
- package/dist/packages/timeProfiler.js.map +1 -0
- package/dist/types.d.ts +13 -13
- package/dist/types.d.ts.map +1 -1
- package/package.json +24 -20
- package/dist/cli/files.js +0 -20
- package/dist/cli/files.unitTest.js +0 -246
- package/dist/cli/init.unitTest.js +0 -0
- package/dist/cli/lib/defaultConfig.test.js +0 -9
- package/dist/cli/lib/loadTestFileStatic.js +0 -41
- package/dist/cli/lib/loadTestFileStatic.unitTest.js +0 -30
- package/dist/cli/lib/processWatchEvent.js +0 -1
- package/dist/cli/lib/processWatchEvent.unitTest.js +0 -15
- package/dist/cli/lib/runDescribe.old.js +0 -108
- package/dist/cli/lib/runDescribe.old.unitTest.js +0 -440
- package/dist/cli/lib/runTest-old.js +0 -160
- package/dist/cli/lib/runTest-old.unitTest.js +0 -184
- package/dist/cli/lib/watchFiles.unitTest.js +0 -50
- package/dist/cli/once.unitTest.js +0 -39
- package/dist/describe-old.js +0 -271
- package/dist/describe-old.unitTest.js +0 -30
- package/dist/exported.eslintrc.js +0 -7
- package/dist/lib/arrayRemove.d.ts +0 -2
- package/dist/lib/arrayRemove.d.ts.map +0 -1
- package/dist/lib/arrayRemove.js +0 -15
- package/dist/lib/arrayRemove.js.map +0 -1
- package/dist/lib/promiseAllObj.d.ts +0 -2
- package/dist/lib/promiseAllObj.d.ts.map +0 -1
- package/dist/lib/promiseAllObj.js +0 -14
- package/dist/lib/promiseAllObj.js.map +0 -1
- package/dist/testsState.js +0 -5
- package/dist/timeProfiling.js +0 -9
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
import { out as mainOut
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
throw new Error(message);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
1
|
+
import { out as mainOut } from '../../output.js';
|
|
2
|
+
export function validateConfig(config, customOut) {
|
|
3
|
+
const out = customOut ?? mainOut;
|
|
4
|
+
function doError(message) {
|
|
5
|
+
out(message);
|
|
6
|
+
throw new Error(message);
|
|
7
|
+
}
|
|
8
|
+
if (config.execution === undefined) {
|
|
9
|
+
doError('Config error, config.execution is not defined');
|
|
10
|
+
}
|
|
11
|
+
if (config.execution.files !== 'parallel' && config.execution.files !== 'sequential') {
|
|
12
|
+
doError('Config error, config.execution.files should be \'parallel\' or \'sequential\'');
|
|
13
|
+
}
|
|
14
|
+
if (config.execution.describes !== 'parallel' && config.execution.describes !== 'sequential') {
|
|
15
|
+
doError('Config error, config.execution.describes should be \'parallel\' or \'sequential\'');
|
|
16
|
+
}
|
|
17
|
+
if (config.execution.tests !== 'parallel' && config.execution.tests !== 'sequential') {
|
|
18
|
+
doError('Config error, config.execution.tests should be \'parallel\' or \'sequential\'');
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=validateConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateConfig.unitTest.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/validateConfig.unitTest.ts"],"names":[],"mappings":""}
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import { applyConfigDefaults } from './applyConfigDefaults.js';
|
|
2
2
|
import { validateConfig } from './validateConfig.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
import { makeCustomOut } from './testHelpers/makeCustomOut.js';
|
|
4
|
+
mochaDescribe('validateConfig() function', function () {
|
|
5
|
+
mochaIt('complains if execution values are not valid', function () {
|
|
6
|
+
const customOut = makeCustomOut();
|
|
7
|
+
const config = applyConfigDefaults({
|
|
8
|
+
execution: {
|
|
9
|
+
files: 'typo'
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
try {
|
|
13
|
+
validateConfig(config, customOut);
|
|
14
|
+
}
|
|
15
|
+
catch { /* expected */ }
|
|
16
|
+
customOut.getOutBuffer().should.include('Config error');
|
|
17
|
+
customOut.getOutBuffer().should.include('execution.files');
|
|
13
18
|
});
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
} catch (e) {} // eslint-disable-line
|
|
17
|
-
|
|
18
|
-
await (await customOut.getOutBuffer()).should.include('Config error');
|
|
19
|
-
await (await customOut.getOutBuffer()).should.include('execution.files');
|
|
20
|
-
});
|
|
21
|
-
});
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=validateConfig.unitTest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateConfig.unitTest.js","sourceRoot":"","sources":["../../../src/cli/lib/validateConfig.unitTest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAE9D,aAAa,CAAC,2BAA2B,EAAE;IACvC,OAAO,CAAC,6CAA6C,EAAE;QACnD,MAAM,SAAS,GAAG,aAAa,EAAE,CAAA;QAEjC,MAAM,MAAM,GAAG,mBAAmB,CAAC;YAC/B,SAAS,EAAE;gBACP,KAAK,EAAE,MAAe;aACzB;SACJ,CAAC,CAAA;QAEF,IAAI,CAAC;YACD,cAAc,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;QACrC,CAAC;QAAC,MAAM,CAAC,CAAC,cAAc,CAAC,CAAC;QAE1B,SAAS,CAAC,YAAY,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAA;QACvD,SAAS,CAAC,YAAY,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAA;IAC9D,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,CAAA"}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { watchFilesChokidar as watchFiles } from './watchFilesChokidar.js';
|
|
1
|
+
export { watchFilesChokidar as watchFiles } from './watchFilesChokidar.js';
|
|
2
|
+
//# sourceMappingURL=watchFiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watchFiles.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/watchFiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watchFiles.js","sourceRoot":"","sources":["../../../src/cli/lib/watchFiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watchFiles.unitTest.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/watchFiles.unitTest.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watchFiles.unitTest.js","sourceRoot":"","sources":["../../../src/cli/lib/watchFiles.unitTest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAA;AAEnC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAE9D,aAAa,CAAC,uBAAuB,EAAE;IACnC,OAAO,CAAC,iDAAiD,EAAE,KAAK;QAC5D,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QAEnB,MAAM,MAAM,GAAG,mBAAmB,CAAC,EAAE,CAAC,CAAA;QAEtC,IAAI,aAAa,GAAG,KAAK,CAAA;QAEzB,MAAM,UAAU,CAAC,MAAM,EAAE,GAAG,EAAE;YAC1B,aAAa,GAAG,IAAI,CAAA;QACxB,CAAC,CAAC,CAAA;QAEF,KAAK,EAAE,CAAC,SAAS,CAAC,+BAA+B,EAAE,KAAK,CAAC,CAAA;QAEzD,MAAM,IAAI,OAAO,CAAO,OAAO,CAAC,EAAE;YAC9B,MAAM,QAAQ,GAAG,WAAW,CACxB,GAAG,EAAE;gBACD,IAAI,aAAa,EAAE,CAAC;oBAChB,aAAa,CAAC,QAAQ,CAAC,CAAA;oBACvB,OAAO,EAAE,CAAA;gBACb,CAAC;YACL,CAAC,EACD,EAAE,CACL,CAAA;QACL,CAAC,CAAC,CAAA;QAEF,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IACpC,CAAC,CAAC,CAAA;IAEF,OAAO,CAAC,qEAAqE,EAAE,KAAK;QAChF,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QAEnB,MAAM,MAAM,GAAG,mBAAmB,CAAC;YAC/B,KAAK,EAAE;gBACH,cAAc,EAAE,uBAAuB;gBACvC,UAAU,EAAE,SAAS;aACxB;SACJ,CAAC,CAAA;QAEF,IAAI,aAAa,GAAG,KAAK,CAAA;QAEzB,MAAM,UAAU,CAAC,MAAM,EAAE,GAAG,EAAE;YAC1B,aAAa,GAAG,IAAI,CAAA;QACxB,CAAC,CAAC,CAAA;QAEF,KAAK,EAAE,CAAC,SAAS,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAA;QAE3D,MAAM,IAAI,OAAO,CAAO,OAAO,CAAC,EAAE;YAC9B,MAAM,QAAQ,GAAG,WAAW,CACxB,GAAG,EAAE;gBACD,IAAI,aAAa,EAAE,CAAC;oBAChB,aAAa,CAAC,QAAQ,CAAC,CAAA;oBACvB,OAAO,EAAE,CAAA;gBACb,CAAC;YACL,CAAC,EACD,EAAE,CACL,CAAA;QACL,CAAC,CAAC,CAAA;QAEF,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IACpC,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,CAAA"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export { watchFilesAndRunTestsNodeWatch as watchFilesAndRunTests } from './watchFilesAndRunTestsNodeWatch.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
// from './watchFilesAndRunTestsChokidar.js'
|
|
2
|
+
//export { watchFilesAndRunTestsChokidar as watchFilesAndRunTests } from './watchFilesAndRunTestsChokidar.js'
|
|
3
|
+
//# sourceMappingURL=watchFilesAndRunTests.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watchFilesAndRunTests.unitTest.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/watchFilesAndRunTests.unitTest.ts"],"names":[],"mappings":""}
|
|
@@ -1,40 +1,30 @@
|
|
|
1
1
|
import { promises as fs, existsSync } from 'fs';
|
|
2
|
-
import figures from 'figures';
|
|
3
|
-
import { objectCopy } from 'sxy-lib-object-copy';
|
|
2
|
+
import figures from '../../packages/figures.js';
|
|
4
3
|
import { watchFilesAndRunTests } from './watchFilesAndRunTests.js';
|
|
5
4
|
import { applyConfigDefaults } from './applyConfigDefaults.js';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
watchFilesAndRunTests(config, [], {}, [], customOut);
|
|
30
|
-
|
|
31
|
-
//console.log('outBuffer', outBuffer)
|
|
32
|
-
|
|
33
|
-
await outBuffer.should.equal('');
|
|
34
|
-
const testFileName = `${tempFolder}/a.test.js`;
|
|
35
|
-
const thing = 'Sample test 1';
|
|
36
|
-
const should = '1 should equal 1';
|
|
37
|
-
await fs.writeFile(testFileName, `import { describe } from '../../dist/index.js'
|
|
5
|
+
mochaDescribe('watchFilesAndRunTests() function', function () {
|
|
6
|
+
const tempFolder = 'watchTests/watchFilesAndRunTests';
|
|
7
|
+
const baseConfig = applyConfigDefaults({
|
|
8
|
+
testsBase: tempFolder,
|
|
9
|
+
tests: '**/*.test.js',
|
|
10
|
+
watch: {
|
|
11
|
+
watchFilesBase: tempFolder,
|
|
12
|
+
watchFiles: '**/*.js'
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
mochaIt('should run a test when a test file is changed', async function () {
|
|
16
|
+
const config = structuredClone(baseConfig);
|
|
17
|
+
// create a custom out function to capture the output
|
|
18
|
+
let outBuffer = '';
|
|
19
|
+
const customOut = (...texts) => {
|
|
20
|
+
outBuffer += texts.join(' ') + '\n';
|
|
21
|
+
};
|
|
22
|
+
void watchFilesAndRunTests(config, [], {}, [], customOut);
|
|
23
|
+
outBuffer.should.equal('');
|
|
24
|
+
const testFileName = `${tempFolder}/a.test.js`;
|
|
25
|
+
const thing = 'Sample test 1';
|
|
26
|
+
const should = '1 should equal 1';
|
|
27
|
+
void fs.writeFile(testFileName, `import { describe } from '../../dist/index.js'
|
|
38
28
|
import { expect, should } from 'chai'
|
|
39
29
|
should()
|
|
40
30
|
|
|
@@ -45,30 +35,29 @@ describe('${thing}', ({it}) => {
|
|
|
45
35
|
})
|
|
46
36
|
|
|
47
37
|
})`);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
await fs.writeFile(testFileName, `import { describe } from '../../dist/index.js'
|
|
38
|
+
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
39
|
+
outBuffer.should.include(testFileName);
|
|
40
|
+
outBuffer.should.include(thing);
|
|
41
|
+
outBuffer.should.include(should);
|
|
42
|
+
outBuffer.should.include(figures.tick);
|
|
43
|
+
});
|
|
44
|
+
mochaIt('should run a test when a new test file is changed', async function () {
|
|
45
|
+
const config = structuredClone(baseConfig);
|
|
46
|
+
// create a custom out function to capture the output
|
|
47
|
+
let outBuffer = '';
|
|
48
|
+
const customOut = (...texts) => {
|
|
49
|
+
outBuffer += texts.join(' ') + '\n';
|
|
50
|
+
};
|
|
51
|
+
const testFileName = `${tempFolder}/b.test.js`;
|
|
52
|
+
const thing = 'Sample test 2';
|
|
53
|
+
const should = '2 should equal 2';
|
|
54
|
+
if (existsSync(testFileName)) {
|
|
55
|
+
await fs.unlink(testFileName);
|
|
56
|
+
}
|
|
57
|
+
existsSync(testFileName).should.equal(false);
|
|
58
|
+
await watchFilesAndRunTests(config, [], {}, [], customOut);
|
|
59
|
+
outBuffer.should.equal('');
|
|
60
|
+
void fs.writeFile(testFileName, `import { describe } from '../../dist/index.js'
|
|
72
61
|
import { expect, should } from 'chai'
|
|
73
62
|
should()
|
|
74
63
|
|
|
@@ -79,27 +68,24 @@ describe('${thing}', ({it}) => {
|
|
|
79
68
|
})
|
|
80
69
|
|
|
81
70
|
})`);
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
const should = '3 should equal 3';
|
|
101
|
-
if (!(await existsSync(testFileName))) {
|
|
102
|
-
await fs.writeFile(testFileName, `import { describe } from '../../dist/index.js'
|
|
71
|
+
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
72
|
+
outBuffer.should.include(testFileName);
|
|
73
|
+
outBuffer.should.include(thing);
|
|
74
|
+
outBuffer.should.include(should);
|
|
75
|
+
outBuffer.should.include(figures.tick);
|
|
76
|
+
});
|
|
77
|
+
mochaIt('removes a test from tests and dependencyTrees when it is deleted', async function () {
|
|
78
|
+
const config = structuredClone(baseConfig);
|
|
79
|
+
// create a custom out function to capture the output
|
|
80
|
+
let outBuffer = '';
|
|
81
|
+
const customOut = (...texts) => {
|
|
82
|
+
outBuffer += texts.join(' ') + '\n';
|
|
83
|
+
};
|
|
84
|
+
const testFileName = `${tempFolder}/c.test.js`;
|
|
85
|
+
const thing = 'Sample test 3';
|
|
86
|
+
const should = '3 should equal 3';
|
|
87
|
+
if (!existsSync(testFileName)) {
|
|
88
|
+
await fs.writeFile(testFileName, `import { describe } from '../../dist/index.js'
|
|
103
89
|
import { expect, should } from 'chai'
|
|
104
90
|
should()
|
|
105
91
|
|
|
@@ -110,20 +96,24 @@ describe('${thing}', ({it}) => {
|
|
|
110
96
|
})
|
|
111
97
|
|
|
112
98
|
})`);
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
99
|
+
}
|
|
100
|
+
existsSync(testFileName).should.be.true;
|
|
101
|
+
const originalTests = [testFileName];
|
|
102
|
+
const originalDependencyTrees = {
|
|
103
|
+
[testFileName]: [
|
|
104
|
+
'dep-1.js',
|
|
105
|
+
'dep-2.js'
|
|
106
|
+
]
|
|
107
|
+
};
|
|
108
|
+
const tests = structuredClone(originalTests);
|
|
109
|
+
const dependencyTrees = structuredClone(originalDependencyTrees);
|
|
110
|
+
tests.should.include.members([testFileName]);
|
|
111
|
+
dependencyTrees.should.include.keys([testFileName]);
|
|
112
|
+
await watchFilesAndRunTests(config, tests, dependencyTrees, [], customOut);
|
|
113
|
+
await fs.unlink(testFileName);
|
|
114
|
+
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
115
|
+
tests.should.not.include.members([testFileName]);
|
|
116
|
+
dependencyTrees.should.not.include.keys([testFileName]);
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
//# sourceMappingURL=watchFilesAndRunTests.unitTest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1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GAAG,eAAe,CAAC,aAAa,CAAC,CAAA;QAC5C,MAAM,eAAe,GAAG,eAAe,CAAC,uBAAuB,CAAC,CAAA;QAEhE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,CAAC,CAAA;QAC5C,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC,CAAA;QAEnD,MAAM,qBAAqB,CAAC,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,EAAE,EAAE,SAAS,CAAC,CAAA;QAE1E,MAAM,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,CAAA;QAE7B,MAAM,IAAI,OAAO,CAAO,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAA;QAE7D,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,CAAC,CAAA;QAChD,eAAe,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC,CAAA;IAC3D,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watchFilesAndRunTestsChokidar.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/watchFilesAndRunTestsChokidar.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAIpE,wBAAsB,6BAA6B,CAC/C,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EAAE,EACnB,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,MAAM,EAAE,EACtB,SAAS,CAAC,EAAE,KAAK,GAClB,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"watchFilesAndRunTestsChokidar.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/watchFilesAndRunTestsChokidar.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAIpE,wBAAsB,6BAA6B,CAC/C,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EAAE,EACnB,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,MAAM,EAAE,EACtB,SAAS,CAAC,EAAE,KAAK,GAClB,OAAO,CAAC,IAAI,CAAC,CAgHf"}
|
|
@@ -1,136 +1,108 @@
|
|
|
1
|
-
import { createTimeProfiler } from '
|
|
1
|
+
import { createTimeProfiler } from '../../packages/timeProfiler.js';
|
|
2
2
|
import { showTimeProfiling } from '../../config.js';
|
|
3
|
-
import chalk from 'chalk
|
|
3
|
+
import chalk from '../../packages/chalk.js';
|
|
4
4
|
import minimatch from 'minimatch';
|
|
5
|
-
import slash from 'slash';
|
|
6
|
-
import watch from 'node-watch';
|
|
7
|
-
//import chokidar from 'chokidar'
|
|
8
|
-
//import nsfw from 'nsfw'
|
|
9
|
-
import fs from 'fs';
|
|
5
|
+
import slash from '../../packages/slash.js';
|
|
10
6
|
import { out, log, debug } from '../../output.js';
|
|
11
7
|
import { runTests } from './runTests.js';
|
|
12
8
|
import { buildDependencyTree } from './buildDependencyTree.js';
|
|
13
9
|
import { globArgCombine } from './globArgCombine.js';
|
|
14
|
-
//import { load } from './load.js.depr/index.js'
|
|
15
|
-
|
|
16
|
-
const {
|
|
17
|
-
timeProfileAsync
|
|
18
|
-
} = await createTimeProfiler(showTimeProfiling);
|
|
19
10
|
import { watchFilesChokidar } from './watchFilesChokidar.js';
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
// info on the event found
|
|
40
|
-
await out(chalk.grey`change: ${filename} (${event})`);
|
|
41
|
-
|
|
42
|
-
// add the file to changed files
|
|
43
|
-
await changedFiles.push([filename, event]);
|
|
44
|
-
|
|
45
|
-
// wait 100ms after any change before processing, to avoid multiple execution?
|
|
46
|
-
if (timeout) {
|
|
47
|
-
await clearTimeout(timeout);
|
|
48
|
-
}
|
|
49
|
-
timeout = await setTimeout(async () => {
|
|
50
|
-
await timeProfileAsync('handle changed files', async () => {
|
|
51
|
-
await debug('changed files', changedFiles);
|
|
52
|
-
//out('changed files', changedFiles)
|
|
53
|
-
try {
|
|
54
|
-
// build related test list
|
|
55
|
-
const tests = [];
|
|
56
|
-
for (const [file, event] of changedFiles) {
|
|
57
|
-
await debug('check', file);
|
|
58
|
-
await debug('1 tests', tests);
|
|
59
|
-
if (event !== 'remove') {
|
|
60
|
-
// only check to see if its a test if it exists (has not just been removed)
|
|
61
|
-
if (await testFilter(file)) {
|
|
62
|
-
// it is a test file itself, add to run list
|
|
63
|
-
await debug('its a test', file);
|
|
64
|
-
await tests.push(file);
|
|
65
|
-
if (!(file in dependencyTrees)) {
|
|
66
|
-
// if its a new test
|
|
67
|
-
await debug('try to add a new test', file), await addNewTest(file);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
await debug('dtrees', dependencyTrees);
|
|
72
|
-
await debug('2 tests', tests);
|
|
73
|
-
for (const f of await Object.getOwnPropertyNames(dependencyTrees)) {
|
|
74
|
-
await debug('dep tree', f, dependencyTrees[f]);
|
|
75
|
-
if (await dependencyTrees[f].some(dep => {
|
|
76
|
-
debug('checking dep', dep, file);
|
|
77
|
-
return dep === file;
|
|
78
|
-
})) {
|
|
79
|
-
// a test depends on this file
|
|
80
|
-
await debug('its a dependency', file);
|
|
81
|
-
await debug('its a dependency', file);
|
|
82
|
-
await tests.push(f);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
11
|
+
import { remove as arrayRemove } from 'sxy-lib/arrays.js';
|
|
12
|
+
const { timeProfileAsync } = createTimeProfiler(showTimeProfiling);
|
|
13
|
+
export async function watchFilesAndRunTestsChokidar(config, testFiles, dependencyTrees, failingTests, customOut) {
|
|
14
|
+
const projectDir = process.cwd();
|
|
15
|
+
await timeProfileAsync('start watching', async () => {
|
|
16
|
+
let changedFiles = [];
|
|
17
|
+
let timeout = null;
|
|
18
|
+
const testFilter = (file) => {
|
|
19
|
+
return minimatch(file, globArgCombine(config.tests))
|
|
20
|
+
&& !minimatch(file, globArgCombine(config.testsIgnore));
|
|
21
|
+
};
|
|
22
|
+
// start watching
|
|
23
|
+
await watchFilesChokidar(config, watchEvent);
|
|
24
|
+
function watchEvent(filename, event) {
|
|
25
|
+
debug('chokidar watch event', filename, event);
|
|
26
|
+
// remove dep tree for any tests that are deleted, avoiding trying to run it later
|
|
27
|
+
if (event === 'remove' && filename in dependencyTrees) {
|
|
28
|
+
arrayRemove(testFiles, filename);
|
|
29
|
+
delete dependencyTrees[filename];
|
|
85
30
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
for (const failingTest of failingTests) {
|
|
94
|
-
if (!(await fs.existsSync(failingTest))) {
|
|
95
|
-
//debug('remove failing test', failingTest)
|
|
96
|
-
await failingTests.remove(failingTest); // arrayRemove?
|
|
97
|
-
//(failingTests)
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
await debug('tests', tests);
|
|
102
|
-
await debug('failingTests', failingTests);
|
|
103
|
-
await debug('reRunFailingTests', config.watch.reRunFailingTests);
|
|
104
|
-
const toTest = config.watch.reRunFailingTests ? await (await [...tests, ...failingTests].dedupeSlow()).reverse() // dedupe return new? // reverse in place
|
|
105
|
-
: await [...tests].reverse(); // reverse in place
|
|
106
|
-
|
|
107
|
-
const results = {
|
|
108
|
-
total: 0,
|
|
109
|
-
passed: 0
|
|
110
|
-
};
|
|
111
|
-
await debug('run tests on change');
|
|
112
|
-
await debug('toTest', toTest);
|
|
113
|
-
|
|
114
|
-
// clear load cache to allow accesing the new tets
|
|
115
|
-
//load.cache.clear()
|
|
116
|
-
|
|
117
|
-
const testResults = await runTests(config, toTest, failingTests, customOut);
|
|
118
|
-
});
|
|
31
|
+
// info on the event found
|
|
32
|
+
out(chalk.grey `change: ${filename} (${event})`);
|
|
33
|
+
// add the file to changed files
|
|
34
|
+
changedFiles.push([filename, event]);
|
|
35
|
+
// wait 100ms after any change before processing, to avoid multiple execution?
|
|
36
|
+
if (timeout) {
|
|
37
|
+
clearTimeout(timeout);
|
|
119
38
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
39
|
+
timeout = setTimeout(() => {
|
|
40
|
+
void timeProfileAsync('handle changed files', async () => {
|
|
41
|
+
debug('changed files', changedFiles);
|
|
42
|
+
try {
|
|
43
|
+
// build related test list
|
|
44
|
+
const tests = [];
|
|
45
|
+
for (const [file, fileEvent] of changedFiles) {
|
|
46
|
+
debug('check', file);
|
|
47
|
+
debug('1 tests', tests);
|
|
48
|
+
if (fileEvent !== 'remove') { // only check if it's a test if it exists (has not just been removed)
|
|
49
|
+
if (testFilter(file)) { // it is a test file itself, add to run list
|
|
50
|
+
debug('its a test', file);
|
|
51
|
+
tests.push(file);
|
|
52
|
+
if (!(file in dependencyTrees)) { // if its a new test
|
|
53
|
+
debug('try to add a new test', file);
|
|
54
|
+
addNewTest(file);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
debug('dtrees', dependencyTrees);
|
|
59
|
+
debug('2 tests', tests);
|
|
60
|
+
for (const f of Object.getOwnPropertyNames(dependencyTrees)) {
|
|
61
|
+
debug('dep tree', f, dependencyTrees[f]);
|
|
62
|
+
if (dependencyTrees[f]?.some(dep => dep === file) === true) { // a test depends on this file
|
|
63
|
+
debug('its a dependency', file);
|
|
64
|
+
tests.push(f);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
changedFiles = [];
|
|
69
|
+
debug('tests', tests);
|
|
70
|
+
if (tests.length) {
|
|
71
|
+
await timeProfileAsync('run tests related to changes', async () => {
|
|
72
|
+
debug('tests', tests);
|
|
73
|
+
// NOTE: the original guarded a stale-failing-test cleanup here with
|
|
74
|
+
// `config.reRunFailingTests` (missing the `.watch.` prefix used everywhere
|
|
75
|
+
// else), which is always undefined - so it never ran. Preserved as dead
|
|
76
|
+
// code rather than newly activating it as part of a TS conversion.
|
|
77
|
+
debug('tests', tests);
|
|
78
|
+
debug('failingTests', failingTests);
|
|
79
|
+
debug('reRunFailingTests', config.watch.reRunFailingTests);
|
|
80
|
+
const toTest = config.watch.reRunFailingTests
|
|
81
|
+
? [...new Set([...tests, ...failingTests])].reverse()
|
|
82
|
+
: [...tests].reverse();
|
|
83
|
+
debug('run tests on change');
|
|
84
|
+
debug('toTest', toTest);
|
|
85
|
+
await runTests(config, toTest, failingTests, customOut);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
catch (e) {
|
|
90
|
+
log('watch handler error', e);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}, 33);
|
|
94
|
+
} // end of watch event
|
|
95
|
+
function addNewTest(testFile) {
|
|
96
|
+
debug('new test', testFile);
|
|
97
|
+
const dependencyTree = buildDependencyTree(config, testFile);
|
|
98
|
+
dependencyTrees[testFile] = dependencyTree
|
|
99
|
+
.map(file => slash(file).slice(projectDir.length + 1))
|
|
100
|
+
.filter(f => f !== testFile);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
// NOTE: "watching..." is intentionally NOT printed here. watch() already emits it,
|
|
104
|
+
// tied to a real milestone (the initial test run finishing, or no tests found).
|
|
105
|
+
// Printing it again here produced a duplicate "watching..." on every startup.
|
|
106
|
+
// out(chalk.brightblue`watching...`)
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=watchFilesAndRunTestsChokidar.js.map
|