Skip to content

Commit

Permalink
chore(test): update jest (#484)
Browse files Browse the repository at this point in the history
* bring jest up to latest version
* remove babel-regenerator dependency
* make test:coverage work
* mock / test logging message for less noisy tests

Fixes N/A
  • Loading branch information
codymikol authored Feb 14, 2021
1 parent 2d6aecb commit ef7edb6
Show file tree
Hide file tree
Showing 10 changed files with 21,280 additions and 14,424 deletions.
10 changes: 5 additions & 5 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"presets": [
[
"env",
"@babel/preset-env",
{
"useBuiltIns": true,
"targets": {
"node": "6.9.0"
"node": "10"
},
"exclude": [
"transform-async-to-generator",
Expand All @@ -16,7 +16,7 @@
],
"plugins": [
[
"transform-object-rest-spread",
"@babel/plugin-proposal-object-rest-spread",
{
"useBuiltIns": true
}
Expand All @@ -25,10 +25,10 @@
"env": {
"test": {
"presets": [
"env"
"@babel/preset-env"
],
"plugins": [
"transform-object-rest-spread"
"@babel/plugin-proposal-object-rest-spread"
]
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/karma-webpack/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ defaulting ${newOptions.output.filename} to [name].js.`.trim()
});
}

async bundle() {
bundle() {
if (this.isActive === false && this.hasBeenBuiltAtLeastOnce === false) {
console.log('Webpack bundling...');
this._activePromise = this._bundle();
}
return this._activePromise;
}

async _bundle() {
_bundle() {
this.isActive = true;

return new Promise((resolve) => {
Expand Down
16 changes: 8 additions & 8 deletions lib/karma-webpack/preprocessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,17 @@ ignoring attempt to set the entry option...
return `${path.join(info.dir, info.name)}.js`;
});

return async function processFile(content, file, done) {
await controller.bundle();
return function processFile(content, file, done) {
controller.bundle().then(() => {
file.path = normalize(file.path); // eslint-disable-line no-param-reassign

file.path = normalize(file.path); // eslint-disable-line no-param-reassign
const transformedFilePath = transformPath(getPathKey(file.path, true));
const bundleContent = controller.bundlesContent[transformedFilePath];

const transformedFilePath = transformPath(getPathKey(file.path, true));
const bundleContent = controller.bundlesContent[transformedFilePath];
file.path = transformedFilePath;

file.path = transformedFilePath;

done(null, bundleContent);
done(null, bundleContent);
});
};
}

Expand Down
2 changes: 1 addition & 1 deletion lib/webpack/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class KW_WebpackPlugin {
this.compiler = compiler;

// webpack bundles are finished
compiler.hooks.done.tap('KW_WebpackPlugin', async (stats) => {
compiler.hooks.done.tap('KW_WebpackPlugin', (stats) => {
// read generated file content and store for karma preprocessor
this.controller.bundlesContent = {};
stats.toJson().assets.forEach((webpackFileObj) => {
Expand Down
Loading

0 comments on commit ef7edb6

Please sign in to comment.