Skip to content

Commit deaaec3

Browse files
committed
fix mistakes in test
1 parent c4e32a3 commit deaaec3

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/test/esm-loader.spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,14 @@ if (nodeSupportsImportAssertions) {
7878
test.suite('Supports import assertions', (test) => {
7979
test('Can import JSON using the appropriate flag and assertion', async (t) => {
8080
const { err, stdout } = await exec(
81-
`${CMD_ESM_LOADER_WITHOUT_PROJECT} ./importJson.ts`,
81+
`${CMD_ESM_LOADER_WITHOUT_PROJECT} --experimental-json-modules ./importJson.ts`,
8282
{
8383
cwd: resolve(TEST_DIR, 'esm-import-assertions'),
8484
}
8585
);
8686
expect(err).toBe(null);
87-
expect(stdout).toMatch(
88-
'A fuchsia car has 2 seats and the doors are open.`\nDone!'
87+
expect(stdout.trim()).toBe(
88+
'A fuchsia car has 2 seats and the doors are open.\nDone!'
8989
);
9090
});
9191
});

tests/esm-import-assertions/importJson.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ await import('./car.json').then(
1818
() => {
1919
throw new Error('should have thrown');
2020
},
21-
(error: Error) => {
22-
if (!error.message.includes('foo bar')) {
21+
(error: any) => {
22+
if (error.code !== 'ERR_IMPORT_ASSERTION_TYPE_MISSING') {
2323
throw error;
2424
}
2525
/* error is expected */

0 commit comments

Comments
 (0)