Check for forgotten console and debugger statements

This commit is contained in:
Steve Gravrock
2020-09-17 13:33:25 -07:00
parent 795651d3b6
commit 7d5ca27b9d
4 changed files with 13 additions and 1 deletions
+7 -1
View File
@@ -13,5 +13,11 @@ module.exports = {
"no-unused-vars": "off", "no-unused-vars": "off",
"no-trailing-spaces": "off", "no-trailing-spaces": "off",
"block-spacing": "off", "block-spacing": "off",
// Since linting is done at the end of the process and doesn't stop us
// from running tests, it makes sense to fail if debugger statements
// or console references are present.
"no-debugger": "error",
"no-console": "error",
} }
} };
+3
View File
@@ -2316,6 +2316,7 @@ describe("Env integration", function() {
expect(result.deprecationWarnings).toEqual([ expect(result.deprecationWarnings).toEqual([
jasmine.objectContaining({ message: 'top level deprecation' }) jasmine.objectContaining({ message: 'top level deprecation' })
]); ]);
/* eslint-disable-next-line no-console */
expect(console.error).toHaveBeenCalledWith('DEPRECATION: top level deprecation'); expect(console.error).toHaveBeenCalledWith('DEPRECATION: top level deprecation');
expect(reporter.suiteDone).toHaveBeenCalledWith(jasmine.objectContaining({ expect(reporter.suiteDone).toHaveBeenCalledWith(jasmine.objectContaining({
@@ -2324,6 +2325,7 @@ describe("Env integration", function() {
jasmine.objectContaining({ message: 'suite level deprecation' }) jasmine.objectContaining({ message: 'suite level deprecation' })
] ]
})); }));
/* eslint-disable-next-line no-console */
expect(console.error).toHaveBeenCalledWith('DEPRECATION: suite level deprecation (in suite: suite)'); expect(console.error).toHaveBeenCalledWith('DEPRECATION: suite level deprecation (in suite: suite)');
expect(reporter.specDone).toHaveBeenCalledWith(jasmine.objectContaining({ expect(reporter.specDone).toHaveBeenCalledWith(jasmine.objectContaining({
@@ -2332,6 +2334,7 @@ describe("Env integration", function() {
jasmine.objectContaining({ message: 'spec level deprecation' }) jasmine.objectContaining({ message: 'spec level deprecation' })
] ]
})); }));
/* eslint-disable-next-line no-console */
expect(console.error).toHaveBeenCalledWith('DEPRECATION: spec level deprecation (in spec: suite spec)'); expect(console.error).toHaveBeenCalledWith('DEPRECATION: spec level deprecation (in spec: suite spec)');
done(); done();
+1
View File
@@ -32,6 +32,7 @@ describe("matchersUtil", function() {
// Be thorough but very slow when specified (usually on CI). // Be thorough but very slow when specified (usually on CI).
if (process.env.JASMINE_LONG_PROPERTY_TESTS) { if (process.env.JASMINE_LONG_PROPERTY_TESTS) {
/* eslint-disable-next-line no-console */
console.log( console.log(
'Using', 'Using',
many, many,
+2
View File
@@ -104,6 +104,7 @@ describe('HtmlReporter', function() {
passedExpectations: [], passedExpectations: [],
failedExpectations: [] failedExpectations: []
}); });
/* eslint-disable-next-line no-console */
expect(console.warn).toHaveBeenCalledWith( expect(console.warn).toHaveBeenCalledWith(
"Spec 'Some Name' has no expectations." "Spec 'Some Name' has no expectations."
); );
@@ -118,6 +119,7 @@ describe('HtmlReporter', function() {
passedExpectations: [], passedExpectations: [],
failedExpectations: [] failedExpectations: []
}); });
/* eslint-disable-next-line no-console */
expect(console.error).toHaveBeenCalledWith( expect(console.error).toHaveBeenCalledWith(
"Spec 'Some Name' has no expectations." "Spec 'Some Name' has no expectations."
); );