sxy-test-runner 2.2.17 → 2.3.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/lib/buildDependencyTrees.d.ts +1 -1
- package/dist/cli/lib/buildDependencyTrees.d.ts.map +1 -1
- package/dist/cli/lib/buildDependencyTrees.js.map +1 -1
- package/dist/cli/lib/buildDependencyTrees.unitTest.js +1 -1
- package/dist/cli/lib/buildDependencyTrees.unitTest.js.map +1 -1
- package/dist/cli/lib/findTestFiles.d.ts +1 -1
- package/dist/cli/lib/findTestFiles.d.ts.map +1 -1
- package/dist/cli/lib/findTestFiles.js +3 -3
- package/dist/cli/lib/findTestFiles.js.map +1 -1
- package/dist/cli/lib/findTestFiles.unitTest.js +2 -2
- package/dist/cli/lib/findTestFiles.unitTest.js.map +1 -1
- package/dist/cli/lib/handleUserInput.d.ts +4 -0
- package/dist/cli/lib/handleUserInput.d.ts.map +1 -0
- package/dist/cli/lib/handleUserInput.js +32 -0
- package/dist/cli/lib/handleUserInput.js.map +1 -0
- package/dist/cli/lib/handleUserInput.unitTest.d.ts +2 -0
- package/dist/cli/lib/handleUserInput.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/handleUserInput.unitTest.js +99 -0
- package/dist/cli/lib/handleUserInput.unitTest.js.map +1 -0
- package/dist/cli/lib/listenToUser.d.ts +4 -5
- package/dist/cli/lib/listenToUser.d.ts.map +1 -1
- package/dist/cli/lib/listenToUser.js +13 -28
- package/dist/cli/lib/listenToUser.js.map +1 -1
- package/dist/cli/lib/listenToUser.unitTest.js +17 -41
- package/dist/cli/lib/listenToUser.unitTest.js.map +1 -1
- package/dist/cli/lib/makeWatchRunState.d.ts +11 -0
- package/dist/cli/lib/makeWatchRunState.d.ts.map +1 -0
- package/dist/cli/lib/makeWatchRunState.js +19 -0
- package/dist/cli/lib/makeWatchRunState.js.map +1 -0
- package/dist/cli/lib/reRunManager.d.ts +18 -0
- package/dist/cli/lib/reRunManager.d.ts.map +1 -0
- package/dist/cli/lib/reRunManager.js +67 -0
- package/dist/cli/lib/reRunManager.js.map +1 -0
- package/dist/cli/lib/reRunManager.unitTest.d.ts +2 -0
- package/dist/cli/lib/reRunManager.unitTest.d.ts.map +1 -0
- package/dist/cli/lib/reRunManager.unitTest.js +74 -0
- package/dist/cli/lib/reRunManager.unitTest.js.map +1 -0
- package/dist/cli/lib/runDescribeRun.d.ts.map +1 -1
- package/dist/cli/lib/runDescribeRun.js.map +1 -1
- package/dist/cli/lib/runTests.d.ts +4 -2
- package/dist/cli/lib/runTests.d.ts.map +1 -1
- package/dist/cli/lib/runTests.js +14 -17
- package/dist/cli/lib/runTests.js.map +1 -1
- package/dist/cli/lib/runTests.unitTest.d.ts.map +1 -1
- package/dist/cli/lib/runTests.unitTest.js +31 -33
- package/dist/cli/lib/runTests.unitTest.js.map +1 -1
- package/dist/cli/lib/watchFilesAndRunTests.unitTest.js +15 -7
- package/dist/cli/lib/watchFilesAndRunTests.unitTest.js.map +1 -1
- package/dist/cli/lib/watchFilesAndRunTestsChokidar.d.ts +1 -2
- package/dist/cli/lib/watchFilesAndRunTestsChokidar.d.ts.map +1 -1
- package/dist/cli/lib/watchFilesAndRunTestsChokidar.js +130 -111
- package/dist/cli/lib/watchFilesAndRunTestsChokidar.js.map +1 -1
- package/dist/cli/lib/watchFilesAndRunTestsChokidar.unitTest.js +125 -122
- package/dist/cli/lib/watchFilesAndRunTestsChokidar.unitTest.js.map +1 -1
- package/dist/cli/lib/watchFilesAndRunTestsNodeWatch.d.ts +3 -2
- package/dist/cli/lib/watchFilesAndRunTestsNodeWatch.d.ts.map +1 -1
- package/dist/cli/lib/watchFilesAndRunTestsNodeWatch.js +25 -9
- package/dist/cli/lib/watchFilesAndRunTestsNodeWatch.js.map +1 -1
- package/dist/cli/lib/watchFilesAndRunTestsNodeWatch.unitTest.js +15 -7
- package/dist/cli/lib/watchFilesAndRunTestsNodeWatch.unitTest.js.map +1 -1
- package/dist/cli/once.d.ts.map +1 -1
- package/dist/cli/once.js +3 -3
- package/dist/cli/once.js.map +1 -1
- package/dist/cli/watch.d.ts.map +1 -1
- package/dist/cli/watch.js +26 -18
- package/dist/cli/watch.js.map +1 -1
- package/dist/testing/makeTestReRunManager.d.ts +4 -0
- package/dist/testing/makeTestReRunManager.d.ts.map +1 -0
- package/dist/testing/makeTestReRunManager.js +6 -0
- package/dist/testing/makeTestReRunManager.js.map +1 -0
- package/dist/types.d.ts +0 -4
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -6
|
@@ -1,112 +1,131 @@
|
|
|
1
|
-
import { createTimeProfiler } from '../../packages/timeProfiler.js'
|
|
2
|
-
import { showTimeProfiling } from '../../config.js'
|
|
3
|
-
import chalk from '../../packages/chalk.js'
|
|
4
|
-
import minimatch from 'minimatch'
|
|
5
|
-
import slash from '../../packages/slash.js'
|
|
6
|
-
import { out, log, debug } from '../../output.js'
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
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
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
1
|
+
// import { createTimeProfiler } from '../../packages/timeProfiler.js'
|
|
2
|
+
// import { showTimeProfiling } from '../../config.js'
|
|
3
|
+
// import chalk from '../../packages/chalk.js'
|
|
4
|
+
// import minimatch from 'minimatch'
|
|
5
|
+
// import slash from '../../packages/slash.js'
|
|
6
|
+
// import { out, log, debug } from '../../output.js'
|
|
7
|
+
export {};
|
|
8
|
+
// import { runTests } from './runTests.js'
|
|
9
|
+
// import { buildDependencyTree } from './buildDependencyTree.js'
|
|
10
|
+
// import { globArgCombine } from './globArgCombine.js'
|
|
11
|
+
// import { watchFilesChokidar } from './watchFilesChokidar.js'
|
|
12
|
+
// import { filter } from './filter.js'
|
|
13
|
+
// import { remove as arrayRemove } from 'sxy-lib/arrays.js'
|
|
14
|
+
// import type { FinalConfig, DependencyTrees, OutFn, TestExecutionFilters } from '../../types.js'
|
|
15
|
+
// import { ReRunManageState } from './makeWatchRunState.js'
|
|
16
|
+
// import { ReRunManager } from './reRunManager.js'
|
|
17
|
+
// const { timeProfileAsync } = createTimeProfiler(showTimeProfiling)
|
|
18
|
+
// export async function watchFilesAndRunTestsChokidar(
|
|
19
|
+
// config: FinalConfig,
|
|
20
|
+
// testFiles: string[],
|
|
21
|
+
// dependencyTrees: DependencyTrees,
|
|
22
|
+
// failingTests: string[],
|
|
23
|
+
// reRunManager: ReRunManager, // still needs to be incopr
|
|
24
|
+
// watchRunState: ReRunManageState,
|
|
25
|
+
// customOut?: OutFn,
|
|
26
|
+
// executionFilters: TestExecutionFilters = {}
|
|
27
|
+
// ): Promise<void> {
|
|
28
|
+
// const projectDir = process.cwd()
|
|
29
|
+
// await timeProfileAsync('start watching', async () => {
|
|
30
|
+
// let changedFiles: Array<[string, string]> = []
|
|
31
|
+
// let timeout: ReturnType<typeof setTimeout> | null = null
|
|
32
|
+
// const testFilter = (file: string): boolean => {
|
|
33
|
+
// return minimatch(file, globArgCombine(config.tests))
|
|
34
|
+
// && !minimatch(file, globArgCombine(config.testsIgnore))
|
|
35
|
+
// && (
|
|
36
|
+
// config.testsFilter === undefined
|
|
37
|
+
// || config.testsFilter === ''
|
|
38
|
+
// || filter(config.testsBase, config.testsFilter, file)
|
|
39
|
+
// )
|
|
40
|
+
// }
|
|
41
|
+
// // start watching
|
|
42
|
+
// await watchFilesChokidar(config, watchEvent)
|
|
43
|
+
// function watchEvent(filename: string, event: string): void {
|
|
44
|
+
// debug('chokidar watch event', filename, event)
|
|
45
|
+
// // remove dep tree for any tests that are deleted, avoiding trying to run it later
|
|
46
|
+
// if (event === 'remove' && filename in dependencyTrees) {
|
|
47
|
+
// arrayRemove(testFiles, filename)
|
|
48
|
+
// delete dependencyTrees[filename]
|
|
49
|
+
// }
|
|
50
|
+
// // info on the event found
|
|
51
|
+
// out(chalk.grey`change: ${filename} (${event})`)
|
|
52
|
+
// // add the file to changed files
|
|
53
|
+
// changedFiles.push([filename, event])
|
|
54
|
+
// // wait 100ms after any change before processing, to avoid multiple execution?
|
|
55
|
+
// if (timeout) {
|
|
56
|
+
// clearTimeout(timeout)
|
|
57
|
+
// }
|
|
58
|
+
// timeout = setTimeout(() => {
|
|
59
|
+
// void timeProfileAsync('handle changed files', async () => {
|
|
60
|
+
// debug('changed files', changedFiles)
|
|
61
|
+
// try {
|
|
62
|
+
// // build related test list
|
|
63
|
+
// const tests: string[] = []
|
|
64
|
+
// for (const [file, fileEvent] of changedFiles) {
|
|
65
|
+
// debug('check', file)
|
|
66
|
+
// debug('1 tests', tests)
|
|
67
|
+
// if (fileEvent !== 'remove') { // only check if it's a test if it exists (has not just been removed)
|
|
68
|
+
// if (testFilter(file)) { // it is a test file itself, add to run list
|
|
69
|
+
// debug('its a test', file)
|
|
70
|
+
// tests.push(file)
|
|
71
|
+
// if (!(file in dependencyTrees)) { // if its a new test
|
|
72
|
+
// debug('try to add a new test', file)
|
|
73
|
+
// addNewTest(file)
|
|
74
|
+
// }
|
|
75
|
+
// }
|
|
76
|
+
// }
|
|
77
|
+
// debug('dtrees', dependencyTrees)
|
|
78
|
+
// debug('2 tests', tests)
|
|
79
|
+
// for (const f of Object.getOwnPropertyNames(dependencyTrees)) {
|
|
80
|
+
// debug('dep tree', f, dependencyTrees[f])
|
|
81
|
+
// if (dependencyTrees[f]?.some(dep => dep === file) === true) { // a test depends on this file
|
|
82
|
+
// debug('its a dependency', file)
|
|
83
|
+
// tests.push(f)
|
|
84
|
+
// }
|
|
85
|
+
// }
|
|
86
|
+
// }
|
|
87
|
+
// changedFiles = []
|
|
88
|
+
// debug('tests', tests)
|
|
89
|
+
// if (tests.length) {
|
|
90
|
+
// await timeProfileAsync('run tests related to changes', async () => {
|
|
91
|
+
// debug('tests', tests)
|
|
92
|
+
// debug('tests', tests)
|
|
93
|
+
// debug('failingTests', failingTests)
|
|
94
|
+
// debug('reRunFailingTests', config.watch.reRunFailingTests)
|
|
95
|
+
// const toTest = config.watch.reRunFailingTests
|
|
96
|
+
// ? [...new Set([...tests, ...failingTests])].reverse()
|
|
97
|
+
// : [...tests].reverse()
|
|
98
|
+
// debug('run tests on change')
|
|
99
|
+
// debug('toTest', toTest)
|
|
100
|
+
// watchRunState.currentRun = runTests(
|
|
101
|
+
// config,
|
|
102
|
+
// toTest,
|
|
103
|
+
// failingTests,
|
|
104
|
+
// 'refresh',
|
|
105
|
+
// watchRunState,
|
|
106
|
+
// customOut,
|
|
107
|
+
// executionFilters
|
|
108
|
+
// )
|
|
109
|
+
// await watchRunState.currentRun
|
|
110
|
+
// })
|
|
111
|
+
// }
|
|
112
|
+
// } catch (e) {
|
|
113
|
+
// log('watch handler error', e)
|
|
114
|
+
// }
|
|
115
|
+
// })
|
|
116
|
+
// }, 33)
|
|
117
|
+
// } // end of watch event
|
|
118
|
+
// function addNewTest(testFile: string): void {
|
|
119
|
+
// debug('new test', testFile)
|
|
120
|
+
// const dependencyTree = buildDependencyTree(config, testFile)
|
|
121
|
+
// dependencyTrees[testFile] = dependencyTree
|
|
122
|
+
// .map(file => slash(file).slice(projectDir.length + 1))
|
|
123
|
+
// .filter(f => f !== testFile)
|
|
124
|
+
// }
|
|
125
|
+
// })
|
|
126
|
+
// // NOTE: "watching..." is intentionally NOT printed here. watch() already emits it,
|
|
127
|
+
// // tied to a real milestone (the initial test run finishing, or no tests found).
|
|
128
|
+
// // Printing it again here produced a duplicate "watching..." on every startup.
|
|
129
|
+
// // out(chalk.brightblue`watching...`)
|
|
130
|
+
// }
|
|
112
131
|
//# sourceMappingURL=watchFilesAndRunTestsChokidar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watchFilesAndRunTestsChokidar.js","sourceRoot":"","sources":["../../../src/cli/lib/watchFilesAndRunTestsChokidar.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"watchFilesAndRunTestsChokidar.js","sourceRoot":"","sources":["../../../src/cli/lib/watchFilesAndRunTestsChokidar.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,sDAAsD;AACtD,8CAA8C;AAC9C,oCAAoC;AACpC,8CAA8C;AAC9C,oDAAoD;;AAEpD,2CAA2C;AAC3C,iEAAiE;AACjE,uDAAuD;AACvD,+DAA+D;AAC/D,uCAAuC;AACvC,4DAA4D;AAE5D,kGAAkG;AAClG,4DAA4D;AAC5D,mDAAmD;AAEnD,qEAAqE;AAErE,uDAAuD;AACvD,2BAA2B;AAC3B,2BAA2B;AAC3B,wCAAwC;AACxC,8BAA8B;AAC9B,8DAA8D;AAC9D,uCAAuC;AACvC,yBAAyB;AACzB,kDAAkD;AAClD,qBAAqB;AACrB,uCAAuC;AAEvC,6DAA6D;AAC7D,yDAAyD;AACzD,mEAAmE;AAEnE,0DAA0D;AAC1D,mEAAmE;AACnE,0EAA0E;AAC1E,uBAAuB;AACvB,uDAAuD;AACvD,mDAAmD;AACnD,4EAA4E;AAC5E,oBAAoB;AACpB,YAAY;AAEZ,4BAA4B;AAC5B,uDAAuD;AAEvD,uEAAuE;AACvE,6DAA6D;AAE7D,iGAAiG;AACjG,uEAAuE;AACvE,mDAAmD;AACnD,mDAAmD;AACnD,gBAAgB;AAEhB,yCAAyC;AACzC,8DAA8D;AAE9D,+CAA+C;AAC/C,mDAAmD;AAEnD,6FAA6F;AAC7F,6BAA6B;AAC7B,wCAAwC;AACxC,gBAAgB;AAEhB,2CAA2C;AAC3C,8EAA8E;AAC9E,2DAA2D;AAC3D,4BAA4B;AAC5B,qDAAqD;AACrD,qDAAqD;AACrD,0EAA0E;AAC1E,mDAAmD;AACnD,sDAAsD;AACtD,kIAAkI;AAClI,uGAAuG;AACvG,gEAAgE;AAChE,uDAAuD;AACvD,6FAA6F;AAC7F,+EAA+E;AAC/E,2DAA2D;AAC3D,wCAAwC;AACxC,oCAAoC;AACpC,gCAAgC;AAChC,+DAA+D;AAC/D,sDAAsD;AACtD,6FAA6F;AAC7F,2EAA2E;AAC3E,+HAA+H;AAC/H,sEAAsE;AACtE,oDAAoD;AACpD,oCAAoC;AACpC,gCAAgC;AAChC,4BAA4B;AAE5B,4CAA4C;AAE5C,gDAAgD;AAEhD,8CAA8C;AAC9C,mGAAmG;AACnG,wDAAwD;AAExD,wDAAwD;AACxD,sEAAsE;AACtE,6FAA6F;AAE7F,gFAAgF;AAChF,4FAA4F;AAC5F,6DAA6D;AAE7D,+DAA+D;AAC/D,0DAA0D;AAE1D,uEAAuE;AACvE,8CAA8C;AAC9C,8CAA8C;AAC9C,oDAAoD;AACpD,iDAAiD;AACjD,qDAAqD;AACrD,iDAAiD;AACjD,uDAAuD;AACvD,oCAAoC;AACpC,iEAAiE;AACjE,iCAAiC;AACjC,4BAA4B;AAC5B,oCAAoC;AACpC,wDAAwD;AACxD,wBAAwB;AACxB,qBAAqB;AACrB,qBAAqB;AACrB,kCAAkC;AAElC,wDAAwD;AACxD,0CAA0C;AAC1C,2EAA2E;AAC3E,yDAAyD;AACzD,yEAAyE;AACzE,+CAA+C;AAC/C,YAAY;AACZ,SAAS;AAET,0FAA0F;AAC1F,uFAAuF;AACvF,qFAAqF;AACrF,4CAA4C;AAC5C,IAAI"}
|
|
@@ -1,123 +1,126 @@
|
|
|
1
|
-
import { promises as fs, existsSync } from 'fs'
|
|
2
|
-
import figures from '../../packages/figures.js'
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
should()
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
should()
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
1
|
+
// import { promises as fs, existsSync } from 'fs'
|
|
2
|
+
// import figures from '../../packages/figures.js'
|
|
3
|
+
export {};
|
|
4
|
+
// import { watchFilesAndRunTestsChokidar } from './watchFilesAndRunTestsChokidar.js'
|
|
5
|
+
// import { applyConfigDefaults } from './applyConfigDefaults.js'
|
|
6
|
+
// import type { DependencyTrees } from '../../types.js'
|
|
7
|
+
// import { makeRunManagerState } from './makeWatchRunState.js'
|
|
8
|
+
// mochaDescribe('watchFilesAndRunTestsChokidar() function', function () {
|
|
9
|
+
// const tempFolder = 'watchTests/watchFilesAndRunTestsChokidar'
|
|
10
|
+
// const baseConfig = applyConfigDefaults({
|
|
11
|
+
// testsBase: tempFolder,
|
|
12
|
+
// tests: '**/*.test.js',
|
|
13
|
+
// watch: {
|
|
14
|
+
// watchFilesBase: tempFolder,
|
|
15
|
+
// watchFiles: '**/*.js'
|
|
16
|
+
// }
|
|
17
|
+
// })
|
|
18
|
+
// mochaIt('should run a test when a test file is changed', async function () {
|
|
19
|
+
// const config = structuredClone(baseConfig)
|
|
20
|
+
// // ignore the file from the last test, causing load errors
|
|
21
|
+
// config.testsIgnore = '**/c.test.js'
|
|
22
|
+
// // create a custom out function to capture the output
|
|
23
|
+
// let outBuffer = ''
|
|
24
|
+
// const customOut = (...texts: unknown[]): void => {
|
|
25
|
+
// outBuffer += texts.join(' ') + '\n'
|
|
26
|
+
// }
|
|
27
|
+
// const testFileName = 'watchTests/watchFilesAndRunTestsChokidar/a.test.js'
|
|
28
|
+
// const thing = 'Sample test 1'
|
|
29
|
+
// const should = '1 should equal 1'
|
|
30
|
+
// await watchFilesAndRunTestsChokidar(config, [], {}, [], makeRunManagerState(), customOut)
|
|
31
|
+
// outBuffer.should.equal('')
|
|
32
|
+
// void fs.writeFile(
|
|
33
|
+
// testFileName,
|
|
34
|
+
// `import { describe } from '../../dist/index.js'
|
|
35
|
+
// import { expect, should } from 'chai'
|
|
36
|
+
// should()
|
|
37
|
+
// describe('${thing}', ({it}) => {
|
|
38
|
+
// it('${should}', () => {
|
|
39
|
+
// expect(1).to.equal(1)
|
|
40
|
+
// })
|
|
41
|
+
// })`
|
|
42
|
+
// )
|
|
43
|
+
// await new Promise<void>(resolve => setTimeout(resolve, 1000))
|
|
44
|
+
// outBuffer.should.include(testFileName)
|
|
45
|
+
// outBuffer.should.include(thing)
|
|
46
|
+
// outBuffer.should.include(should)
|
|
47
|
+
// outBuffer.should.include(figures.tick)
|
|
48
|
+
// })
|
|
49
|
+
// mochaIt('should run a test when a new test file is changed', async function () {
|
|
50
|
+
// const config = structuredClone(baseConfig)
|
|
51
|
+
// // ignore the file from the last test, causing load errors
|
|
52
|
+
// config.testsIgnore = '**/c.test.js'
|
|
53
|
+
// // create a custom out function to capture the output
|
|
54
|
+
// let outBuffer = ''
|
|
55
|
+
// const customOut = (...texts: unknown[]): void => {
|
|
56
|
+
// outBuffer += texts.join(' ') + '\n'
|
|
57
|
+
// }
|
|
58
|
+
// const testFileName = `${tempFolder}/b.test.js`
|
|
59
|
+
// const thing = 'Sample test 2'
|
|
60
|
+
// const should = '2 should equal 2'
|
|
61
|
+
// if (existsSync(testFileName)) {
|
|
62
|
+
// await fs.unlink(testFileName)
|
|
63
|
+
// }
|
|
64
|
+
// existsSync(testFileName).should.equal(false)
|
|
65
|
+
// await watchFilesAndRunTestsChokidar(config, [], {}, [], makeRunManagerState(), customOut)
|
|
66
|
+
// outBuffer.should.equal('')
|
|
67
|
+
// void fs.writeFile(
|
|
68
|
+
// testFileName,
|
|
69
|
+
// `import { describe } from '../../dist/index.js'
|
|
70
|
+
// import { expect, should } from 'chai'
|
|
71
|
+
// should()
|
|
72
|
+
// describe('${thing}', ({it}) => {
|
|
73
|
+
// it('${should}', () => {
|
|
74
|
+
// expect(2).to.equal(2)
|
|
75
|
+
// })
|
|
76
|
+
// })`
|
|
77
|
+
// )
|
|
78
|
+
// await new Promise<void>(resolve => setTimeout(resolve, 1000))
|
|
79
|
+
// outBuffer.should.include(testFileName)
|
|
80
|
+
// outBuffer.should.include(thing)
|
|
81
|
+
// outBuffer.should.include(should)
|
|
82
|
+
// outBuffer.should.include(figures.tick)
|
|
83
|
+
// })
|
|
84
|
+
// mochaIt('removes a test from tests and dependencyTrees when it is deleted', async function () {
|
|
85
|
+
// const config = structuredClone(baseConfig)
|
|
86
|
+
// // create a custom out function to capture the output
|
|
87
|
+
// let outBuffer = ''
|
|
88
|
+
// const customOut = (...texts: unknown[]): void => {
|
|
89
|
+
// outBuffer += texts.join(' ') + '\n'
|
|
90
|
+
// }
|
|
91
|
+
// const testFileName = `${tempFolder}/c.test.js`
|
|
92
|
+
// const thing = 'Sample test 3'
|
|
93
|
+
// const should = '3 should equal 3'
|
|
94
|
+
// if (!existsSync(testFileName)) {
|
|
95
|
+
// await fs.writeFile(
|
|
96
|
+
// testFileName,
|
|
97
|
+
// `import { describe } from '../../dist/index.js'
|
|
98
|
+
// import { expect, should } from 'chai'
|
|
99
|
+
// should()
|
|
100
|
+
// describe('${thing}', ({it}) => {
|
|
101
|
+
// it('${should}', () => {
|
|
102
|
+
// expect(3).to.equal(3)
|
|
103
|
+
// })
|
|
104
|
+
// })`
|
|
105
|
+
// )
|
|
106
|
+
// }
|
|
107
|
+
// existsSync(testFileName).should.be.true
|
|
108
|
+
// const originalTests = [testFileName]
|
|
109
|
+
// const originalDependencyTrees: DependencyTrees = {
|
|
110
|
+
// [testFileName]: [
|
|
111
|
+
// 'dep-1.js',
|
|
112
|
+
// 'dep-2.js'
|
|
113
|
+
// ]
|
|
114
|
+
// }
|
|
115
|
+
// const tests = structuredClone(originalTests)
|
|
116
|
+
// const dependencyTrees = structuredClone(originalDependencyTrees)
|
|
117
|
+
// tests.should.include.members([testFileName])
|
|
118
|
+
// dependencyTrees.should.include.keys([testFileName])
|
|
119
|
+
// await watchFilesAndRunTestsChokidar(config, tests, dependencyTrees, [], makeRunManagerState(), customOut)
|
|
120
|
+
// await fs.unlink(testFileName)
|
|
121
|
+
// await new Promise<void>(resolve => setTimeout(resolve, 1000))
|
|
122
|
+
// tests.should.not.include.members([testFileName])
|
|
123
|
+
// dependencyTrees.should.not.include.keys([testFileName])
|
|
124
|
+
// })
|
|
125
|
+
// })
|
|
123
126
|
//# sourceMappingURL=watchFilesAndRunTestsChokidar.unitTest.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watchFilesAndRunTestsChokidar.unitTest.js","sourceRoot":"","sources":["../../../src/cli/lib/watchFilesAndRunTestsChokidar.unitTest.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"watchFilesAndRunTestsChokidar.unitTest.js","sourceRoot":"","sources":["../../../src/cli/lib/watchFilesAndRunTestsChokidar.unitTest.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,kDAAkD;;AAElD,qFAAqF;AACrF,iEAAiE;AACjE,wDAAwD;AACxD,+DAA+D;AAE/D,0EAA0E;AAC1E,oEAAoE;AAEpE,+CAA+C;AAC/C,iCAAiC;AACjC,iCAAiC;AACjC,mBAAmB;AACnB,0CAA0C;AAC1C,oCAAoC;AACpC,YAAY;AACZ,SAAS;AAET,mFAAmF;AACnF,qDAAqD;AACrD,qEAAqE;AACrE,8CAA8C;AAE9C,gEAAgE;AAChE,6BAA6B;AAC7B,6DAA6D;AAC7D,kDAAkD;AAClD,YAAY;AAEZ,oFAAoF;AACpF,wCAAwC;AACxC,4CAA4C;AAE5C,oGAAoG;AAEpG,qCAAqC;AAErC,6BAA6B;AAC7B,4BAA4B;AAC5B,8DAA8D;AAC9D,wCAAwC;AACxC,WAAW;AAEX,mCAAmC;AAEnC,8BAA8B;AAC9B,gCAAgC;AAChC,SAAS;AAET,MAAM;AACN,YAAY;AAEZ,wEAAwE;AAExE,iDAAiD;AACjD,0CAA0C;AAC1C,2CAA2C;AAC3C,iDAAiD;AACjD,SAAS;AAET,uFAAuF;AACvF,qDAAqD;AACrD,qEAAqE;AACrE,8CAA8C;AAE9C,gEAAgE;AAChE,6BAA6B;AAC7B,6DAA6D;AAC7D,kDAAkD;AAClD,YAAY;AAEZ,yDAAyD;AACzD,wCAAwC;AACxC,4CAA4C;AAE5C,0CAA0C;AAC1C,4CAA4C;AAC5C,YAAY;AAEZ,uDAAuD;AAEvD,oGAAoG;AAEpG,qCAAqC;AAErC,6BAA6B;AAC7B,4BAA4B;AAC5B,8DAA8D;AAC9D,wCAAwC;AACxC,WAAW;AAEX,mCAAmC;AAEnC,8BAA8B;AAC9B,gCAAgC;AAChC,SAAS;AAET,MAAM;AACN,YAAY;AAEZ,wEAAwE;AAExE,iDAAiD;AACjD,0CAA0C;AAC1C,2CAA2C;AAC3C,iDAAiD;AACjD,SAAS;AAET,sGAAsG;AACtG,qDAAqD;AAErD,gEAAgE;AAChE,6BAA6B;AAC7B,6DAA6D;AAC7D,kDAAkD;AAClD,YAAY;AAEZ,yDAAyD;AACzD,wCAAwC;AACxC,4CAA4C;AAE5C,2CAA2C;AAC3C,kCAAkC;AAClC,gCAAgC;AAChC,kEAAkE;AAClE,wCAAwC;AACxC,WAAW;AAEX,mCAAmC;AAEnC,8BAA8B;AAC9B,gCAAgC;AAChC,SAAS;AAET,MAAM;AACN,gBAAgB;AAChB,YAAY;AAEZ,kDAAkD;AAElD,+CAA+C;AAC/C,6DAA6D;AAC7D,gCAAgC;AAChC,8BAA8B;AAC9B,6BAA6B;AAC7B,gBAAgB;AAChB,YAAY;AAEZ,uDAAuD;AACvD,2EAA2E;AAE3E,uDAAuD;AACvD,8DAA8D;AAE9D,oHAAoH;AAEpH,wCAAwC;AAExC,wEAAwE;AAExE,2DAA2D;AAC3D,kEAAkE;AAClE,SAAS;AACT,KAAK"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import type { FinalConfig, DependencyTrees, OutFn, TestExecutionFilters
|
|
2
|
-
|
|
1
|
+
import type { FinalConfig, DependencyTrees, OutFn, TestExecutionFilters } from '../../types.js';
|
|
2
|
+
import { ReRunManager } from './reRunManager.js';
|
|
3
|
+
export declare function watchFilesAndRunTestsNodeWatch(config: FinalConfig, dependencyTrees: DependencyTrees, failingTests: string[], reRunManager: ReRunManager, customOut?: OutFn, executionFilters?: TestExecutionFilters): Promise<void>;
|
|
3
4
|
//# sourceMappingURL=watchFilesAndRunTestsNodeWatch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watchFilesAndRunTestsNodeWatch.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/watchFilesAndRunTestsNodeWatch.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,KAAK,EAAE,oBAAoB,EAAE,
|
|
1
|
+
{"version":3,"file":"watchFilesAndRunTestsNodeWatch.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/watchFilesAndRunTestsNodeWatch.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAE/F,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAKhD,wBAAsB,8BAA8B,CAChD,MAAM,EAAE,WAAW,EAEnB,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,MAAM,EAAE,EACtB,YAAY,EAAE,YAAY,EAE1B,SAAS,CAAC,EAAE,KAAK,EACjB,gBAAgB,GAAE,oBAAyB,GAC5C,OAAO,CAAC,IAAI,CAAC,CA8Jf"}
|