Run unit tests through karma
This commit is contained in:
parent
026af8bdd2
commit
79791f41cc
14
npm
Executable file
14
npm
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
# Use as alternative to npm to run in local node.js environment
|
||||
# REQUIRES python3, else falls back to system-wide npm
|
||||
|
||||
set -e
|
||||
|
||||
which python3 > /dev/null 2>&1 || ( npm "$@" && exit 0 )
|
||||
|
||||
dir=$(dirname $0)
|
||||
|
||||
test -x "${dir}/.env/bin/nodeenv" || ( virtualenv -p python3 "${dir}/.env" && "${dir}/.env/bin/pip" install --upgrade nodeenv )
|
||||
test -f "${dir}/.env/node/bin/activate" || "${dir}/.env/bin/nodeenv" --node=latest --force "${dir}/.env/node"
|
||||
PATH="${dir}/.env/node/bin:${PATH}" npm "$@"
|
||||
|
|
@ -6,8 +6,8 @@
|
|||
"scripts": {
|
||||
"deps": "bower install && typings install",
|
||||
"build": "tsc -p .",
|
||||
"test": "jasmine",
|
||||
"build-test": "tsc -p . && jasmine",
|
||||
"test": "karma start spec/support/karma.conf.js",
|
||||
"build-test": "npm run build && npm run test",
|
||||
"cover": "istanbul cover node_modules/jasmine/bin/jasmine.js && remap-istanbul -i coverage/coverage.json -o coverage -t html",
|
||||
"serve": "simple-server out 8012"
|
||||
},
|
||||
|
@ -21,9 +21,12 @@
|
|||
"bower": "~1.8",
|
||||
"istanbul": "~0.4",
|
||||
"jasmine": "~2.5",
|
||||
"karma": "~1.3",
|
||||
"karma-jasmine": "~1.1",
|
||||
"karma-phantomjs-launcher": "~1.0",
|
||||
"remap-istanbul": "~0.6",
|
||||
"simple-server": "~1.0",
|
||||
"typescript": "~2.1",
|
||||
"typings": "~1.4"
|
||||
}
|
||||
}
|
||||
}
|
16
spec/support/karma.conf.js
Normal file
16
spec/support/karma.conf.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
// karma.conf.js
|
||||
module.exports = function(config) {
|
||||
config.set({
|
||||
basePath: '../..',
|
||||
frameworks: ['jasmine'],
|
||||
singleRun: true,
|
||||
browsers: ['PhantomJS'],
|
||||
reporters: ['dots'],
|
||||
logLevel: config.LOG_WARN,
|
||||
|
||||
files: [
|
||||
'out/vendor/phaser/build/phaser.js',
|
||||
'out/build.js'
|
||||
]
|
||||
})
|
||||
}
|
Loading…
Reference in a new issue