Merge pull request #3826 from thelounge/xpaw/mocharc
Upgrade to mocha@7 and remove mochapack
This commit is contained in:
commit
8e00e26054
10
package.json
10
package.json
@ -13,7 +13,7 @@
|
|||||||
"homepage": "https://thelounge.chat/",
|
"homepage": "https://thelounge.chat/",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "webpack",
|
"build": "webpack",
|
||||||
"coverage": "run-s test:{client,server} && nyc --nycrc-path=test/.nycrc-report.json report",
|
"coverage": "run-s test:* && nyc --nycrc-path=test/.nycrc-report.json report",
|
||||||
"dev": "node index start --dev",
|
"dev": "node index start --dev",
|
||||||
"format:prettier": "prettier --write \"**/*.*\"",
|
"format:prettier": "prettier --write \"**/*.*\"",
|
||||||
"lint:check-eslint": "eslint --print-config .eslintrc.yml | eslint-config-prettier-check",
|
"lint:check-eslint": "eslint --print-config .eslintrc.yml | eslint-config-prettier-check",
|
||||||
@ -21,9 +21,8 @@
|
|||||||
"lint:prettier": "prettier --list-different \"**/*.*\"",
|
"lint:prettier": "prettier --list-different \"**/*.*\"",
|
||||||
"lint:stylelint": "stylelint --color \"client/**/*.css\"",
|
"lint:stylelint": "stylelint --color \"client/**/*.css\"",
|
||||||
"start": "node index start",
|
"start": "node index start",
|
||||||
"test": "run-p --aggregate-output --continue-on-error lint:* test:{client,server}",
|
"test": "run-p --aggregate-output --continue-on-error lint:* test:*",
|
||||||
"test:client": "nyc --nycrc-path=test/.nycrc-mochapack.json mochapack --colors --opts=test/mochapack.opts",
|
"test:mocha": "webpack --config webpack.config-test.js && nyc --nycrc-path=test/.nycrc-mocha.json mocha --colors --config=test/.mocharc.yml",
|
||||||
"test:server": "nyc --nycrc-path=test/.nycrc-mocha.json mocha --colors",
|
|
||||||
"watch": "webpack --watch"
|
"watch": "webpack --watch"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
@ -92,8 +91,7 @@
|
|||||||
"husky": "4.2.5",
|
"husky": "4.2.5",
|
||||||
"intersection-observer": "0.7.0",
|
"intersection-observer": "0.7.0",
|
||||||
"mini-css-extract-plugin": "0.9.0",
|
"mini-css-extract-plugin": "0.9.0",
|
||||||
"mocha": "6.2.2",
|
"mocha": "7.1.1",
|
||||||
"mochapack": "1.1.13",
|
|
||||||
"mousetrap": "1.6.5",
|
"mousetrap": "1.6.5",
|
||||||
"normalize.css": "8.0.1",
|
"normalize.css": "8.0.1",
|
||||||
"npm-run-all": "4.1.5",
|
"npm-run-all": "4.1.5",
|
||||||
|
8
test/.mocharc.yml
Normal file
8
test/.mocharc.yml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
color: true
|
||||||
|
check-leaks: true
|
||||||
|
recursive: true
|
||||||
|
reporter: dot
|
||||||
|
interactive: false
|
||||||
|
spec: "test/**/*.js"
|
||||||
|
ignore: "test/client/**"
|
||||||
|
require: "test/fixtures/env"
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"all": true,
|
|
||||||
"temp-dir": "./node_modules/.cache/nyc_output",
|
|
||||||
"include": ["client/"],
|
|
||||||
"reporter": ["json", "text-summary"]
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
--check-leaks
|
|
||||||
--recursive
|
|
||||||
--reporter dot
|
|
||||||
--require test/fixtures/env
|
|
||||||
test/{,!(client)/**/}*.js
|
|
@ -1,6 +0,0 @@
|
|||||||
--check-leaks
|
|
||||||
--interactive false
|
|
||||||
--recursive
|
|
||||||
--reporter dot
|
|
||||||
--webpack-config webpack.config-test.js
|
|
||||||
test/client/**/*.js
|
|
@ -1,11 +1,24 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const webpack = require("webpack");
|
const webpack = require("webpack");
|
||||||
|
const fs = require("fs");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
const VueLoaderPlugin = require("vue-loader/lib/plugin");
|
||||||
const config = require("./webpack.config.js");
|
const config = require("./webpack.config.js");
|
||||||
|
|
||||||
|
const testFile = path.resolve(__dirname, "test/public/testclient.js");
|
||||||
|
|
||||||
|
if (fs.existsSync(testFile)) {
|
||||||
|
fs.unlinkSync(testFile);
|
||||||
|
}
|
||||||
|
|
||||||
config.target = "node";
|
config.target = "node";
|
||||||
config.devtool = "eval";
|
config.devtool = "eval";
|
||||||
|
config.stats = "errors-only";
|
||||||
|
config.output.path = path.resolve(__dirname, "test/public");
|
||||||
|
config.entry = {
|
||||||
|
"testclient.js": [path.resolve(__dirname, "test/client/index.js")],
|
||||||
|
};
|
||||||
|
|
||||||
// Add the istanbul plugin to babel-loader options
|
// Add the istanbul plugin to babel-loader options
|
||||||
for (const rule of config.module.rules) {
|
for (const rule of config.module.rules) {
|
||||||
@ -19,15 +32,18 @@ for (const rule of config.module.rules) {
|
|||||||
// - https://github.com/webpack/webpack/issues/6727#issuecomment-372589122
|
// - https://github.com/webpack/webpack/issues/6727#issuecomment-372589122
|
||||||
config.optimization.splitChunks = false;
|
config.optimization.splitChunks = false;
|
||||||
|
|
||||||
// "Fixes" Critical dependency: the request of a dependency is an expression
|
// Disable plugins like copy files, it is not required
|
||||||
config.plugins.push(new webpack.ContextReplacementPlugin(/vue-server-renderer$/));
|
config.plugins = [
|
||||||
|
new VueLoaderPlugin(),
|
||||||
|
|
||||||
// Client tests that require Vue may end up requireing socket.io
|
// Client tests that require Vue may end up requireing socket.io
|
||||||
config.plugins.push(
|
|
||||||
new webpack.NormalModuleReplacementPlugin(
|
new webpack.NormalModuleReplacementPlugin(
|
||||||
/js(\/|\\)socket\.js/,
|
/js(\/|\\)socket\.js/,
|
||||||
path.resolve(__dirname, "scripts/noop.js")
|
path.resolve(__dirname, "scripts/noop.js")
|
||||||
)
|
),
|
||||||
);
|
|
||||||
|
// "Fixes" Critical dependency: the request of a dependency is an expression
|
||||||
|
new webpack.ContextReplacementPlugin(/vue-server-renderer$/),
|
||||||
|
];
|
||||||
|
|
||||||
module.exports = config;
|
module.exports = config;
|
||||||
|
Loading…
Reference in New Issue
Block a user