Skip to content

Commit d078278

Browse files
committed
fix(tests): fix linter tests that were doing nothing
fix a bug where, as `tslint` was set to true and the files being checked had no parent folder with a tslint.json, tslint in these tests never found any warnings also fixes a failing test because a syntactic error was counted as linter warning
1 parent e0020d6 commit d078278

1 file changed

Lines changed: 32 additions & 4 deletions

File tree

‎test/integration/index.spec.js‎

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,42 @@ function makeCommonTests(useTypescriptIncrementalApi) {
8282
expect(plugin.watch).to.deep.equal(['/test']);
8383
});
8484

85+
it('should find lint warnings', function(callback) {
86+
const fileName = 'lintingError2';
87+
helpers.testLintAutoFixTest(
88+
callback,
89+
fileName,
90+
{
91+
tslint: path.resolve(__dirname, './project/tslint.json'),
92+
ignoreLintWarnings: false,
93+
...overrideOptions
94+
},
95+
(err, stats) => {
96+
expect(
97+
stats.compilation.warnings.filter(warning =>
98+
warning.message.includes('missing whitespace')
99+
).length
100+
).to.be.greaterThan(0);
101+
}
102+
);
103+
});
104+
85105
it('should not print warnings when ignoreLintWarnings passed as option', function(callback) {
86106
const fileName = 'lintingError2';
87107
helpers.testLintAutoFixTest(
88108
callback,
89109
fileName,
90110
{
91-
tslint: true,
111+
tslint: path.resolve(__dirname, './project/tslint.json'),
92112
ignoreLintWarnings: true,
93113
...overrideOptions
94114
},
95115
(err, stats) => {
96-
expect(stats.compilation.warnings.length).to.be.eq(0);
116+
expect(
117+
stats.compilation.warnings.filter(warning =>
118+
warning.message.includes('missing whitespace')
119+
).length
120+
).to.be.equal(0);
97121
}
98122
);
99123
});
@@ -104,12 +128,16 @@ function makeCommonTests(useTypescriptIncrementalApi) {
104128
callback,
105129
fileName,
106130
{
107-
tslint: true,
131+
tslint: path.resolve(__dirname, './project/tslint.json'),
108132
ignoreLintWarnings: true,
109133
...overrideOptions
110134
},
111135
(err, stats) => {
112-
expect(stats.compilation.errors.length).to.be.eq(0);
136+
expect(
137+
stats.compilation.errors.filter(error =>
138+
error.message.includes('missing whitespace')
139+
).length
140+
).to.be.equals(0);
113141
}
114142
);
115143
});

0 commit comments

Comments
 (0)