Skip to content

Commit d8d280d

Browse files
committed
fix tests
1 parent ca78dd5 commit d8d280d

2 files changed

Lines changed: 24 additions & 4 deletions

File tree

workers/release/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
"private": true,
1111
"devDependencies": {
1212
"rimraf": "^3.0.0",
13-
"webpack": "^4.39.3"
13+
"webpack": "^5.95.0"
1414
}
1515
}

workers/release/tests/create-mock-bundle.ts

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,27 +27,47 @@ export default class MockBundle {
2727
entry: this.entry,
2828
output: {
2929
path: this.outputDir,
30-
libraryExport: 'default',
30+
filename: 'main.js',
31+
library: {
32+
type: 'commonjs2',
33+
export: 'default',
34+
},
3135
},
3236
devtool: 'source-map',
37+
/**
38+
* Webpack 5 requires explicit target configuration
39+
*/
40+
target: 'node',
3341
}, (err, stats) => {
3442
if (err) {
43+
console.error('[MockBundle] Webpack compilation error:', err);
3544
reject(err);
3645

3746
return;
3847
}
3948

49+
if (!stats) {
50+
reject(new Error('Webpack stats is undefined'));
51+
52+
return;
53+
}
54+
4055
const info = stats.toJson();
4156

4257
if (stats.hasErrors()) {
58+
console.error('[MockBundle] Webpack compilation errors:');
59+
console.error(JSON.stringify(info.errors, null, 2));
4360
reject(info.errors);
61+
62+
return;
4463
}
4564

4665
if (stats.hasWarnings()) {
47-
console.warn(info.warnings);
66+
console.warn('[MockBundle] Webpack compilation warnings:');
67+
console.warn(JSON.stringify(info.warnings, null, 2));
4868
}
4969

50-
resolve(info);
70+
resolve();
5171
});
5272
});
5373
}

0 commit comments

Comments
 (0)