Skip to content

Commit 861657a

Browse files
ptomato review
1 parent 0eb35e1 commit 861657a

File tree

4 files changed

+25
-21
lines changed

4 files changed

+25
-21
lines changed

test/language/expressions/dynamic-import/import-errored-module.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,16 @@ info: |
3535
3636
flags: [async]
3737
features: [dynamic-import]
38+
includes: [asyncHelpers.js]
3839
---*/
3940

40-
import('./import-errored-module_FIXTURE.js').then(() => {
41-
$DONE(new Test262Error('The import should reject (first import)'));
42-
}, () => {
43-
import('./import-errored-module_FIXTURE.js').then(() => {
44-
$DONE(new Test262Error('The import should reject (second import)'));
45-
}, () => $DONE());
41+
asyncTest(async function () {
42+
await assert.throwsAsync(
43+
() => import('./import-errored-module_FIXTURE.js'),
44+
'The import should reject (first import)'
45+
);
46+
await assert.throwsAsync(
47+
() => import('./import-errored-module_FIXTURE.js'),
48+
'The import should reject (second import)'
49+
);
4650
});
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
// Copyright (C) 2025 Igalia. All rights reserved.
1+
// Copyright (C) 2025 Igalia, S.L. All rights reserved.
22
// This code is governed by the BSD license found in the LICENSE file.
33

test/language/module-code/top-level-await/dynamic-import-of-waiting-module.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2025 Igalia. All rights reserved.
1+
// Copyright (C) 2025 Igalia, S.L. All rights reserved.
22
// This code is governed by the BSD license found in the LICENSE file.
33

44
/*---
@@ -35,35 +35,35 @@ info: |
3535
3636
flags: [async]
3737
features: [dynamic-import]
38+
includes: [asyncHelpers.js]
3839
---*/
3940

4041
let continueExecution;
41-
globalThis.promise = new Promise(res => continueExecution = res);
42+
globalThis.promise = new Promise((resolve) => continueExecution = resolve);
4243

43-
const executionStartPromise = new Promise(res => globalThis.executionStarted = res);
44+
const executionStartPromise = new Promise((resolve) => globalThis.executionStarted = resolve);
4445

45-
const promiseForNamespace = import("./dynamic-import-of-waiting-module_FIXTURE.js");
46+
asyncTest(async function () {
47+
const promiseForNamespace = import("./dynamic-import-of-waiting-module_FIXTURE.js");
48+
49+
await executionStartPromise;
4650

47-
executionStartPromise.then(() => {
4851
const promiseForNamespace2 = import("./dynamic-import-of-waiting-module_FIXTURE.js");
4952

50-
// We only continuye execution of the first fixture file after importing a second,
53+
// We only continue execution of the first fixture file after importing a second,
5154
// empty, fixture file. This is so that if the implementation uses a separate
5255
// queue to resolve dynamic import promises, if dynamic-import-of-waiting-module_FIXTURE
5356
// wasn't waiting on top-level await its top-level promise would already be resolved.
54-
import("./dynamic-import-of-waiting-module-2_FIXTURE.js").then(() => {
55-
continueExecution();
56-
}, $DONE);
57+
await import("./dynamic-import-of-waiting-module-2_FIXTURE.js");
58+
continueExecution();
5759

5860
let secondPromiseResolved = false;
59-
return Promise.all([
61+
await Promise.all([
6062
promiseForNamespace.then(() => {
61-
console.log("Resolving first...");
6263
assert(!secondPromiseResolved, "The second import should not resolve before the first one");
6364
}),
6465
promiseForNamespace2.then(() => {
65-
console.log("Resolving second...");
6666
secondPromiseResolved = true;
6767
})
6868
]);
69-
}).then($DONE, $DONE);
69+
});

test/language/module-code/top-level-await/dynamic-import-of-waiting-module_FIXTURE.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2025 Igalia. All rights reserved.
1+
// Copyright (C) 2025 Igalia, S.L. All rights reserved.
22
// This code is governed by the BSD license found in the LICENSE file.
33

44
globalThis.executionStarted();

0 commit comments

Comments
 (0)