|
1 | 1 | import * as path from 'path';
|
2 | 2 |
|
3 |
| -import { test, SYNTAX_CASES } from '../utils'; |
| 3 | +import { test, SYNTAX_CASES, testVersion } from '../utils'; |
4 | 4 |
|
5 | 5 | import { CASE_SENSITIVE_FS } from 'eslint-module-utils/resolve';
|
6 | 6 |
|
@@ -93,7 +93,6 @@ function runResolverTests(resolver) {
|
93 | 93 | '\'./reallyfake/module\'.' }],
|
94 | 94 | }),
|
95 | 95 |
|
96 |
| - |
97 | 96 | rest({
|
98 | 97 | code: "import bar from './baz';",
|
99 | 98 | errors: [{ message: "Unable to resolve path to module './baz'.",
|
@@ -382,3 +381,22 @@ ruleTester.run('no-unresolved syntax verification', rule, {
|
382 | 381 | valid: SYNTAX_CASES,
|
383 | 382 | invalid:[],
|
384 | 383 | });
|
| 384 | + |
| 385 | +// https://github.com/benmosher/eslint-plugin-import/issues/2024 |
| 386 | +ruleTester.run('import() with built-in parser', rule, { |
| 387 | + valid: [].concat( |
| 388 | + testVersion('>=7', () => ({ |
| 389 | + code: "import('fs');", |
| 390 | + parser: require.resolve('espree'), |
| 391 | + parserOptions: { ecmaVersion: 2021 }, |
| 392 | + })) || [], |
| 393 | + ), |
| 394 | + invalid: [].concat( |
| 395 | + testVersion('>=7', () => ({ |
| 396 | + code: 'import("./does-not-exist").then(() => {})', |
| 397 | + parser: require.resolve('espree'), |
| 398 | + parserOptions: { ecmaVersion: 2021 }, |
| 399 | + errors: ["Unable to resolve path to module './does-not-exist'."], |
| 400 | + })) || [], |
| 401 | + ), |
| 402 | +}); |
0 commit comments