Skip to content

Commit

Permalink
fix(tests): fix linter tests that were doing nothing
Browse files Browse the repository at this point in the history
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
  • Loading branch information
phryneas committed Apr 22, 2019
1 parent e0020d6 commit d078278
Showing 1 changed file with 32 additions and 4 deletions.
36 changes: 32 additions & 4 deletions test/integration/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,42 @@ function makeCommonTests(useTypescriptIncrementalApi) {
expect(plugin.watch).to.deep.equal(['/test']);
});

it('should find lint warnings', function(callback) {
const fileName = 'lintingError2';
helpers.testLintAutoFixTest(
callback,
fileName,
{
tslint: path.resolve(__dirname, './project/tslint.json'),
ignoreLintWarnings: false,
...overrideOptions
},
(err, stats) => {
expect(
stats.compilation.warnings.filter(warning =>
warning.message.includes('missing whitespace')
).length
).to.be.greaterThan(0);
}
);
});

it('should not print warnings when ignoreLintWarnings passed as option', function(callback) {
const fileName = 'lintingError2';
helpers.testLintAutoFixTest(
callback,
fileName,
{
tslint: true,
tslint: path.resolve(__dirname, './project/tslint.json'),
ignoreLintWarnings: true,
...overrideOptions
},
(err, stats) => {
expect(stats.compilation.warnings.length).to.be.eq(0);
expect(
stats.compilation.warnings.filter(warning =>
warning.message.includes('missing whitespace')
).length
).to.be.equal(0);
}
);
});
Expand All @@ -104,12 +128,16 @@ function makeCommonTests(useTypescriptIncrementalApi) {
callback,
fileName,
{
tslint: true,
tslint: path.resolve(__dirname, './project/tslint.json'),
ignoreLintWarnings: true,
...overrideOptions
},
(err, stats) => {
expect(stats.compilation.errors.length).to.be.eq(0);
expect(
stats.compilation.errors.filter(error =>
error.message.includes('missing whitespace')
).length
).to.be.equals(0);
}
);
});
Expand Down

0 comments on commit d078278

Please sign in to comment.