Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup! esm: refactor esm tests out of test/message
  • Loading branch information
GeoffreyBooth committed Jan 6, 2022
commit 37041fb5e00d2a49e3e1751bd56c8f34ae3ccc28
24 changes: 24 additions & 0 deletions test/es-module/test-esm-export-not-found.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import '../common/index.mjs';
import { path } from '../common/fixtures.mjs';
import { ok } from 'assert';
import { spawn } from 'child_process';
import { execPath } from 'process';

[
path('/es-module-loaders/syntax-error-import.mjs'),
path('/es-module-loaders/syntax-error-import-multiline.mjs'),
].forEach((entry) => {
const child = spawn(execPath, [entry]);

let stderr = '';
child.stderr.setEncoding('utf8');
child.stderr.on('data', (data) => {
stderr += data;
});
child.on('close', () => {
Comment thread
GeoffreyBooth marked this conversation as resolved.
Outdated
ok(stderr.toString().includes(
Comment thread
GeoffreyBooth marked this conversation as resolved.
Outdated
'SyntaxError: The requested module \'./module-named-exports.mjs\' ' +
'does not provide an export named \'notfound\''
));
Comment thread
GeoffreyBooth marked this conversation as resolved.
Outdated
});
});
22 changes: 22 additions & 0 deletions test/es-module/test-esm-import-json-named-export.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import '../common/index.mjs';
import { path } from '../common/fixtures.mjs';
import { ok } from 'assert';
import { spawn } from 'child_process';
import { execPath } from 'process';

const child = spawn(execPath, [
'--experimental-json-modules',
path('/es-modules/import-json-named-export.mjs'),
]);

let stderr = '';
child.stderr.setEncoding('utf8');
child.stderr.on('data', (data) => {
stderr += data;
});
child.on('close', () => {
ok(stderr.toString().includes(
'SyntaxError: The requested module \'../experimental.json\' ' +
'does not provide an export named \'ofLife\''
));
});
20 changes: 20 additions & 0 deletions test/es-module/test-esm-syntax-error.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import '../common/index.mjs';
import { path } from '../common/fixtures.mjs';
import { ok } from 'assert';
import { spawn } from 'child_process';
import { execPath } from 'process';

const child = spawn(execPath, [
path('/es-module-loaders/syntax-error.mjs'),
]);

let stderr = '';
child.stderr.setEncoding('utf8');
child.stderr.on('data', (data) => {
stderr += data;
});
child.on('close', () => {
ok(stderr.toString().includes(
'SyntaxError: Malformed arrow function parameter list'
));
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* eslint-disable no-unused-vars */
import {
foo,
notfound
} from './module-named-exports.mjs';
2 changes: 2 additions & 0 deletions test/fixtures/es-modules/import-json-named-export.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/* eslint-disable no-unused-vars */
import { ofLife } from '../experimental.json' assert { type: 'json' };
6 changes: 0 additions & 6 deletions test/message/esm_display_syntax_error_import.mjs

This file was deleted.

12 changes: 0 additions & 12 deletions test/message/esm_display_syntax_error_import.out

This file was deleted.

This file was deleted.

12 changes: 0 additions & 12 deletions test/message/esm_display_syntax_error_import_json_named_export.out

This file was deleted.

2 changes: 0 additions & 2 deletions test/message/esm_display_syntax_error_import_module.mjs

This file was deleted.

12 changes: 0 additions & 12 deletions test/message/esm_display_syntax_error_import_module.out

This file was deleted.

2 changes: 0 additions & 2 deletions test/message/esm_display_syntax_error_module.mjs

This file was deleted.

9 changes: 0 additions & 9 deletions test/message/esm_display_syntax_error_module.out

This file was deleted.