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
package/dist/cli/index.js
CHANGED
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// need to change this to a safe version
|
|
4
|
-
const args = await process.argv.slice(2);
|
|
2
|
+
const args = process.argv.slice(2);
|
|
5
3
|
if (args.length > 0) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
//console.log('watch 2 args', args)
|
|
20
|
-
await doCommand('watch', args);
|
|
4
|
+
const command = args[0];
|
|
5
|
+
switch (command) {
|
|
6
|
+
case 'init':
|
|
7
|
+
case 'once':
|
|
8
|
+
case 'watch':
|
|
9
|
+
await doCommand(command, args.slice(1));
|
|
10
|
+
break;
|
|
11
|
+
default:
|
|
12
|
+
await doCommand('watch', args);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
await doCommand('watch', args);
|
|
21
17
|
}
|
|
22
18
|
async function doCommand(command, args) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
19
|
+
global.commandLineArguments = args;
|
|
20
|
+
// command-named dynamic import - no static type can express "a module matching an unknown command string"
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
22
|
+
const module = await import(`./${command}.js`);
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
|
|
24
|
+
await module[command]();
|
|
25
|
+
process.exit(0);
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
package/dist/cli/init.js
CHANGED
|
@@ -1,45 +1,44 @@
|
|
|
1
1
|
import { join } from 'path';
|
|
2
|
-
import chalk from 'chalk
|
|
2
|
+
import chalk from '../packages/chalk.js';
|
|
3
3
|
import { packageName, cliName, configFileName, configLocations } from '../config.js';
|
|
4
|
-
import { out
|
|
4
|
+
import { out } from '../output.js';
|
|
5
5
|
import fs from 'fs';
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
export function init() {
|
|
7
|
+
const projectDir = process.cwd();
|
|
8
|
+
for (const configLocation of configLocations) {
|
|
9
|
+
let loc;
|
|
10
|
+
loc = join(projectDir, configLocation, configFileName + '.js');
|
|
11
|
+
if (fs.existsSync(loc)) {
|
|
12
|
+
configAlreadyExists(loc);
|
|
13
|
+
}
|
|
14
|
+
loc = join(projectDir, configLocation, configFileName + '.cjs');
|
|
15
|
+
if (fs.existsSync(loc)) {
|
|
16
|
+
configAlreadyExists(loc);
|
|
17
|
+
}
|
|
18
|
+
loc = join(projectDir, configLocation, configFileName + '.mjs');
|
|
19
|
+
if (fs.existsSync(loc)) {
|
|
20
|
+
configAlreadyExists(loc);
|
|
21
|
+
}
|
|
13
22
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
23
|
+
function configAlreadyExists(loc) {
|
|
24
|
+
out(chalk.orange `[${packageName}] A matching config already exists at ${loc}`
|
|
25
|
+
+ `\nPlease remove this config before generating a new one with \`${cliName} init\``);
|
|
17
26
|
}
|
|
18
|
-
|
|
19
|
-
if (
|
|
20
|
-
|
|
27
|
+
const projectPackageJsonLocation = join(projectDir, 'package.json');
|
|
28
|
+
if (!fs.existsSync(projectPackageJsonLocation)) {
|
|
29
|
+
out(chalk.orange `[${packageName}] No package.json exists in this location`
|
|
30
|
+
+ '\nPlease initialise the package with `yarn init` on `npm init`'
|
|
31
|
+
+ ' before running this command, and run this command from the project root folder');
|
|
21
32
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
//const packageJsonRaw = await fs.promises.readFile( projectPackageJsonLocation )
|
|
32
|
-
const packageJsonRaw = await fs.readFileSync(projectPackageJsonLocation);
|
|
33
|
-
const packageJson = await JSON.parse(packageJsonRaw);
|
|
34
|
-
let targetConfigName;
|
|
35
|
-
if (packageJson.type === 'module') {
|
|
36
|
-
// ES6 module
|
|
37
|
-
targetConfigName = await join(projectDir, configLocations[0], configFileName + '.js');
|
|
38
|
-
} else {
|
|
39
|
-
// common
|
|
40
|
-
targetConfigName = await join(projectDir, configLocations[0], configFileName + '.mjs');
|
|
41
|
-
}
|
|
42
|
-
const defaultConfig = `export default {
|
|
33
|
+
const packageJsonRaw = fs.readFileSync(projectPackageJsonLocation, 'utf8');
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
35
|
+
const packageJson = JSON.parse(packageJsonRaw);
|
|
36
|
+
const targetConfigName = (packageJson.type === 'module')
|
|
37
|
+
// ES6 module
|
|
38
|
+
? join(projectDir, configLocations[0] ?? '', configFileName + '.js')
|
|
39
|
+
// common
|
|
40
|
+
: join(projectDir, configLocations[0] ?? '', configFileName + '.mjs');
|
|
41
|
+
const defaultConfig = `export default {
|
|
43
42
|
|
|
44
43
|
// base folder for tests match and ignore patterns
|
|
45
44
|
testsBase: '.',
|
|
@@ -80,7 +79,7 @@ export async function init() {
|
|
|
80
79
|
|
|
81
80
|
// tasks to run before each it/test block
|
|
82
81
|
// function returns and file exports will be passed to the it/test block as with describe above, e.g.
|
|
83
|
-
// it('should', ({exportA, exportB}) => { assert('something') })
|
|
82
|
+
// it('should', ({exportA, exportB}) => { assert('something') })
|
|
84
83
|
beforeEachTest: undefined,
|
|
85
84
|
|
|
86
85
|
// tasks to run after each it/test block
|
|
@@ -114,63 +113,14 @@ export async function init() {
|
|
|
114
113
|
|
|
115
114
|
// run all tests when starting the watcher
|
|
116
115
|
runAllOnStartup: true,
|
|
117
|
-
|
|
116
|
+
|
|
118
117
|
// re run all previously failed tests on each test run, until they pass
|
|
119
118
|
reRunFailingTests: true,
|
|
120
119
|
|
|
121
120
|
},
|
|
122
121
|
|
|
123
122
|
}`;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
// // glob pattern or array of glob patterns of test files
|
|
130
|
-
// tests: [
|
|
131
|
-
// '**/*.test.{js,mjs,jsx}',
|
|
132
|
-
// '**/*.spec.{js,mjs,jsx}',
|
|
133
|
-
// '**/tests?/*.{js,mjs,jsx}',
|
|
134
|
-
// '**/__tests?__/*.{js,mjs,jsx}'
|
|
135
|
-
// ],
|
|
136
|
-
|
|
137
|
-
// // glob pattern or array of patterns of test files to ignore
|
|
138
|
-
// testsIgnore: ['**/node_modules/**/*'],
|
|
139
|
-
|
|
140
|
-
// // function to run on startup
|
|
141
|
-
// setup: undefined,
|
|
142
|
-
|
|
143
|
-
// // function to run before each test file
|
|
144
|
-
// setupEach: undefined,
|
|
145
|
-
|
|
146
|
-
// // function to run after test run
|
|
147
|
-
// teardown: undefined,
|
|
148
|
-
|
|
149
|
-
// // function to run after each test file
|
|
150
|
-
// teardownEach: undefined,
|
|
151
|
-
|
|
152
|
-
// // watch mode configurations
|
|
153
|
-
// watch: {
|
|
154
|
-
|
|
155
|
-
// //// the base directory to watch files in
|
|
156
|
-
// watchFilesBase: '.',
|
|
157
|
-
|
|
158
|
-
// //// glob filter or array of glob filters of files to watch
|
|
159
|
-
// watchFiles: '**/*.js',
|
|
160
|
-
|
|
161
|
-
// //// glob filter or array of globl filters of files to ignore
|
|
162
|
-
// watchFilesIgnore: '**/node_modules/**/*',
|
|
163
|
-
|
|
164
|
-
// // run all tests when starting the watcher
|
|
165
|
-
// runAllOnStartup: true,
|
|
166
|
-
|
|
167
|
-
// // re run all previously failed tests on each test run, until they pass
|
|
168
|
-
// reRunFailingTests: true,
|
|
169
|
-
|
|
170
|
-
// },
|
|
171
|
-
|
|
172
|
-
// }`
|
|
173
|
-
|
|
174
|
-
await fs.writeFileSync(targetConfigName, defaultConfig);
|
|
175
|
-
await out(chalk.mediumgreen`[${packageName}] Created config at ` + (await chalk.blue(targetConfigName)));
|
|
176
|
-
}
|
|
123
|
+
fs.writeFileSync(targetConfigName, defaultConfig);
|
|
124
|
+
out(chalk.mediumgreen `[${packageName}] Created config at ` + chalk.blue(targetConfigName));
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=init.js.map
|
package/dist/cli/init.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/cli/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,KAAK,MAAM,
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/cli/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,KAAK,MAAM,sBAAsB,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACpF,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAClC,OAAO,EAAE,MAAM,IAAI,CAAA;AAEnB,MAAM,UAAU,IAAI;IAChB,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAA;IAEhC,KAAK,MAAM,cAAc,IAAI,eAAe,EAAE,CAAC;QAC3C,IAAI,GAAG,CAAA;QACP,GAAG,GAAG,IAAI,CAAC,UAAU,EAAE,cAAc,EAAE,cAAc,GAAG,KAAK,CAAC,CAAA;QAC9D,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACrB,mBAAmB,CAAC,GAAG,CAAC,CAAA;QAC5B,CAAC;QACD,GAAG,GAAG,IAAI,CAAC,UAAU,EAAE,cAAc,EAAE,cAAc,GAAG,MAAM,CAAC,CAAA;QAC/D,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACrB,mBAAmB,CAAC,GAAG,CAAC,CAAA;QAC5B,CAAC;QACD,GAAG,GAAG,IAAI,CAAC,UAAU,EAAE,cAAc,EAAE,cAAc,GAAG,MAAM,CAAC,CAAA;QAC/D,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACrB,mBAAmB,CAAC,GAAG,CAAC,CAAA;QAC5B,CAAC;IACL,CAAC;IAED,SAAS,mBAAmB,CAAC,GAAW;QACpC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAA,IAAI,WAAW,yCAAyC,GAAG,EAAE;cACvE,kEAAkE,OAAO,SAAS,CAAC,CAAA;IAC7F,CAAC;IAED,MAAM,0BAA0B,GAAG,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAA;IACnE,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,0BAA0B,CAAC,EAAE,CAAC;QAC7C,GAAG,CAAC,KAAK,CAAC,MAAM,CAAA,IAAI,WAAW,2CAA2C;cACpE,gEAAgE;cAChE,iFAAiF,CAAC,CAAA;IAC5F,CAAC;IAED,MAAM,cAAc,GAAG,EAAE,CAAC,YAAY,CAAC,0BAA0B,EAAE,MAAM,CAAC,CAAA;IAC1E,mEAAmE;IACnE,MAAM,WAAW,GAAsB,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAA;IAEjE,MAAM,gBAAgB,GAAG,CAAC,WAAW,CAAC,IAAI,KAAK,QAAQ,CAAC;QACpD,aAAa;QACb,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,cAAc,GAAG,KAAK,CAAC;QACpE,SAAS;QACT,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,cAAc,GAAG,MAAM,CAAC,CAAA;IAEzE,MAAM,aAAa,GACvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiFE,CAAA;IAEE,EAAE,CAAC,aAAa,CAAC,gBAAgB,EAAE,aAAa,CAAC,CAAA;IAEjD,GAAG,CAAC,KAAK,CAAC,WAAW,CAAA,IAAI,WAAW,sBAAsB,GAAG,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAA;AAC9F,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addBasePath.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/addBasePath.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"addBasePath.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/addBasePath.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAEjD,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,WAAW,GAAG,WAAW,CASrF"}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
});
|
|
14
|
-
}
|
|
1
|
+
import { timeProfile } from './timeProfier.js';
|
|
2
|
+
export function addBasePath(base, items) {
|
|
3
|
+
return timeProfile('add base to globs', () => {
|
|
4
|
+
if (base !== undefined && base !== '.' && base !== '') {
|
|
5
|
+
return Array.isArray(items)
|
|
6
|
+
? items.map(item => `${base}/${item}`)
|
|
7
|
+
: `${base}/${items}`;
|
|
8
|
+
}
|
|
9
|
+
return items;
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=addBasePath.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addBasePath.js","sourceRoot":"","sources":["../../../src/cli/lib/addBasePath.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"addBasePath.js","sourceRoot":"","sources":["../../../src/cli/lib/addBasePath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAI9C,MAAM,UAAU,WAAW,CAAC,IAAwB,EAAE,KAAkB;IACpE,OAAO,WAAW,CAAC,mBAAmB,EAAE,GAAG,EAAE;QACzC,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,EAAE,EAAE,CAAC;YACpD,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;gBACvB,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,IAAI,IAAI,EAAE,CAAC;gBACtC,CAAC,CAAC,GAAG,IAAI,IAAI,KAAK,EAAE,CAAA;QAC5B,CAAC;QACD,OAAO,KAAK,CAAA;IAChB,CAAC,CAAC,CAAA;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addBasePath.unitTest.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/addBasePath.unitTest.ts"],"names":[],"mappings":""}
|
|
@@ -1,33 +1,55 @@
|
|
|
1
1
|
import { addBasePath } from './addBasePath.js';
|
|
2
|
-
import { join } from 'path';
|
|
3
|
-
|
|
4
2
|
// addBaseToGlobs(base, globs)
|
|
5
3
|
// base: string
|
|
6
4
|
// globs: string or array of strings
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
5
|
+
mochaDescribe('addBaseToGlobs() function', function () {
|
|
6
|
+
mochaIt('adds a base to a glob string', function () {
|
|
7
|
+
const result = addBasePath('src', '**/*.js');
|
|
8
|
+
result.should.equal('src/**/*.js');
|
|
9
|
+
});
|
|
10
|
+
mochaIt('adds a base to an array of glob strings', function () {
|
|
11
|
+
const result = addBasePath('src', [
|
|
12
|
+
'**/*.test.js',
|
|
13
|
+
'**/*.mocha.js'
|
|
14
|
+
]);
|
|
15
|
+
result.should.have.members([
|
|
16
|
+
'src/**/*.test.js',
|
|
17
|
+
'src/**/*.mocha.js'
|
|
18
|
+
]);
|
|
19
|
+
});
|
|
20
|
+
mochaIt('it handles an empty string base', function () {
|
|
21
|
+
const result = addBasePath('', [
|
|
22
|
+
'**/*.test.js',
|
|
23
|
+
'**/*.mocha.js'
|
|
24
|
+
]);
|
|
25
|
+
result.should.have.members([
|
|
26
|
+
'**/*.test.js',
|
|
27
|
+
'**/*.mocha.js'
|
|
28
|
+
]);
|
|
29
|
+
});
|
|
30
|
+
mochaIt('it handles a . base', function () {
|
|
31
|
+
const result = addBasePath('.', [
|
|
32
|
+
'**/*.test.js',
|
|
33
|
+
'**/*.mocha.js'
|
|
34
|
+
]);
|
|
35
|
+
result.should.have.members([
|
|
36
|
+
'**/*.test.js',
|
|
37
|
+
'**/*.mocha.js'
|
|
38
|
+
]);
|
|
39
|
+
});
|
|
40
|
+
mochaIt('it handles an undefined base', function () {
|
|
41
|
+
const result = addBasePath(undefined, [
|
|
42
|
+
'**/*.test.js',
|
|
43
|
+
'**/*.mocha.js'
|
|
44
|
+
]);
|
|
45
|
+
result.should.have.members([
|
|
46
|
+
'**/*.test.js',
|
|
47
|
+
'**/*.mocha.js'
|
|
48
|
+
]);
|
|
49
|
+
});
|
|
50
|
+
mochaIt('it handles adding a base to a file path', function () {
|
|
51
|
+
const result = addBasePath('base', 'test/file.js');
|
|
52
|
+
result.should.equal('base/test/file.js');
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
//# sourceMappingURL=addBasePath.unitTest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addBasePath.unitTest.js","sourceRoot":"","sources":["../../../src/cli/lib/addBasePath.unitTest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,8BAA8B;AAC9B,eAAe;AACf,oCAAoC;AAEpC,aAAa,CAAC,2BAA2B,EAAE;IACvC,OAAO,CAAC,8BAA8B,EAAE;QACpC,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,EAAE,SAAS,CAAC,CAAA;QAE5C,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;IACtC,CAAC,CAAC,CAAA;IAEF,OAAO,CAAC,yCAAyC,EAAE;QAC/C,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,EAAE;YAC9B,cAAc;YACd,eAAe;SAClB,CAAC,CAAA;QAEF,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;YACvB,kBAAkB;YAClB,mBAAmB;SACtB,CAAC,CAAA;IACN,CAAC,CAAC,CAAA;IAEF,OAAO,CAAC,iCAAiC,EAAE;QACvC,MAAM,MAAM,GAAG,WAAW,CAAC,EAAE,EAAE;YAC3B,cAAc;YACd,eAAe;SAClB,CAAC,CAAA;QAEF,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;YACvB,cAAc;YACd,eAAe;SAClB,CAAC,CAAA;IACN,CAAC,CAAC,CAAA;IAEF,OAAO,CAAC,qBAAqB,EAAE;QAC3B,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,EAAE;YAC5B,cAAc;YACd,eAAe;SAClB,CAAC,CAAA;QAEF,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;YACvB,cAAc;YACd,eAAe;SAClB,CAAC,CAAA;IACN,CAAC,CAAC,CAAA;IAEF,OAAO,CAAC,8BAA8B,EAAE;QACpC,MAAM,MAAM,GAAG,WAAW,CAAC,SAAS,EAAE;YAClC,cAAc;YACd,eAAe;SAClB,CAAC,CAAA;QAEF,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;YACvB,cAAc;YACd,eAAe;SAClB,CAAC,CAAA;IACN,CAAC,CAAC,CAAA;IAEF,OAAO,CAAC,yCAAyC,EAAE;QAC/C,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;QAElD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAA;IAC5C,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,CAAA"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { out
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { out } from '../../output.js';
|
|
2
|
+
export function addExports(exports, newProperties, event, from) {
|
|
3
|
+
for (const key in newProperties) {
|
|
4
|
+
if (key in exports) {
|
|
5
|
+
const message = `Error loading '${event}' task exports, key '${key}' has already been exported`;
|
|
6
|
+
out(message);
|
|
7
|
+
throw new Error(message);
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
exports[key] = newProperties[key];
|
|
11
|
+
}
|
|
10
12
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=addExports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addExports.unitTest.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/addExports.unitTest.ts"],"names":[],"mappings":""}
|
|
@@ -1,32 +1,17 @@
|
|
|
1
1
|
import { expect } from 'chai';
|
|
2
|
-
import { defaultConfig } from './defaultConfig.js';
|
|
3
2
|
import { addExports } from './addExports.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
//const { customOut, getOutBuffer, setOutBuffer } = makeCustomOut()
|
|
20
|
-
|
|
21
|
-
const exports = {
|
|
22
|
-
a: 1,
|
|
23
|
-
b: 2
|
|
24
|
-
};
|
|
25
|
-
const newProperties = {
|
|
26
|
-
a: 3,
|
|
27
|
-
b: 4
|
|
28
|
-
};
|
|
29
|
-
const errorText = 'already been exported';
|
|
30
|
-
await addExports(exports, newProperties, 'placeholder', 'placeholder').should.be.rejectedWith(errorText);
|
|
31
|
-
});
|
|
32
|
-
});
|
|
3
|
+
mochaDescribe('addExports() function', function () {
|
|
4
|
+
mochaIt('should add passed properties to a base object', function () {
|
|
5
|
+
const exports = {};
|
|
6
|
+
const newProperties = { a: 1, b: 2 };
|
|
7
|
+
addExports(exports, newProperties);
|
|
8
|
+
exports.should.have.keys(['a', 'b']);
|
|
9
|
+
});
|
|
10
|
+
mochaIt('should complain about duplicates', function () {
|
|
11
|
+
const exports = { a: 1, b: 2 };
|
|
12
|
+
const newProperties = { a: 3, b: 4 };
|
|
13
|
+
const errorText = 'already been exported';
|
|
14
|
+
expect(() => addExports(exports, newProperties, 'placeholder', 'placeholder')).to.throw(errorText);
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=addExports.unitTest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addExports.unitTest.js","sourceRoot":"","sources":["../../../src/cli/lib/addExports.unitTest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAE7B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,aAAa,CAAC,uBAAuB,EAAE;IACnC,OAAO,CAAC,+CAA+C,EAAE;QACrD,MAAM,OAAO,GAA4B,EAAE,CAAA;QAE3C,MAAM,aAAa,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAA;QAEpC,UAAU,CAAC,OAAO,EAAE,aAAa,CAAC,CAAA;QAElC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAA;IACxC,CAAC,CAAC,CAAA;IAEF,OAAO,CAAC,kCAAkC,EAAE;QACxC,MAAM,OAAO,GAA4B,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAA;QAEvD,MAAM,aAAa,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAA;QAEpC,MAAM,SAAS,GAAG,uBAAuB,CAAA;QAEzC,MAAM,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;IACtG,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,CAAA"}
|
|
@@ -1,46 +1,10 @@
|
|
|
1
|
-
import { mergeStructuredConfig
|
|
2
|
-
import { objectCopy } from 'sxy-lib-object-copy';
|
|
3
|
-
import { packageName, cliName, configFileName, configLocations, showTimeProfiling } from '../../config.js';
|
|
4
|
-
//import chalk from 'chalk-extensions'
|
|
5
|
-
//import { out, log, debug } from '../../output.js'
|
|
6
|
-
|
|
1
|
+
import { mergeStructuredConfig } from '../../packages/mergeStructuredConfig.js';
|
|
7
2
|
import { defaultConfig } from './defaultConfig.js';
|
|
8
|
-
|
|
9
|
-
timeProfileAsync
|
|
10
|
-
} = await createTimeProfiler(showTimeProfiling);
|
|
11
|
-
export async function applyConfigDefaults(userConfig) {
|
|
12
|
-
return await timeProfileAsync('apply config defaults', async () => {
|
|
3
|
+
export function applyConfigDefaults(userConfig) {
|
|
13
4
|
const configStructure = {
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
execution: {},
|
|
6
|
+
watch: {}
|
|
16
7
|
};
|
|
17
|
-
|
|
18
|
-
//const config = mergeConfig(configStructure, defaultConfig, userConfig)
|
|
19
|
-
const config = await mergeStructuredConfig(configStructure, defaultConfig, userConfig);
|
|
20
|
-
|
|
21
|
-
// I don't think we need to do these - the glob combine func can handle it
|
|
22
|
-
//if ( ! Array.isArray(config.tests) ) config.tests = [config.tests]
|
|
23
|
-
//if ( ! Array.isArray(config.testsIgnore) ) config.tests = [config.testsIgnore]
|
|
24
|
-
// watchFiles
|
|
25
|
-
// watchFilesIgnore
|
|
26
|
-
|
|
27
|
-
//log('final config', config)
|
|
28
|
-
|
|
29
|
-
return config;
|
|
30
|
-
});
|
|
8
|
+
return mergeStructuredConfig(configStructure, defaultConfig, userConfig);
|
|
31
9
|
}
|
|
32
|
-
|
|
33
|
-
// is this an old func now replaced?
|
|
34
|
-
async function mergeConfig(structure, baseConfig, ...extraConfigs) {
|
|
35
|
-
const finalConfig = await objectCopy(baseConfig);
|
|
36
|
-
for (const extraConfig of extraConfigs) {
|
|
37
|
-
for (const key in extraConfig) {
|
|
38
|
-
if (key in structure) {
|
|
39
|
-
finalConfig[key] = await mergeConfig(structure[key], finalConfig[key], extraConfig[key]);
|
|
40
|
-
} else {
|
|
41
|
-
finalConfig[key] = extraConfig[key];
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return finalConfig;
|
|
46
|
-
}
|
|
10
|
+
//# sourceMappingURL=applyConfigDefaults.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applyConfigDefaults.js","sourceRoot":"","sources":["../../../src/cli/lib/applyConfigDefaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"applyConfigDefaults.js","sourceRoot":"","sources":["../../../src/cli/lib/applyConfigDefaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAA;AAI/E,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAElD,MAAM,UAAU,mBAAmB,CAAC,UAAsB;IACtD,MAAM,eAAe,GAAG;QACpB,SAAS,EAAE,EAAE;QACb,KAAK,EAAE,EAAE;KACZ,CAAA;IAED,OAAO,qBAAqB,CAAC,eAAe,EAAE,aAAa,EAAE,UAAU,CAAC,CAAA;AAC5E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyConfigDefaults.unitTest.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/applyConfigDefaults.unitTest.ts"],"names":[],"mappings":""}
|
|
@@ -1,31 +1,23 @@
|
|
|
1
1
|
import { defaultConfig } from './defaultConfig.js';
|
|
2
2
|
import { applyConfigDefaults } from './applyConfigDefaults.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
await mochaIt('has sensible defaults when passed an empty user config', async function () {
|
|
8
|
-
const finalConfig = await applyConfigDefaults({});
|
|
9
|
-
await finalConfig.should.include.keys(['tests', 'testsIgnore', 'watch']);
|
|
10
|
-
});
|
|
11
|
-
await mochaIt('retains a passed config setting', async function () {
|
|
12
|
-
const finalConfig = await applyConfigDefaults({
|
|
13
|
-
tests: 'foo'
|
|
3
|
+
mochaDescribe('applyConfigDefaults() function', function () {
|
|
4
|
+
mochaIt('has sensible defaults when passed an empty user config', function () {
|
|
5
|
+
const finalConfig = applyConfigDefaults({});
|
|
6
|
+
finalConfig.should.include.keys(['tests', 'testsIgnore', 'watch']);
|
|
14
7
|
});
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
await mochaIt('fills in defaults in a watch object with missing params', async function () {
|
|
21
|
-
const finalConfig = await applyConfigDefaults({
|
|
22
|
-
watch: {
|
|
23
|
-
watchFilesBase: 'src'
|
|
24
|
-
}
|
|
8
|
+
mochaIt('retains a passed config setting', function () {
|
|
9
|
+
const finalConfig = applyConfigDefaults({
|
|
10
|
+
tests: 'foo'
|
|
11
|
+
});
|
|
12
|
+
finalConfig.tests.should.equal('foo');
|
|
25
13
|
});
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
});
|
|
14
|
+
mochaIt('fills in defaults in a watch object with missing params', function () {
|
|
15
|
+
const finalConfig = applyConfigDefaults({
|
|
16
|
+
watch: {
|
|
17
|
+
watchFilesBase: 'src'
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
finalConfig.watch.watchFiles.should.equal(defaultConfig.watch.watchFiles);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=applyConfigDefaults.unitTest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyConfigDefaults.unitTest.js","sourceRoot":"","sources":["../../../src/cli/lib/applyConfigDefaults.unitTest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAE9D,aAAa,CAAC,gCAAgC,EAAE;IAC5C,OAAO,CAAC,wDAAwD,EAAE;QAC9D,MAAM,WAAW,GAAG,mBAAmB,CAAC,EAAE,CAAC,CAAA;QAE3C,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC,CAAA;IACtE,CAAC,CAAC,CAAA;IAEF,OAAO,CAAC,iCAAiC,EAAE;QACvC,MAAM,WAAW,GAAG,mBAAmB,CAAC;YACpC,KAAK,EAAE,KAAK;SACf,CAAC,CAAA;QAEF,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IACzC,CAAC,CAAC,CAAA;IAEF,OAAO,CAAC,yDAAyD,EAAE;QAC/D,MAAM,WAAW,GAAG,mBAAmB,CAAC;YACpC,KAAK,EAAE;gBACH,cAAc,EAAE,KAAK;aACxB;SACJ,CAAC,CAAA;QAEF,WAAW,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;IAC7E,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,CAAA"}
|
|
@@ -1,35 +1,24 @@
|
|
|
1
1
|
import dependencyTree from 'dependency-tree';
|
|
2
|
-
import {
|
|
3
|
-
import slash from 'slash';
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
await dt.process(file => slash(file).slice(cwd.length + 1));
|
|
26
|
-
|
|
27
|
-
// remove the current file
|
|
28
|
-
await dt.forEach(file => {
|
|
29
|
-
if (file === filename) {
|
|
30
|
-
dt.remove(file); // arrayRemove?
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
await debug('found dep tree', dt);
|
|
34
|
-
return dt;
|
|
35
|
-
}
|
|
2
|
+
import { debug } from '../../output.js';
|
|
3
|
+
import slash from '../../packages/slash.js';
|
|
4
|
+
export function buildDependencyTree(config, filename) {
|
|
5
|
+
filename = slash(filename);
|
|
6
|
+
const dependencyTreeConfig = {
|
|
7
|
+
filename,
|
|
8
|
+
isListForm: true,
|
|
9
|
+
directory: config.watch.watchFilesBase,
|
|
10
|
+
filter: (path) => path.indexOf('node_modules') === -1
|
|
11
|
+
};
|
|
12
|
+
// isListForm:true makes dependency-tree return a flat string[] at runtime,
|
|
13
|
+
// which its shipped types don't model (they only type the tree-object form).
|
|
14
|
+
const dt = dependencyTree(dependencyTreeConfig);
|
|
15
|
+
// process the results into final format
|
|
16
|
+
// (forward slashes and convert full path to rel path)
|
|
17
|
+
const cwd = process.cwd();
|
|
18
|
+
const processed = dt
|
|
19
|
+
.map(file => slash(file).slice(cwd.length + 1))
|
|
20
|
+
.filter(file => file !== filename); // remove the current file
|
|
21
|
+
debug('found dep tree', processed);
|
|
22
|
+
return processed;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=buildDependencyTree.js.map
|