Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: lint karma.conf.js and webpack.config.js #11424

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 2 additions & 8 deletions Makefile.js
Expand Up @@ -502,14 +502,8 @@ target.lint = function() {
let errors = 0,
lastReturn;

echo("Validating Makefile.js");
lastReturn = exec(`${ESLINT} ${MAKEFILE}`);
if (lastReturn.code !== 0) {
errors++;
}

echo("Validating .eslintrc.js");
lastReturn = exec(`${ESLINT} .eslintrc.js`);
echo("Validating Makefile.js, .eslintrc.js, webpack.config.js, and karma.conf.js");
lastReturn = exec(`${ESLINT} ${MAKEFILE} .eslintrc.js webpack.config.js karma.conf.js`);
if (lastReturn.code !== 0) {
errors++;
}
Expand Down
56 changes: 35 additions & 21 deletions karma.conf.js
Expand Up @@ -9,8 +9,10 @@ module.exports = function(config) {
basePath: "",


// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
/*
* frameworks to use
* available frameworks: https://npmjs.org/browse/keyword/karma-adapter
*/
frameworks: ["mocha"],


Expand All @@ -26,8 +28,10 @@ module.exports = function(config) {
],


// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
/*
* preprocess matching files before serving them to the browser
* available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
*/
preprocessors: {
"tests/lib/linter.js": ["webpack"]
},
Expand All @@ -40,9 +44,11 @@ module.exports = function(config) {
},


// test results reporter to use
// possible values: "dots", "progress"
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
/*
* test results reporter to use
* possible values: "dots", "progress"
* available reporters: https://npmjs.org/browse/keyword/karma-reporter
*/
reporters: ["mocha"],

mochaReporter: {
Expand All @@ -57,31 +63,39 @@ module.exports = function(config) {
colors: true,


// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
/*
* level of logging
* possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
*/
logLevel: config.LOG_INFO,


// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,


// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
/*
* start these browsers
* available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
*/
browsers: ["HeadlessChrome"],
customLaunchers: {
HeadlessChrome: {
base: 'ChromeHeadless',
flags: [ '--no-sandbox', ],
},
},

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
HeadlessChrome: {
base: "ChromeHeadless",
flags: ["--no-sandbox"]
}
},

/*
* Continuous Integration mode
* if true, Karma captures browsers, runs the tests and exits
*/
singleRun: true,

// Concurrency level
// how many browser should be started simultaneous
/*
* Concurrency level
* how many browser should be started simultaneous
*/
concurrency: Infinity
});
};
2 changes: 2 additions & 0 deletions webpack.config.js
@@ -1,3 +1,5 @@
"use strict";

module.exports = {
mode: "none",
entry: ["@babel/polyfill", "./lib/linter.js"],
Expand Down