mirror of
https://github.com/beautifier/js-beautify.git
synced 2025-02-20 13:12:40 +00:00
Add mocha for unit testing
This commit is contained in:
parent
66e7fa0838
commit
2fe86d18ad
@ -382,12 +382,13 @@ test_performance_html_beautify()
|
||||
echo ----------------------------------------
|
||||
}
|
||||
|
||||
test_smoke_js_beautify || exit 1
|
||||
|
||||
test_cli_common css-beautify
|
||||
test_cli_common html-beautify
|
||||
test_cli_common js-beautify
|
||||
|
||||
test_cli_js_beautify
|
||||
test_smoke_js_beautify
|
||||
test_performance_js_beautify
|
||||
test_performance_html_beautify
|
||||
|
||||
|
51
package-lock.json
generated
51
package-lock.json
generated
@ -596,6 +596,12 @@
|
||||
"integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=",
|
||||
"dev": true
|
||||
},
|
||||
"browser-stdout": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz",
|
||||
"integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==",
|
||||
"dev": true
|
||||
},
|
||||
"browserify-aes": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz",
|
||||
@ -1310,6 +1316,12 @@
|
||||
"minimalistic-assert": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"diff": {
|
||||
"version": "3.5.0",
|
||||
"resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz",
|
||||
"integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==",
|
||||
"dev": true
|
||||
},
|
||||
"diffie-hellman": {
|
||||
"version": "5.0.3",
|
||||
"resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz",
|
||||
@ -2567,6 +2579,12 @@
|
||||
"integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=",
|
||||
"dev": true
|
||||
},
|
||||
"growl": {
|
||||
"version": "1.10.5",
|
||||
"resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz",
|
||||
"integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==",
|
||||
"dev": true
|
||||
},
|
||||
"has": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
|
||||
@ -2640,6 +2658,12 @@
|
||||
"minimalistic-assert": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"he": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz",
|
||||
"integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=",
|
||||
"dev": true
|
||||
},
|
||||
"hmac-drbg": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz",
|
||||
@ -3435,6 +3459,33 @@
|
||||
"minimist": "0.0.8"
|
||||
}
|
||||
},
|
||||
"mocha": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz",
|
||||
"integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"browser-stdout": "1.3.1",
|
||||
"commander": "2.15.1",
|
||||
"debug": "3.1.0",
|
||||
"diff": "3.5.0",
|
||||
"escape-string-regexp": "1.0.5",
|
||||
"glob": "7.1.2",
|
||||
"growl": "1.10.5",
|
||||
"he": "1.1.1",
|
||||
"minimatch": "3.0.4",
|
||||
"mkdirp": "0.5.1",
|
||||
"supports-color": "5.4.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"commander": {
|
||||
"version": "2.15.1",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz",
|
||||
"integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"move-concurrently": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz",
|
||||
|
@ -54,6 +54,7 @@
|
||||
"devDependencies": {
|
||||
"benchmark": "^2.1.4",
|
||||
"jshint": "~2.9.1",
|
||||
"mocha": "^5.2.0",
|
||||
"mustache": "~2.3.0",
|
||||
"node-static": "^0.7.10",
|
||||
"requirejs": "^2.3.3",
|
||||
|
@ -322,12 +322,13 @@ test_perf_js_beautify()
|
||||
}
|
||||
|
||||
main() {
|
||||
test_smoke_js_beautify
|
||||
|
||||
#test_cli_common css-beautify
|
||||
#test_cli_common html-beautify
|
||||
test_cli_common js-beautify
|
||||
|
||||
test_cli_js_beautify
|
||||
test_smoke_js_beautify
|
||||
test_perf_js_beautify
|
||||
|
||||
echo ----------------------------------------
|
||||
|
@ -27,6 +27,7 @@ build_full()
|
||||
{
|
||||
build_all
|
||||
build_alltest
|
||||
beautify
|
||||
}
|
||||
|
||||
build_all()
|
||||
@ -50,11 +51,13 @@ build_py()
|
||||
build_js()
|
||||
{
|
||||
echo Building javascript...
|
||||
cd $PROJECT_DIR
|
||||
|
||||
npm install || exit 1
|
||||
generate_tests
|
||||
|
||||
# generate lib files
|
||||
./node_modules/.bin/webpack
|
||||
$PROJECT_DIR/node_modules/.bin/webpack
|
||||
|
||||
mkdir -p ./js/lib/unpackers
|
||||
cp -r ./js/src/unpackers ./js/lib/
|
||||
@ -79,12 +82,20 @@ build_js()
|
||||
|
||||
# jshint
|
||||
$PROJECT_DIR/node_modules/.bin/jshint 'js/src' 'test' || exit 1
|
||||
}
|
||||
|
||||
# beautify test and data
|
||||
beautify()
|
||||
{
|
||||
cd $PROJECT_DIR
|
||||
# beautify test and data
|
||||
for f in $(ls $PROJECT_DIR/js/test/*.js | sort -n); do
|
||||
$PROJECT_DIR/js/bin/js-beautify.js --config $PROJECT_DIR/jsbeautifyrc -r $f || exit 1
|
||||
done
|
||||
|
||||
for f in $(ls $PROJECT_DIR/js/test/core/*.js | sort -n); do
|
||||
$PROJECT_DIR/js/bin/js-beautify.js --config $PROJECT_DIR/jsbeautifyrc -r $f || exit 1
|
||||
done
|
||||
|
||||
for f in $(find $PROJECT_DIR/test/data -name '*.js' | sort -n); do
|
||||
$PROJECT_DIR/js/bin/js-beautify.js --config $PROJECT_DIR/jsbeautifyrc -r $f || exit 1
|
||||
done
|
||||
@ -105,6 +116,8 @@ build_js()
|
||||
|
||||
# jshint again to make sure things haven't changed
|
||||
$PROJECT_DIR/node_modules/.bin/jshint 'js/src' 'test' || exit 1
|
||||
|
||||
build_js
|
||||
}
|
||||
|
||||
generate_tests()
|
||||
@ -122,9 +135,10 @@ build_pytest()
|
||||
{
|
||||
echo Testing python implementation...
|
||||
generate_tests
|
||||
cd python
|
||||
pushd python
|
||||
python --version
|
||||
./jsbeautifier/tests/shell-smoke-test.sh || exit 1
|
||||
popd
|
||||
}
|
||||
|
||||
build_jstest()
|
||||
@ -132,6 +146,7 @@ build_jstest()
|
||||
echo Testing javascript implementation...
|
||||
generate_tests
|
||||
node --version
|
||||
./node_modules/.bin/mocha --recursive js/test || exit 1
|
||||
./js/test/shell-smoke-test.sh || exit 1
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user