Skip to content

Commit e289ef3

Browse files
committed
add a build step to webpack to run micro tests
1 parent 7210377 commit e289ef3

2 files changed

Lines changed: 26 additions & 9 deletions

File tree

‎v5-unity/package.json‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,17 @@
55
"main": "bundle.js",
66
"repository": "https://github.com/pgbovine/OnlinePythonTutor",
77
"license": "BSD-3-Clause",
8-
98
"scripts": {
109
"start": "python bottle_server.py",
1110
"webpack": "webpack --progress --colors --watch",
1211
"prod": "webpack -p"
1312
},
14-
15-
"dependencies" : {
16-
"css-loader" : "",
17-
"style-loader" : "",
18-
"url-loader" : "",
19-
"script-loader" : "",
20-
"ts-loader" : ""
13+
"dependencies": {
14+
"css-loader": "",
15+
"on-build-webpack": "^0.1.0",
16+
"script-loader": "",
17+
"style-loader": "",
18+
"ts-loader": "",
19+
"url-loader": ""
2120
}
2221
}

‎v5-unity/webpack.config.js‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
var webpack = require('webpack');
2+
var WebpackOnBuildPlugin = require('on-build-webpack');
3+
var exec = require('child_process').exec;
24

35
module.exports = {
46
plugins: [
@@ -10,7 +12,23 @@ module.exports = {
1012
jquery: "jquery",
1113
jQuery: "jquery",
1214
$: "jquery"
13-
})
15+
}),
16+
17+
// run a micro frontend regression test after every webpack build
18+
// to sanity-check
19+
new WebpackOnBuildPlugin(function(stats) {
20+
console.log("\n");
21+
exec("cd ../tests/frontend-regression-tests/ && make micro", (error, stdout, stderr) => {
22+
if (error) {
23+
console.error(`Test exec error: ${error}`);
24+
return;
25+
}
26+
console.log(stdout);
27+
if (stderr) {
28+
console.log(`Test stderr: ${stderr}`);
29+
}
30+
});
31+
}),
1432
],
1533

1634
// some included libraries reference 'jquery', so point to it:

0 commit comments

Comments
 (0)