0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-11-29 10:10:53 -05:00

changed tests to use a production build rather than source

This commit is contained in:
liabru 2021-11-21 16:58:29 +00:00
parent 8bfaff0cce
commit 55feb89f95
5 changed files with 11 additions and 9 deletions

2
.gitignore vendored
View file

@ -5,6 +5,8 @@ docs
matter-doc-theme
build/matter-dev.js
build/matter-dev.min.js
build/matter.dev.js
build/matter.dev.min.js
demo/js/lib/matter-dev.js
demo/js/Examples.min.js
examples/build

View file

@ -44,7 +44,8 @@
"serve": "webpack-dev-server --no-cache --mode development --config webpack.demo.config.js",
"watch": "nodemon --watch webpack.demo.config.js --exec \"npm run serve\"",
"build": "webpack --mode=production --no-hot --no-watch & webpack --mode=production --no-hot --no-watch --env.MINIMIZE",
"build-alpha": "webpack --mode=production --env.ALPHA & webpack --mode=production --env.MINIMIZE --env.ALPHA",
"build-alpha": "webpack --mode=production --no-hot --no-watch --env.KIND=alpha & webpack --mode=production --no-hot --no-watch --env.MINIMIZE --env.KIND=alpha",
"build-dev": "webpack --mode=production --no-hot --no-watch --env.KIND=dev & webpack --mode=production --no-hot --no-watch --env.MINIMIZE --env.KIND=dev",
"build-demo": "rm -rf ./demo/js && webpack --no-hot --no-watch --config webpack.demo.config.js --mode=production && webpack --no-hot --no-watch --config webpack.demo.config.js --mode=production --env.MINIMIZE",
"lint": "eslint 'src/**/*.js' 'demo/src/**/*.js' 'examples/*.js' 'webpack.*.js'",
"doc": "yuidoc --config yuidoc.json --project-version $npm_package_version",
@ -53,7 +54,7 @@
"test-all": "jest --no-cache",
"test-save": "SAVE=true npm run test-node",
"test-watch": "npm run test-node -- --watch",
"test-node": "node --expose-gc node_modules/.bin/jest --no-cache --runInBand ./test/Examples.spec.js",
"test-node": "npm run build-dev && node --expose-gc node_modules/.bin/jest --no-cache --runInBand ./test/Examples.spec.js",
"test-browser": "node --expose-gc node_modules/.bin/jest --no-cache --runInBand ./test/Browser.spec.js",
"changelog": "conventional-changelog -i CHANGELOG.md -s -r",
"release": "npm version --no-git-tag-version",

View file

@ -21,7 +21,7 @@ const reset = M => {
const mock = require('mock-require');
const { engineCapture } = require('./TestTools');
const MatterDev = stubBrowserFeatures(require('../src/module/main'));
const MatterDev = stubBrowserFeatures(require('../build/matter.dev'));
const MatterBuild = stubBrowserFeatures(require('../build/matter'));
const Example = require('../examples/index');

View file

@ -224,7 +224,7 @@ const logReport = (captures, version) => {
}
}
return `Output logs from ${color(version, colors.Yellow)} version on last run\n\n`
return `Output logs from ${color(version, colors.Yellow)} build on last run\n\n`
+ (report ? report : ' None\n');
};

View file

@ -9,18 +9,17 @@ const execSync = require('child_process').execSync;
module.exports = (env = {}) => {
const minimize = env.MINIMIZE || false;
const alpha = env.ALPHA || false;
const kind = env.KIND || null;
const sizeThreshold = minimize ? 100 * 1024 : 512 * 1024;
const commitHash = execSync('git rev-parse --short HEAD').toString().trim();
const version = !alpha ? pkg.version : `${pkg.version}-alpha+${commitHash}`;
const version = !kind ? pkg.version : `${pkg.version}-${kind}+${commitHash}`;
const license = fs.readFileSync('LICENSE', 'utf8');
const resolve = relativePath => path.resolve(__dirname, relativePath);
const alphaInfo = 'Experimental pre-release build.\n ';
const banner =
`${pkg.name} ${version} by @liabru
${alpha ? alphaInfo : ''}${pkg.homepage}
${kind ? 'Experimental pre-release build.\n ' : ''}${pkg.homepage}
License ${pkg.license}${!minimize ? '\n\n' + license : ''}`;
return {
@ -32,7 +31,7 @@ License ${pkg.license}${!minimize ? '\n\n' + license : ''}`;
umdNamedDefine: true,
globalObject: 'this',
path: resolve('./build'),
filename: `[name]${alpha ? '.alpha' : ''}${minimize ? '.min' : ''}.js`
filename: `[name]${kind ? '.' + kind : ''}${minimize ? '.min' : ''}.js`
},
optimization: { minimize },
performance: {