Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jablko committed Sep 17, 2021
1 parent 983a774 commit cc7de4a
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion tests/src/rules/no-unresolved.js
@@ -1,6 +1,6 @@
import * as path from 'path';

import { test, SYNTAX_CASES, testVersion } from '../utils';
import { getTSParsers, test, SYNTAX_CASES, testVersion } from '../utils';

import { CASE_SENSITIVE_FS } from 'eslint-module-utils/resolve';

Expand Down Expand Up @@ -441,3 +441,25 @@ ruleTester.run('import() with built-in parser', rule, {
})) || [],
),
});

context('TypeScript', () => {
for (const parser of getTSParsers()) {
if (parser !== require.resolve('typescript-eslint-parser')) {
ruleTester.run('no-unresolved ignore type-only', rule, {
valid: [
test({
code: 'import type { JSONSchema7Type } from "json-schema";',
parser,
}),
],
invalid: [
test({
code: 'import { JSONSchema7Type } from "json-schema";',
errors: [ "Unable to resolve path to module 'json-schema'." ],
parser,
}),
],
});
}
}
});

0 comments on commit cc7de4a

Please sign in to comment.