Skip to content

Commit 92c1cbc

Browse files
committed
test: split test-esm-loader-hooks
Previously whenever one of the test case fails in the CI, it barely logged anything useful in the CI and it was difficult to nail down the specific failing case with a local reproduction, especially when the test fixutre is inline JavaScript. This patch: - Puts all the inline JavaScript in on-disk fixtures so that they can be re-run easily. - Split the tests into individual files so that it's easier to nail down the failure - Use spawnSyncAndAssert which logs useful information when the child process does not behave as expected. - Rename the tests as module-hooks/test-async-loader-hooks-* because they belong to the module hooks test suite and are not esm-specific.
1 parent e1fc3dc commit 92c1cbc

File tree

81 files changed

+1228
-860
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+1228
-860
lines changed

β€Žtest/es-module/test-esm-loader-hooks.mjsβ€Ž

Lines changed: 0 additions & 860 deletions
This file was deleted.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function load(a, b, c) {
2+
return new Promise(d => setTimeout(() => d(c(a, b)), 99));
3+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export function load(a, b, next) {
2+
if (a === 'data:exit') process.exit(42);
3+
return next(a, b);
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export function resolve(a, b, next) {
2+
if (a === 'exit:') process.exit(42);
3+
return next(a, b);
4+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
process.exit(42);
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export function globalPreload() {}
2+
export function initialize() {}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export function globalPreload() {}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function globalPreload() {
2+
return '';
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function initialize() {
2+
process.exit(42);
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function initialize() {
2+
return new Promise(() => {});
3+
}

0 commit comments

Comments
Β (0)