Skip to content

Commit 1ad43d0

Browse files
authored
Enable integration test on more files (#628)
1 parent 9cd01cd commit 1ad43d0

File tree

2 files changed

+46
-33
lines changed

2 files changed

+46
-33
lines changed

test/integration/projects.js

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

3-
const typescriptArguments = ['--parser', '@typescript-eslint/parser', '--ext', '.ts'];
4-
const vueArguments = ['--parser', 'vue-eslint-parser', '--ext', '.vue'];
3+
const typescriptArguments = ['--parser', '@typescript-eslint/parser', '--ext', '.ts,.js'];
4+
const vueArguments = ['--parser', 'vue-eslint-parser', '--ext', '.vue,.js'];
55

66
module.exports = [
77
'https://github.com/avajs/ava',
@@ -49,42 +49,35 @@ module.exports = [
4949
extraArguments: typescriptArguments
5050
},
5151
// TODO: Add this project when #561 got fixed
52-
// {
53-
// repository: 'https://github.com/eslint/eslint',
54-
// path: 'lib'
55-
// },
52+
// 'https://github.com/eslint/eslint',
53+
'https://github.com/prettier/prettier',
54+
'https://github.com/facebook/react',
5655
{
57-
repository: 'https://github.com/prettier/prettier',
58-
path: 'src'
59-
},
60-
{
61-
repository: 'https://github.com/facebook/react',
62-
path: 'packages'
56+
repository: 'https://github.com/angular/angular',
57+
extraArguments: [
58+
...typescriptArguments,
59+
60+
'--ignore-pattern',
61+
'aio/content/examples/animations/src/app/open-close.component.3.ts',
62+
63+
'--ignore-pattern',
64+
'aio/tools/transforms/templates/data-module.template.js'
65+
]
6366
},
6467
{
65-
repository: 'https://github.com/angular/angular',
66-
path: 'packages',
68+
repository: 'https://github.com/microsoft/typescript',
6769
extraArguments: typescriptArguments
6870
},
6971
{
70-
repository: 'https://github.com/microsoft/typescript',
71-
path: 'src',
72+
repository: 'https://github.com/microsoft/vscode',
7273
extraArguments: typescriptArguments
7374
},
74-
// TODO: Add this project when `@typescript-eslint/parser` support `Type-Only Imports and Export`
75-
// {
76-
// repository: 'https://github.com/microsoft/vscode',
77-
// path: 'src/vs',
78-
// extraArguments: typescriptArguments
79-
// },
8075
{
8176
repository: 'https://github.com/ElemeFE/element',
82-
path: 'packages',
8377
extraArguments: vueArguments
8478
},
8579
{
8680
repository: 'https://github.com/iview/iview',
87-
path: 'src',
8881
extraArguments: vueArguments
8982
},
9083
'https://github.com/sindresorhus/create-dmg',
@@ -95,12 +88,26 @@ module.exports = [
9588
'https://github.com/gatsbyjs/gatsby',
9689
{
9790
repository: 'https://github.com/puppeteer/puppeteer',
98-
path: 'lib'
91+
extraArguments: [
92+
// Parser error on `await page.evaluate(() => delete Node);`
93+
// https://github.com/puppeteer/puppeteer/blob/0b1a9ceee2f05f534f0d50079ece172d627a93c7/test/jshandle.spec.js#L151
94+
'--ignore-pattern',
95+
'test/jshandle.spec.js',
96+
97+
// `package` keyword
98+
// https://github.com/puppeteer/puppeteer/blob/0b1a9ceee2f05f534f0d50079ece172d627a93c7/utils/apply_next_version.js#L17
99+
'--ignore-pattern',
100+
'utils/apply_next_version.js'
101+
]
99102
},
100103
{
101104
repository: 'https://github.com/zeit/next.js',
102-
path: 'packages',
103-
extraArguments: typescriptArguments
105+
extraArguments: [
106+
...typescriptArguments,
107+
108+
'--ignore-pattern',
109+
'examples/**'
110+
]
104111
},
105112
'https://github.com/chakra-ui/chakra-ui',
106113
'https://github.com/ReactTraining/react-router',

test/integration/test.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,13 @@ const makeEslintTask = (project, destination) => {
2323
'eslint',
2424
'--fix-dry-run',
2525
'--no-eslintrc',
26-
// https://github.com/microsoft/TypeScript/blob/a1c8608f681488fda3f0b6ffd89195a81f80f0b0/.eslintignore#L6
27-
project.name === 'typescript' ? '' : '--no-ignore',
2826
'--format',
2927
'json',
3028
'--config',
3129
path.join(__dirname, 'config.js'),
32-
project.path ? path.join(destination, project.path) : destination,
30+
project.path || '.',
3331
...project.extraArguments
34-
].filter(Boolean);
32+
];
3533

3634
return enrichErrors(project.name, arguments_, async () => {
3735
let stdout;
@@ -64,7 +62,11 @@ const makeEslintTask = (project, destination) => {
6462
for (const message of file.messages) {
6563
if (message.fatal) {
6664
const error = new Error(message.message);
67-
error.eslintFile = file;
65+
error.eslintJob = {
66+
destination,
67+
project,
68+
file
69+
};
6870
error.eslintMessage = message;
6971
throw error;
7072
}
@@ -142,7 +144,11 @@ list.run()
142144
}
143145

144146
if (error2.eslintMessage) {
145-
console.error(chalk.gray(error2.eslintFile.filePath), chalk.gray(JSON.stringify(error2.eslintMessage, null, 2)));
147+
const {file, project, destination} = error2.eslintJob;
148+
const {line} = error2.eslintMessage;
149+
150+
console.error(chalk.gray(`${project.repository}/tree/master/${path.relative(destination, file.filePath)}#L${line}`));
151+
console.error(chalk.gray(JSON.stringify(error2.eslintMessage, null, 2)));
146152
}
147153
}
148154
} else {

0 commit comments

Comments
 (0)