This repository has been archived by the owner on Mar 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disable silent mode when building sass for tests. (#525)
- Loading branch information
Showing
7 changed files
with
218 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
const karmaBaseConfig = require('./karma.config'); | ||
const { getBaseKarmaConfig } = require('./karma.config'); | ||
const constants = require('karma').constants; | ||
|
||
module.exports = function (config) { | ||
module.exports.getChromeKarmaConfig = function () { | ||
return getBaseKarmaConfig().then(karmaBaseConfig => { | ||
const karmaConfig = Object.assign( | ||
{}, | ||
karmaBaseConfig, | ||
{ | ||
browsers: ['ChromeHeadless'], | ||
logLevel: constants.LOG_DISABLE | ||
} | ||
); | ||
|
||
const karmaConfig = Object.assign( | ||
{}, | ||
karmaBaseConfig, | ||
{ | ||
browsers: ['ChromeHeadless'], | ||
logLevel: config.LOG_DISABLE | ||
} | ||
); | ||
|
||
config.set(karmaConfig); | ||
return karmaConfig; | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,85 +1,92 @@ | ||
const process = require('process'); | ||
const path = require('path'); | ||
const webpackConfig = require('./webpack.config.dev'); | ||
const fileHelpers = require('../lib/helpers/files'); | ||
|
||
// https://github.com/webpack/webpack/issues/3324#issuecomment-289720345 | ||
delete webpackConfig.bail; | ||
module.exports = { | ||
|
||
// enable / disable watching file and executing tests whenever any file changes | ||
autoWatch: false, | ||
|
||
// base path that will be used to resolve all patterns (eg. files, exclude) | ||
basePath: process.cwd(), | ||
|
||
browserDisconnectTimeout: 60 * 1000, // default 2000 | ||
browserDisconnectTolerance: 3, // default 0 | ||
browserNoActivityTimeout: 60 * 1000, // default 10000 | ||
|
||
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher | ||
browsers: ['ChromeHeadless'], | ||
|
||
client: { | ||
// Capture all console output and pipe it to the terminal. | ||
captureConsole: false | ||
}, | ||
|
||
captureTimeout: 60 * 2000, // default 60000, | ||
|
||
// enable / disable colors in the output (reporters and logs) | ||
colors: true, | ||
|
||
concurrency: 1, // default Infinity, | ||
|
||
// list of files to exclude | ||
exclude: [], | ||
|
||
// list of files / patterns to load in the browser | ||
files: [ | ||
'test/*.js', | ||
'test/**/*.js', | ||
'main.scss' | ||
], | ||
|
||
// frameworks to use | ||
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter | ||
frameworks: ['mocha', 'sinon'], | ||
|
||
plugins: [ | ||
'karma-mocha', | ||
'karma-sinon', | ||
'karma-webpack', | ||
'karma-browserstack-launcher', | ||
'karma-chrome-launcher', | ||
'karma-sourcemap-loader', | ||
'karma-scss-preprocessor' | ||
], | ||
|
||
// web server port | ||
port: 9876, | ||
|
||
// preprocess matching files before serving them to the browser | ||
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor | ||
preprocessors: { | ||
'test/*.js': ['webpack', 'sourcemap'], | ||
'test/**/*.js': ['webpack', 'sourcemap'], | ||
'main.scss': ['scss'] | ||
}, | ||
scssPreprocessor: { | ||
options: { | ||
includePaths: [process.cwd(), path.join(process.cwd(), 'bower_components')] | ||
} | ||
}, | ||
|
||
// Continuous Integration mode | ||
// if true, Karma captures browsers, runs the tests and exits | ||
singleRun: true, | ||
|
||
webpack: webpackConfig, | ||
|
||
// Hide webpack output logging | ||
webpackMiddleware: { | ||
noInfo: true | ||
} | ||
|
||
module.exports.getBaseKarmaConfig = function() { | ||
return Promise.all([fileHelpers.getModuleName(), fileHelpers.readIfExists(path.resolve('main.scss'))]).then(values => { | ||
const moduleName = values[0]; | ||
const mainScssContent = values[1]; | ||
return { | ||
// enable / disable watching file and executing tests whenever any file changes | ||
autoWatch: false, | ||
|
||
// base path that will be used to resolve all patterns (eg. files, exclude) | ||
basePath: process.cwd(), | ||
|
||
browserDisconnectTimeout: 60 * 1000, // default 2000 | ||
browserDisconnectTolerance: 3, // default 0 | ||
browserNoActivityTimeout: 60 * 1000, // default 10000 | ||
|
||
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher | ||
browsers: ['ChromeHeadless'], | ||
|
||
client: { | ||
// Capture all console output and pipe it to the terminal. | ||
captureConsole: false | ||
}, | ||
|
||
captureTimeout: 60 * 2000, // default 60000, | ||
|
||
// enable / disable colors in the output (reporters and logs) | ||
colors: true, | ||
|
||
concurrency: 1, // default Infinity, | ||
|
||
// list of files to exclude | ||
exclude: [], | ||
|
||
// list of files / patterns to load in the browser | ||
files: [ | ||
'test/*.js', | ||
'test/**/*.js', | ||
'main.scss' | ||
], | ||
|
||
// frameworks to use | ||
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter | ||
frameworks: ['mocha', 'sinon'], | ||
|
||
plugins: [ | ||
'karma-mocha', | ||
'karma-sinon', | ||
'karma-webpack', | ||
'karma-browserstack-launcher', | ||
'karma-chrome-launcher', | ||
'karma-sourcemap-loader', | ||
'karma-scss-preprocessor' | ||
], | ||
|
||
// web server port | ||
port: 9876, | ||
|
||
// preprocess matching files before serving them to the browser | ||
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor | ||
preprocessors: { | ||
'test/*.js': ['webpack', 'sourcemap'], | ||
'test/**/*.js': ['webpack', 'sourcemap'], | ||
'main.scss': ['scss'] | ||
}, | ||
scssPreprocessor: { | ||
options: { | ||
file: '', | ||
data: `$${moduleName}-is-silent: false; ${mainScssContent}`, | ||
includePaths: [process.cwd(), path.join(process.cwd(), 'bower_components')] | ||
} | ||
}, | ||
|
||
// Continuous Integration mode | ||
// if true, Karma captures browsers, runs the tests and exits | ||
singleRun: true, | ||
|
||
webpack: webpackConfig, | ||
|
||
// Hide webpack output logging | ||
webpackMiddleware: { | ||
noInfo: true | ||
} | ||
}; | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.