Skip to content

Commit

Permalink
[Tests] named: Run all TypeScript tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ProdigySim authored and ljharb committed Apr 7, 2022
1 parent d160285 commit 5b6343f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 13 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Expand Up @@ -6,6 +6,9 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange

## [Unreleased]

### Changed
- [Tests] `named`: Run all TypeScript test ([#2427], thanks [@ProdigySim])

## [2.26.0] - 2022-04-05

### Added
Expand Down Expand Up @@ -977,6 +980,7 @@ for info on changes for earlier releases.

[`memo-parser`]: ./memo-parser/README.md

[#2427]: https://github.com/import-js/eslint-plugin-import/pull/2427
[#2417]: https://github.com/import-js/eslint-plugin-import/pull/2417
[#2411]: https://github.com/import-js/eslint-plugin-import/pull/2411
[#2393]: https://github.com/import-js/eslint-plugin-import/pull/2393
Expand Down Expand Up @@ -1624,6 +1628,7 @@ for info on changes for earlier releases.
[@Pessimistress]: https://github.com/Pessimistress
[@pmcelhaney]: https://github.com/pmcelhaney
[@preco21]: https://github.com/preco21
[@ProdigySim]: https://github.com/ProdigySim
[@pzhine]: https://github.com/pzhine
[@ramasilveyra]: https://github.com/ramasilveyra
[@randallreedjr]: https://github.com/randallreedjr
Expand Down
42 changes: 29 additions & 13 deletions tests/src/rules/named.js
Expand Up @@ -388,14 +388,18 @@ context('TypeScript', function () {
'import/resolver': { 'eslint-import-resolver-typescript': true },
};

const valid = [];
let valid = [];
const invalid = [
test({
code: `import {a} from './export-star-3/b';`,
filename: testFilePath('./export-star-3/a.js'),
parser,
settings,
}),
// TODO: uncomment this test
// test({
// code: `import {a} from './export-star-3/b';`,
// filename: testFilePath('./export-star-3/a.js'),
// parser,
// settings,
// errors: [
// { message: 'a not found in ./export-star-3/b' },
// ],
// }),
];

[
Expand All @@ -404,7 +408,7 @@ context('TypeScript', function () {
'typescript-export-assign-namespace',
'typescript-export-assign-namespace-merged',
].forEach((source) => {
valid.push(
valid = valid.concat(
test({
code: `import { MyType } from "./${source}"`,
parser,
Expand All @@ -420,11 +424,18 @@ context('TypeScript', function () {
parser,
settings,
}),
test({
code: `import { getFoo } from "./${source}"`,
parser,
settings,
}),
(source === 'typescript-declare'
? testVersion('> 5', () => ({
code: `import { getFoo } from "./${source}"`,
parser,
settings,
}))
: test({
code: `import { getFoo } from "./${source}"`,
parser,
settings,
})
),
test({
code: `import { MyEnum } from "./${source}"`,
parser,
Expand Down Expand Up @@ -469,5 +480,10 @@ context('TypeScript', function () {
}),
);
});

ruleTester.run(`named [TypeScript]`, rule, {
valid,
invalid,
});
});
});

0 comments on commit 5b6343f

Please sign in to comment.