sxy-test-runner 1.3.8 → 1.4.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/esmReload.unitTest.js +8 -0
- package/dist/cli/lib/load.unitTest copy.js +7 -0
- package/dist/cli/lib/load.unitTest.js +1 -1
- package/dist/cli/lib/loadTestFile.js +21 -10
- package/dist/cli/lib/processWatchEvent.js +1 -0
- package/dist/cli/lib/runTests.js +4 -2
- package/dist/cli/lib/watchFilesAndRunTestsChokidar.js +4 -2
- package/dist/cli/lib/watchFilesAndRunTestsNodeWatch.js +4 -2
- package/dist/describe.js +1 -0
- package/dist/describe.unitTest.js +0 -4
- package/package.json +2 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import 'esm-reload'; // this registers the import hook
|
|
2
|
+
|
|
3
|
+
await mochaDescribe('esm-reload module', async function () {
|
|
4
|
+
await mochaIt('load is a function with a cache', async function () {
|
|
5
|
+
await load.should.be.a('function');
|
|
6
|
+
await load.should.include.key('cache');
|
|
7
|
+
});
|
|
8
|
+
});
|
|
@@ -1,13 +1,21 @@
|
|
|
1
|
+
import { join } from 'path';
|
|
2
|
+
import chalk from 'chalk-extensions';
|
|
1
3
|
import { createTimeProfiler } from 'sxy-dev-tools';
|
|
4
|
+
import 'esm-reload'; // registers import reload hook
|
|
5
|
+
|
|
2
6
|
import { showTimeProfiling } from '../../config.js';
|
|
3
7
|
import { out, log, debug, error } from '../../output.js';
|
|
4
|
-
import { join } from 'path';
|
|
5
|
-
import chalk from 'chalk-extensions';
|
|
6
8
|
const {
|
|
7
9
|
timeProfileAsync
|
|
8
10
|
} = await createTimeProfiler(showTimeProfiling);
|
|
9
|
-
|
|
11
|
+
|
|
12
|
+
//import { load } from './load.js.depr/index.js'
|
|
13
|
+
|
|
10
14
|
let loading = null;
|
|
15
|
+
let importIteration = 1;
|
|
16
|
+
async function importFresh(target) {
|
|
17
|
+
return await import(target + `?instance=${importIteration++}`);
|
|
18
|
+
}
|
|
11
19
|
export async function loadTestFile(config, testFile) {
|
|
12
20
|
if (loading !== null) {
|
|
13
21
|
await debug(chalk.yellow`loadTestFile - another file is loading - waiting for it to finish`);
|
|
@@ -41,13 +49,16 @@ export async function loadTestFile(config, testFile) {
|
|
|
41
49
|
////
|
|
42
50
|
|
|
43
51
|
try {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
52
|
+
// Old sxy-loader code
|
|
53
|
+
// load(testFileFullUrl, {
|
|
54
|
+
// // scopeObject: { // experimental idea
|
|
55
|
+
// // name: 'scope',
|
|
56
|
+
// // contents: {},
|
|
57
|
+
// // exposeObject: 'scope'
|
|
58
|
+
// // }
|
|
59
|
+
// })
|
|
60
|
+
|
|
61
|
+
await importFresh(testFileFullUrl);
|
|
51
62
|
test.describes = global.__sxy_test_runner__.describes;
|
|
52
63
|
test.error = false;
|
|
53
64
|
} catch (e) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//
|
package/dist/cli/lib/runTests.js
CHANGED
|
@@ -11,7 +11,8 @@ import { loadTestFile } from './loadTestFile.js';
|
|
|
11
11
|
import { runTest } from './runTest.js';
|
|
12
12
|
import { showTestLoadingError } from './showTestLoadingError.js';
|
|
13
13
|
import { showTestResult } from './showTestResult.js';
|
|
14
|
-
import { load } from './load.js'
|
|
14
|
+
//import { load } from './load.js.depr/index.js'
|
|
15
|
+
|
|
15
16
|
const {
|
|
16
17
|
timeProfileAsync
|
|
17
18
|
} = await createTimeProfiler(showTimeProfiling);
|
|
@@ -29,7 +30,8 @@ export async function runTests(config, testFiles, failingTests, customOut = unde
|
|
|
29
30
|
|
|
30
31
|
if (testFiles.length > 0) {
|
|
31
32
|
// clear load cache to allow accessing the new tets
|
|
32
|
-
|
|
33
|
+
//cache.clear()
|
|
34
|
+
|
|
33
35
|
for (const testFile of testFiles) {
|
|
34
36
|
const test = await loadTestFile(config, testFile);
|
|
35
37
|
if (test.error) {
|
|
@@ -11,7 +11,8 @@ import { out, log, debug } from '../../output.js';
|
|
|
11
11
|
import { runTests } from './runTests.js';
|
|
12
12
|
import { buildDependencyTree } from './buildDependencyTree.js';
|
|
13
13
|
import { globArgCombine } from './globArgCombine.js';
|
|
14
|
-
import { load } from './load.js'
|
|
14
|
+
//import { load } from './load.js.depr/index.js'
|
|
15
|
+
|
|
15
16
|
const {
|
|
16
17
|
timeProfileAsync
|
|
17
18
|
} = await createTimeProfiler(showTimeProfiling);
|
|
@@ -111,7 +112,8 @@ export async function watchFilesAndRunTestsChokidar(config, testFiles, dependenc
|
|
|
111
112
|
await debug('toTest', toTest);
|
|
112
113
|
|
|
113
114
|
// clear load cache to allow accesing the new tets
|
|
114
|
-
|
|
115
|
+
//load.cache.clear()
|
|
116
|
+
|
|
115
117
|
const testResults = await runTests(config, toTest, failingTests, customOut);
|
|
116
118
|
});
|
|
117
119
|
}
|
|
@@ -11,7 +11,8 @@ import { out, log, debug } from '../../output.js';
|
|
|
11
11
|
import { runTests } from './runTests.js';
|
|
12
12
|
import { buildDependencyTree } from './buildDependencyTree.js';
|
|
13
13
|
import { globArgCombine } from './globArgCombine.js';
|
|
14
|
-
import { load } from './load.js'
|
|
14
|
+
//import { load } from './load.js.depr/index.js'
|
|
15
|
+
|
|
15
16
|
const {
|
|
16
17
|
timeProfileAsync
|
|
17
18
|
} = await createTimeProfiler(showTimeProfiling);
|
|
@@ -133,7 +134,8 @@ export async function watchFilesAndRunTestsNodeWatch(config, testFiles, dependen
|
|
|
133
134
|
await debug('toTest', toTest);
|
|
134
135
|
|
|
135
136
|
// clear load cache to allow accesing the new test
|
|
136
|
-
|
|
137
|
+
//load.cache.clear()
|
|
138
|
+
|
|
137
139
|
const testResults = await runTests(config, toTest, failingTests, customOut);
|
|
138
140
|
});
|
|
139
141
|
}
|
package/dist/describe.js
CHANGED
|
@@ -16,6 +16,7 @@ const {
|
|
|
16
16
|
export async function describe(theThing, tests) {
|
|
17
17
|
if (!global.__sxy_test_runner__) {
|
|
18
18
|
throw new Error(`sxy-test-runner describe() was called, but the test framework has not initialized.` + ` This might be because you have run a test file directly` + `, instead of running 'pnpm sxy-test-runner'`);
|
|
19
|
+
// todo - maybe we can initialise the framework and just run only this test file
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
//const thisDescribeCounter = global.testState.describeCounter++ // ++: assign the value, THEN increment
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { expect } from 'chai';
|
|
2
2
|
import { describe } from './describe.js';
|
|
3
|
-
|
|
4
|
-
//import { createLoad } from 'sxy-loader'
|
|
5
|
-
//const load = createLoad(import.meta.url)
|
|
6
|
-
|
|
7
3
|
await mochaDescribe('new describe() function', async function () {
|
|
8
4
|
await mochaIt('should run tests and output results', async function () {
|
|
9
5
|
await this.timeout(6000);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sxy-test-runner",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://github.com/RobertSandiford/sxy-test-runner",
|
|
6
6
|
"repository": {
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"chokidar": "^3.6.0",
|
|
35
35
|
"cross-env": "^7.0.3",
|
|
36
36
|
"dependency-tree": "^8.1.2",
|
|
37
|
+
"esm-reload": "^1.0.1",
|
|
37
38
|
"figures": "^4.0.1",
|
|
38
39
|
"glob": "^7.2.3",
|
|
39
40
|
"globby": "^12.2.0",
|