Skip to content

Commit

Permalink
fix mistakes in test
Browse files Browse the repository at this point in the history
  • Loading branch information
cspotcode committed Dec 27, 2021
1 parent c4e32a3 commit deaaec3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/test/esm-loader.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ if (nodeSupportsImportAssertions) {
test.suite('Supports import assertions', (test) => {
test('Can import JSON using the appropriate flag and assertion', async (t) => {
const { err, stdout } = await exec(
`${CMD_ESM_LOADER_WITHOUT_PROJECT} ./importJson.ts`,
`${CMD_ESM_LOADER_WITHOUT_PROJECT} --experimental-json-modules ./importJson.ts`,
{
cwd: resolve(TEST_DIR, 'esm-import-assertions'),
}
);
expect(err).toBe(null);
expect(stdout).toMatch(
'A fuchsia car has 2 seats and the doors are open.`\nDone!'
expect(stdout.trim()).toBe(
'A fuchsia car has 2 seats and the doors are open.\nDone!'
);
});
});
Expand Down
4 changes: 2 additions & 2 deletions tests/esm-import-assertions/importJson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ await import('./car.json').then(
() => {
throw new Error('should have thrown');
},
(error: Error) => {
if (!error.message.includes('foo bar')) {
(error: any) => {
if (error.code !== 'ERR_IMPORT_ASSERTION_TYPE_MISSING') {
throw error;
}
/* error is expected */
Expand Down

0 comments on commit deaaec3

Please sign in to comment.