Add mocha tests to npm test

This commit is contained in:
Guangcong Luo
2018-10-16 03:31:27 -05:00
parent 9019543dc1
commit f86245febb
4 changed files with 9 additions and 8 deletions

View File

@@ -7,4 +7,5 @@ node_modules/
/js/battle-dex.js
/js/battle-dex-data.js
/js/battle-animations-moves.js
/js/battle-scene-stub.js
/js/battle-animations.js

View File

@@ -4,9 +4,6 @@
* This script parses index.html and sets the version query string of each
* resource to be the MD5 hash of that resource.
* It also updates news and the learnsets-g6.js file.
*
* On the live web server, this script is set as the following git hooks:
* post-commit, post-checkout, post-merge, post-rewrite
*/
"use strict";

View File

@@ -9,7 +9,7 @@
"url": "https://github.com/Zarel/Pokemon-Showdown-Client.git"
},
"scripts": {
"test": "eslint --config=.eslintrc.js --cache --cache-file=eslint-cache/base js/ && eslint --config=build-tools/.eslintrc.js --cache --cache-file=eslint-cache/build build-tools/update build-tools/build-indexes",
"test": "eslint --config=.eslintrc.js --cache --cache-file=eslint-cache/base js/ && eslint --config=build-tools/.eslintrc.js --cache --cache-file=eslint-cache/build build-tools/update build-tools/build-indexes && node build && mocha",
"fix": "eslint --config=.eslintrc.js --fix js/ && eslint --config=build-tools/.eslintrc.js --fix build-tools/update build-tools/build-indexes"
},
"dependencies": {

View File

@@ -1,13 +1,16 @@
const fs = require('fs');
const path = require('path');
const assert = require('assert').strict;
process.chdir(path.resolve(__dirname, '..'));
window = global;
// Without making these modules, the best we can do is directly include them into this workspace.
eval('' + fs.readFileSync(`${__dirname}/../js/battle-scene-stub.js`));
eval('' + fs.readFileSync(`${__dirname}/../js/battle-dex.js`));
eval('' + fs.readFileSync(`${__dirname}/../js/battle-dex-data.js`));
eval('' + fs.readFileSync(`${__dirname}/../js/battle.js`));
eval('' + fs.readFileSync(`js/battle-scene-stub.js`));
eval('' + fs.readFileSync(`js/battle-dex.js`));
eval('' + fs.readFileSync(`js/battle-dex-data.js`));
eval('' + fs.readFileSync(`js/battle.js`));
describe('Battle', function () {