@travetto/test 4.0.2 → 4.0.3
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/package.json +8 -8
- package/src/execute/executor.ts +1 -2
- package/src/execute/util.ts +2 -3
- package/src/trv.d.ts +0 -4
- package/src/worker/child.ts +2 -3
- package/support/bin/run.ts +0 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/test",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"description": "Declarative test framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"unit-testing",
|
|
@@ -27,15 +27,15 @@
|
|
|
27
27
|
"directory": "module/test"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@travetto/base": "^4.0.
|
|
31
|
-
"@travetto/registry": "^4.0.
|
|
32
|
-
"@travetto/terminal": "^4.0.
|
|
33
|
-
"@travetto/worker": "^4.0.
|
|
34
|
-
"@travetto/yaml": "^4.0.
|
|
30
|
+
"@travetto/base": "^4.0.2",
|
|
31
|
+
"@travetto/registry": "^4.0.3",
|
|
32
|
+
"@travetto/terminal": "^4.0.2",
|
|
33
|
+
"@travetto/worker": "^4.0.2",
|
|
34
|
+
"@travetto/yaml": "^4.0.2"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@travetto/cli": "^4.0.
|
|
38
|
-
"@travetto/transformer": "^4.0.
|
|
37
|
+
"@travetto/cli": "^4.0.4",
|
|
38
|
+
"@travetto/transformer": "^4.0.2"
|
|
39
39
|
},
|
|
40
40
|
"peerDependenciesMeta": {
|
|
41
41
|
"@travetto/transformer": {
|
package/src/execute/executor.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import timers from 'node:timers/promises';
|
|
2
1
|
import { AssertionError } from 'node:assert';
|
|
3
2
|
|
|
4
3
|
import { path, RuntimeIndex, RuntimeContext } from '@travetto/manifest';
|
|
@@ -45,7 +44,7 @@ export class TestExecutor {
|
|
|
45
44
|
await (suite.instance as Record<string, Function>)[test.methodName](); // Run
|
|
46
45
|
} finally {
|
|
47
46
|
process.env = env; // Restore
|
|
48
|
-
PromiseCapture.stop().then(() =>
|
|
47
|
+
PromiseCapture.stop().then(() => Util.queueMacroTask().then(promCleanup.resolve), promCleanup.reject);
|
|
49
48
|
}
|
|
50
49
|
});
|
|
51
50
|
|
package/src/execute/util.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
2
|
import { createReadStream } from 'node:fs';
|
|
3
3
|
import readline from 'node:readline';
|
|
4
|
-
import timers from 'node:timers/promises';
|
|
5
4
|
|
|
6
|
-
import { Env, ExecUtil, ShutdownManager } from '@travetto/base';
|
|
5
|
+
import { Env, ExecUtil, ShutdownManager, Util } from '@travetto/base';
|
|
7
6
|
import { IndexedFile, RuntimeIndex } from '@travetto/manifest';
|
|
8
7
|
|
|
9
8
|
/**
|
|
@@ -14,7 +13,7 @@ export class RunnerUtil {
|
|
|
14
13
|
* Add 50 ms to the shutdown to allow for buffers to output properly
|
|
15
14
|
*/
|
|
16
15
|
static registerCleanup(scope: string): void {
|
|
17
|
-
ShutdownManager.onGracefulShutdown(() =>
|
|
16
|
+
ShutdownManager.onGracefulShutdown(() => Util.nonBlockingTimeout(50), `test.${scope}.bufferOutput`);
|
|
18
17
|
}
|
|
19
18
|
|
|
20
19
|
/**
|
package/src/trv.d.ts
CHANGED
|
@@ -12,10 +12,6 @@ declare global {
|
|
|
12
12
|
* @default 5s
|
|
13
13
|
*/
|
|
14
14
|
TRV_TEST_TIMEOUT: TimeSpan | number;
|
|
15
|
-
/**
|
|
16
|
-
* An additional wait for triggering test runs, useful for code that takes time to warm up
|
|
17
|
-
*/
|
|
18
|
-
TRV_TEST_DELAY: TimeSpan | number;
|
|
19
15
|
/**
|
|
20
16
|
* Should the test break on the first line of debugging
|
|
21
17
|
*/
|
package/src/worker/child.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { createWriteStream } from 'node:fs';
|
|
2
|
-
import timers from 'node:timers/promises';
|
|
3
2
|
|
|
4
3
|
import { RuntimeContext } from '@travetto/manifest';
|
|
5
|
-
import { ConsoleManager, Env, TimeUtil } from '@travetto/base';
|
|
4
|
+
import { ConsoleManager, Env, TimeUtil, Util } from '@travetto/base';
|
|
6
5
|
import { ChildCommChannel } from '@travetto/worker';
|
|
7
6
|
|
|
8
7
|
import { ErrorUtil } from '../consumer/error';
|
|
@@ -50,7 +49,7 @@ export class TestChildWorker extends ChildCommChannel<RunEvent> {
|
|
|
50
49
|
// Let parent know the child is ready for handling commands
|
|
51
50
|
this.send(Events.READY);
|
|
52
51
|
|
|
53
|
-
await
|
|
52
|
+
await Util.nonBlockingTimeout(TimeUtil.timeToMs('10m'));
|
|
54
53
|
}
|
|
55
54
|
|
|
56
55
|
/**
|
package/support/bin/run.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import timers from 'node:timers/promises';
|
|
2
|
-
|
|
3
|
-
import { Env } from '@travetto/base';
|
|
4
|
-
|
|
5
1
|
import type { RunState } from '../../src/execute/types';
|
|
6
2
|
|
|
7
3
|
/**
|
|
@@ -14,8 +10,6 @@ export async function runTests(opts: RunState): Promise<void> {
|
|
|
14
10
|
|
|
15
11
|
RunnerUtil.registerCleanup('runner');
|
|
16
12
|
|
|
17
|
-
await timers.setTimeout(Env.TRV_TEST_DELAY.time ?? 0);
|
|
18
|
-
|
|
19
13
|
try {
|
|
20
14
|
const res = await new Runner(opts).run();
|
|
21
15
|
process.exitCode = res ? 0 : 1;
|