Skip to content

Commit

Permalink
build: Switch to webpack 5.
Browse files Browse the repository at this point in the history
This has many fewer stale npm packages (so many fewer warnings).  Tests
can use all of modern javascript.  This should be easier to maintain in
the future.

Note the built bundles are somewhat smaller due to modernization of some
packages.

This is part of and closes #1132.
  • Loading branch information
manthey committed Jan 4, 2022
1 parent dcedf97 commit 22c7040
Show file tree
Hide file tree
Showing 17 changed files with 7,985 additions and 12,710 deletions.
2 changes: 1 addition & 1 deletion examples/blog-lines/index.pug
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ block append mainContent
p A modest number of line segments from a real-world sample.
#lines_list
b Compare line drawing between libraries, versions, and rendering methods
div
#feature-div
label(for='feature') Feature
select#feature
#info
Expand Down
3 changes: 3 additions & 0 deletions examples/blog-lines/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,6 @@ table tr>td:first-child {
width: 322px;
height: 24px;
}
#feature-div {
height: 27px;
}
26 changes: 17 additions & 9 deletions karma-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,10 @@ var FirefoxPrefs = {
'media.gmp-manager.url': ''
};

module.exports = function (config) {
webpack_config.plugins.push(function () {
this.plugin('done', function (stats) {
/* If webpack of a test fails, stop rather than run some tests */
class KarmaWarningsToErrorsWebpackPlugin {
apply(compiler) {
compiler.hooks.done.tap('KarmaWarningsToErrorsWebpackPlugin', (stats) => {
if (stats.compilation.warnings.length) {
// Log each of the warnings
stats.compilation.warnings.forEach(function (warning) {
Expand All @@ -240,7 +241,12 @@ module.exports = function (config) {
}];
}
});
});
}
}

module.exports = function (config) {
/* If webpack of a test fails, stop rather than run some tests */
webpack_config.plugins.push(new KarmaWarningsToErrorsWebpackPlugin());
var newConfig = {
autoWatch: false,
files: [
Expand Down Expand Up @@ -312,12 +318,16 @@ module.exports = function (config) {
}, FirefoxPrefs)
}
},
browserDisconnectTimeout: 30000,
browserDisconnectTolerance: 3,
browserNoActivityTimeout: 300000,
reporters: [
'spec', // we had used the 'progress' reporter in the past.
'kjhtml'
],
// We could suppress passing results
/* enable for testing */
// logLevel: config.LOG_DEBUG,
/* We could suppress passing results */
// specReporter = {suppressPassed: true, suppressSkipped: true},
middleware: [
'testimage',
Expand All @@ -330,7 +340,7 @@ module.exports = function (config) {
],
preprocessors: {},
frameworks: [
'jasmine', 'sinon'
'jasmine', 'sinon', 'webpack'
],
client: {
jasmine: {
Expand All @@ -339,9 +349,7 @@ module.exports = function (config) {
}
},
webpack: {
/* webpack 4
mode: 'production',
*/
mode: 'development',
performance: {hints: false},
cache: true,
devtool: 'inline-source-map',
Expand Down
Loading

0 comments on commit 22c7040

Please sign in to comment.