added mocha/chai/sinon test config
This commit is contained in:
14
package.json
14
package.json
@@ -10,7 +10,7 @@
|
|||||||
"push-main": "rollup -c --environment DEST:main",
|
"push-main": "rollup -c --environment DEST:main",
|
||||||
"push-pserver": "rollup -c --environment DEST:pserver",
|
"push-pserver": "rollup -c --environment DEST:pserver",
|
||||||
"push-sim": "rollup -c --environment DEST:sim",
|
"push-sim": "rollup -c --environment DEST:sim",
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "rollup -c rollup.test-config.js && mocha dist/test.bundle.js",
|
||||||
"watch-main": "rollup -cw --environment DEST:main",
|
"watch-main": "rollup -cw --environment DEST:main",
|
||||||
"watch-pserver": "rollup -cw --environment DEST:pserver",
|
"watch-pserver": "rollup -cw --environment DEST:pserver",
|
||||||
"watch-sim": "rollup -cw --environment DEST:sim"
|
"watch-sim": "rollup -cw --environment DEST:sim"
|
||||||
@@ -26,16 +26,28 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/screepers/screeps-typescript-starter#readme",
|
"homepage": "https://github.com/screepers/screeps-typescript-starter#readme",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@types/chai": "^4.1.6",
|
||||||
"@types/lodash": "^3.10.1",
|
"@types/lodash": "^3.10.1",
|
||||||
|
"@types/mocha": "^5.2.5",
|
||||||
"@types/node": "^10.5.5",
|
"@types/node": "^10.5.5",
|
||||||
"@types/screeps": "^2.4.0",
|
"@types/screeps": "^2.4.0",
|
||||||
|
"@types/sinon": "^5.0.5",
|
||||||
|
"@types/sinon-chai": "^3.2.0",
|
||||||
|
"chai": "^4.2.0",
|
||||||
|
"lodash": "^4.17.11",
|
||||||
|
"mocha": "^5.2.0",
|
||||||
"prettier": "^1.14.0",
|
"prettier": "^1.14.0",
|
||||||
"rollup": "^0.63.4",
|
"rollup": "^0.63.4",
|
||||||
|
"rollup-plugin-buble": "^0.19.4",
|
||||||
"rollup-plugin-clear": "^2.0.7",
|
"rollup-plugin-clear": "^2.0.7",
|
||||||
"rollup-plugin-commonjs": "^9.1.4",
|
"rollup-plugin-commonjs": "^9.1.4",
|
||||||
|
"rollup-plugin-multi-entry": "^2.0.2",
|
||||||
"rollup-plugin-node-resolve": "^3.3.0",
|
"rollup-plugin-node-resolve": "^3.3.0",
|
||||||
"rollup-plugin-screeps": "^0.1.2",
|
"rollup-plugin-screeps": "^0.1.2",
|
||||||
"rollup-plugin-typescript2": "^0.16.1",
|
"rollup-plugin-typescript2": "^0.16.1",
|
||||||
|
"sinon": "^6.3.5",
|
||||||
|
"sinon-chai": "^3.2.0",
|
||||||
|
"ts-node": "^7.0.1",
|
||||||
"tslint": "^5.9.1",
|
"tslint": "^5.9.1",
|
||||||
"tslint-config-prettier": "^1.14.0",
|
"tslint-config-prettier": "^1.14.0",
|
||||||
"tslint-plugin-prettier": "^1.3.0",
|
"tslint-plugin-prettier": "^1.3.0",
|
||||||
|
|||||||
30
rollup.test-config.js
Normal file
30
rollup.test-config.js
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
import resolve from "rollup-plugin-node-resolve";
|
||||||
|
import commonjs from "rollup-plugin-commonjs";
|
||||||
|
import typescript from "rollup-plugin-typescript2";
|
||||||
|
import buble from 'rollup-plugin-buble';
|
||||||
|
import multiEntry from 'rollup-plugin-multi-entry';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
input: 'test/**/*.test.ts',
|
||||||
|
output: {
|
||||||
|
file: 'dist/test.bundle.js',
|
||||||
|
name: 'lib',
|
||||||
|
sourcemap: true,
|
||||||
|
format: 'iife',
|
||||||
|
globals: {
|
||||||
|
chai: 'chai',
|
||||||
|
it: 'it',
|
||||||
|
describe: 'describe'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
external: ['chai', 'it', 'describe'],
|
||||||
|
plugins: [
|
||||||
|
resolve(),
|
||||||
|
commonjs(),
|
||||||
|
typescript({tsconfig: "./tsconfig.json"}),
|
||||||
|
multiEntry(),
|
||||||
|
buble()
|
||||||
|
]
|
||||||
|
}
|
||||||
12
test/mocha.opts
Normal file
12
test/mocha.opts
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
--require test/setup-node.js
|
||||||
|
--require ts-node/register
|
||||||
|
--ui bdd
|
||||||
|
|
||||||
|
--reporter spec
|
||||||
|
--bail
|
||||||
|
--full-trace
|
||||||
|
--watch-extensions tsx,ts
|
||||||
|
--colors
|
||||||
|
|
||||||
|
--recursive
|
||||||
|
--timeout 5000
|
||||||
6
test/setup-node.js
Normal file
6
test/setup-node.js
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
//inject mocha globally to allow custom interface refer without direct import - bypass bundle issue
|
||||||
|
global._ = require('lodash');
|
||||||
|
global.mocha = require('mocha');
|
||||||
|
global.chai = require('chai');
|
||||||
|
global.sinon = require('sinon');
|
||||||
|
global.chai.use(require('sinon-chai'));
|
||||||
Reference in New Issue
Block a user