Last fixes to unit test build configuration

This commit is contained in:
danielyxie 2019-05-09 19:51:56 -07:00
parent 74e72854d8
commit db5fdb1fcb
4 changed files with 11 additions and 2 deletions

@ -109,6 +109,7 @@
"start:dev": "webpack-dev-server --progress --env.devServer --mode development",
"build": "webpack --mode production",
"build:dev": "webpack --mode development",
"build:test": "webpack --config webpack.config-test.js",
"lint": "npm run lint:typescript & npm run lint:javascript & npm run lint:style",
"lint:javascript": "eslint *.js ./src/**/*.js ./tests/**/*.js ./utils/**/*.js",
"lint:style": "stylelint ./css/*",

@ -1,5 +1,5 @@
# Unit Tests
This directory contains unit tests for Bitburner.
Unit tests use Mocha/Chai and are run using mochapack (mocha-webpack fork).
Unit tests use Mocha/Chai and are run using mochapack (a mocha-webpack fork).
Run the test command with `npm run test`

@ -15,7 +15,7 @@
mocha.setup('bdd');
mocha.checkLeaks();
</script>
<script type="module" src="tests.bundle.js"></script>
<script type="module" src="test.bundle.js"></script>
<script class="mocha-exec" type="module">
console.log("Running Tests");
mocha.run();

@ -1,3 +1,6 @@
/**
* Webpack configuration for building unit tests
*/
var path = require('path');
var webpack = require('webpack');
var MiniCssExtractPlugin = require('mini-css-extract-plugin');
@ -30,8 +33,13 @@ module.exports = (env, argv) => {
$: "jquery"
}),
],
entry: "./test/index.js",
target: "web",
devtool: "source-map",
output: {
path: path.resolve(__dirname, "./"),
filename: "test/test.bundle.js",
},
module: {
rules: [
{