From c1c0330609e029df6a38caf949c5cb59f0de636c Mon Sep 17 00:00:00 2001 From: sanex Date: Mon, 5 Oct 2020 11:23:28 +0300 Subject: [PATCH] Simplified scripts and tests --- .gitignore | 2 +- .npmignore | 1 - .nycrc.json | 3 +++ .travis.yml | 1 - package.json | 11 +++++----- scripts/build | 1 - scripts/remove-cache-dir | 3 --- scripts/test-compile | 4 ---- scripts/test-coveralls | 7 ++---- scripts/test-full | 5 +---- scripts/test-mocha | 5 +---- scripts/test-mocha-coverage | 3 +++ scripts/test-mocha-memory-performance | 5 +---- scripts/test-remove-tmp-dir | 3 --- test/index.spec.ts | 2 -- test/tsconfig.test.json | 1 - yarn.lock | 31 ++++++++++++++++----------- 17 files changed, 36 insertions(+), 52 deletions(-) create mode 100644 .nycrc.json delete mode 100755 scripts/remove-cache-dir delete mode 100755 scripts/test-compile create mode 100755 scripts/test-mocha-coverage delete mode 100755 scripts/test-remove-tmp-dir diff --git a/.gitignore b/.gitignore index 08875089..81a757d0 100644 --- a/.gitignore +++ b/.gitignore @@ -2,12 +2,12 @@ .DS_Store .idea .nyc_output +coverage npm-debug.log *.js.map /coverage /node_modules /test/fixtures/compile-performance-obfuscated.js -/test-tmp /tmp /test/benchmark/**/** *dockerfile diff --git a/.npmignore b/.npmignore index f935df20..6762fe01 100644 --- a/.npmignore +++ b/.npmignore @@ -7,4 +7,3 @@ examples images webpack test -test-tmp diff --git a/.nycrc.json b/.nycrc.json new file mode 100644 index 00000000..dfd21ee3 --- /dev/null +++ b/.nycrc.json @@ -0,0 +1,3 @@ +{ + "extends": "@istanbuljs/nyc-config-typescript" +} \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 4ad378d8..a1240a5d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,3 @@ -sudo: false language: node_js node_js: diff --git a/package.json b/package.json index 43012099..a1c08094 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "dependencies": { "@gradecam/tsenum": "1.2.0", "@nuxtjs/opencollective": "0.2.2", - "acorn": "8.0.2", + "acorn": "8.0.3", "chalk": "4.1.0", "chance": "1.1.7", "class-validator": "0.12.2", @@ -45,6 +45,7 @@ "tslib": "2.0.1" }, "devDependencies": { + "@istanbuljs/nyc-config-typescript": "1.0.1", "@types/chai": "4.2.12", "@types/chance": "1.1.0", "@types/escodegen": "0.0.6", @@ -58,7 +59,7 @@ "@types/multimatch": "4.0.0", "@types/node": "14.11.2", "@types/rimraf": "3.0.0", - "@types/sinon": "9.0.7", + "@types/sinon": "9.0.8", "@types/string-template": "1.0.2", "@types/webpack-env": "1.15.3", "@typescript-eslint/eslint-plugin": "4.3.0", @@ -68,7 +69,7 @@ "coveralls": "3.1.0", "eslint": "7.10.0", "eslint-plugin-import": "2.22.1", - "eslint-plugin-jsdoc": "30.6.2", + "eslint-plugin-jsdoc": "30.6.3", "eslint-plugin-no-null": "1.0.2", "eslint-plugin-prefer-arrow": "1.2.2", "eslint-plugin-unicorn": "22.0.0", @@ -99,16 +100,14 @@ "webpack:dev": "scripts/webpack-dev", "build": "scripts/build", "watch": "scripts/watch", - "removeCacheDir": "scripts/remove-cache-dir", - "test:compile": "scripts/test-compile", "test:dev": "scripts/test-dev", "test:devCompilePerformance": "scripts/test-dev-compile-performance", "test:devRuntimePerformance": "scripts/test-dev-runtime-performance", "test:full": "scripts/test-full", "test:coveralls": "scripts/test-coveralls", "test:mocha": "scripts/test-mocha", + "test:mocha-coverage": "scripts/test-mocha-coverage", "test:mocha-memory-performance": "scripts/test-mocha-memory-performance", - "test:removeTmpDir": "scripts/test-remove-tmp-dir", "test": "scripts/test", "eslint": "scripts/eslint", "travis": "scripts/travis", diff --git a/scripts/build b/scripts/build index 8531aebc..9cf07d79 100755 --- a/scripts/build +++ b/scripts/build @@ -1,6 +1,5 @@ #!/bin/bash -yarn run removeCacheDir && yarn run webpack:prod && yarn run eslint && yarn test \ No newline at end of file diff --git a/scripts/remove-cache-dir b/scripts/remove-cache-dir deleted file mode 100755 index 697630dc..00000000 --- a/scripts/remove-cache-dir +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -rm -rf .awcache \ No newline at end of file diff --git a/scripts/test-compile b/scripts/test-compile deleted file mode 100755 index deb98344..00000000 --- a/scripts/test-compile +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -$(yarn bin)/tsc -p test/tsconfig.test.json --outDir test-tmp && -rsync -a --prune-empty-dirs --include '*/' --include '*.js' --include '*.json' --exclude '*' test/ test-tmp/test/ diff --git a/scripts/test-coveralls b/scripts/test-coveralls index da0724cd..7fc8a4b5 100755 --- a/scripts/test-coveralls +++ b/scripts/test-coveralls @@ -1,7 +1,4 @@ #!/bin/bash -yarn run test:removeTmpDir && -yarn run test:compile && -$(yarn bin)/nyc $(yarn bin)/mocha -- test-tmp/test/index.spec.js --exit && -$(yarn bin)/nyc report --reporter=text-lcov | $(yarn bin)/coveralls && -yarn run test:removeTmpDir \ No newline at end of file +yarn run test:mocha && +$(yarn bin)/nyc report --reporter=text-lcov | $(yarn bin)/coveralls \ No newline at end of file diff --git a/scripts/test-full b/scripts/test-full index a3ec3da3..1a0712b0 100755 --- a/scripts/test-full +++ b/scripts/test-full @@ -1,8 +1,5 @@ #!/bin/bash -yarn run test:removeTmpDir && -yarn run test:compile && yarn run test:dev && -$(yarn bin)/nyc --reporter text-summary $(yarn bin)/mocha -- test-tmp/test/index.spec.js --exit && -yarn run test:removeTmpDir && +yarn run test:mocha-coverage && yarn run test:mocha-memory-performance \ No newline at end of file diff --git a/scripts/test-mocha b/scripts/test-mocha index ccf9f68d..987bfd25 100755 --- a/scripts/test-mocha +++ b/scripts/test-mocha @@ -1,6 +1,3 @@ #!/bin/bash -yarn run test:removeTmpDir && -yarn run test:compile && -$(yarn bin)/mocha test-tmp/test/index.spec.js && -yarn run test:removeTmpDir \ No newline at end of file +$(yarn bin)/mocha --require ts-node/register --require source-map-support/register test/index.spec.ts --exit \ No newline at end of file diff --git a/scripts/test-mocha-coverage b/scripts/test-mocha-coverage new file mode 100755 index 00000000..ba9e8d46 --- /dev/null +++ b/scripts/test-mocha-coverage @@ -0,0 +1,3 @@ +#!/bin/bash + +$(yarn bin)/nyc --reporter text-summary yarn run test:mocha \ No newline at end of file diff --git a/scripts/test-mocha-memory-performance b/scripts/test-mocha-memory-performance index ef08793c..992fd153 100755 --- a/scripts/test-mocha-memory-performance +++ b/scripts/test-mocha-memory-performance @@ -1,6 +1,3 @@ #!/bin/bash -yarn run test:removeTmpDir && -yarn run test:compile && -NODE_OPTIONS=--max-old-space-size=200 $(yarn bin)/mocha test-tmp/test/performance-tests/JavaScriptObfuscatorMemory.spec.js && -yarn run test:removeTmpDir +NODE_OPTIONS=--max-old-space-size=200 $(yarn bin)/mocha --require ts-node/register test/performance-tests/JavaScriptObfuscatorMemory.spec.ts \ No newline at end of file diff --git a/scripts/test-remove-tmp-dir b/scripts/test-remove-tmp-dir deleted file mode 100755 index efb291a9..00000000 --- a/scripts/test-remove-tmp-dir +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -rm -rf test-tmp \ No newline at end of file diff --git a/test/index.spec.ts b/test/index.spec.ts index 02528f7e..091363f4 100644 --- a/test/index.spec.ts +++ b/test/index.spec.ts @@ -1,7 +1,5 @@ import 'reflect-metadata'; -require('source-map-support').install(); - /** * Unit tests */ diff --git a/test/tsconfig.test.json b/test/tsconfig.test.json index ddb066d4..6666bc74 100644 --- a/test/tsconfig.test.json +++ b/test/tsconfig.test.json @@ -1,7 +1,6 @@ { "extends": "../tsconfig.json", "compilerOptions": { - "outDir": "../test-tmp", "noEmitHelpers": true, "importHelpers": true, "inlineSourceMap": true, diff --git a/yarn.lock b/yarn.lock index d9d8eb44..930479a8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -299,6 +299,13 @@ js-yaml "^3.13.1" resolve-from "^5.0.0" +"@istanbuljs/nyc-config-typescript@1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@istanbuljs/nyc-config-typescript/-/nyc-config-typescript-1.0.1.tgz#55172f5663b3635586add21b14d42ca94a163d58" + integrity sha512-/gz6LgVpky205LuoOfwEZmnUtaSmdk0QIMcNFj9OvxhiMhPpKftMgZmGN7jNj7jR+lr8IB1Yks3QSSSNSxfoaQ== + dependencies: + "@istanbuljs/schema" "^0.1.2" + "@istanbuljs/schema@^0.1.2": version "0.1.2" resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.2.tgz#26520bf09abe4a5644cd5414e37125a8954241dd" @@ -534,10 +541,10 @@ "@types/glob" "*" "@types/node" "*" -"@types/sinon@9.0.7": - version "9.0.7" - resolved "https://registry.yarnpkg.com/@types/sinon/-/sinon-9.0.7.tgz#c277e19cf9eb0c71106e785650f1e5c299262302" - integrity sha512-uyFiy2gp4P/FK9pmU3WIbT5ZzH54hCswwRkQFhxX7xl8jzhW3g+xOkVqk5YP4cIO//Few8UDAX0MtzFpqBEqwA== +"@types/sinon@9.0.8": + version "9.0.8" + resolved "https://registry.yarnpkg.com/@types/sinon/-/sinon-9.0.8.tgz#1ed0038d356784f75b086104ef83bfd4130bb81b" + integrity sha512-IVnI820FZFMGI+u1R+2VdRaD/82YIQTdqLYC9DLPszZuynAJDtCvCtCs3bmyL66s7FqRM3+LPX7DhHnVTaagDw== dependencies: "@types/sinonjs__fake-timers" "*" @@ -791,10 +798,10 @@ acorn-jsx@^5.2.0: resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.2.0.tgz#4c66069173d6fdd68ed85239fc256226182b2ebe" integrity sha512-HiUX/+K2YpkpJ+SzBffkM/AQ2YE03S0U1kjTLVpoJdhZMOWy8qvXVN9JdLqv2QsaQ6MPYQIuNmwD8zOiYUofLQ== -acorn@8.0.2: - version "8.0.2" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.0.2.tgz#f7503a253311d4af42332bc188d5713edb2e030a" - integrity sha512-t0Dw7AOyeKs4nez4dhzkBDHB28ICo1pxk3UFsLfsCHOkLW+CwbAZJPMa0vBbq0Mqsslhb7n/7H4qB5txaVQ4ew== +acorn@8.0.3: + version "8.0.3" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.0.3.tgz#68e78e53da020414420282428f1a4afd2075c2dc" + integrity sha512-uRMbCU3bM1L697KISxvkd9TA2zASoGFDODzFFdQR4qNpPffj6ZMdp5J4ffXUXR9G0PVPsN0enEkCrvssCkoPsw== acorn@^6.4.1: version "6.4.1" @@ -2143,10 +2150,10 @@ eslint-plugin-import@2.22.1: resolve "^1.17.0" tsconfig-paths "^3.9.0" -eslint-plugin-jsdoc@30.6.2: - version "30.6.2" - resolved "https://registry.yarnpkg.com/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-30.6.2.tgz#46f1f449dbf53445da2e8231e6954e4484ab5e04" - integrity sha512-LlRdsSQBSPsI3MvhWoGc+Ev3PfFRBk41wwkmbOgC7KP7WQlbeWPpASF5Vdv17XEZ7J+xvPB3KCMyR//6Dbjnnw== +eslint-plugin-jsdoc@30.6.3: + version "30.6.3" + resolved "https://registry.yarnpkg.com/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-30.6.3.tgz#5d946f7a27bd9ee851c67838f607d85ea0492bfa" + integrity sha512-RnyM+a3SKRfPs/jqO2qOGAEZnOJT2dOhiwhBlYVp8/yRUUBNPlvkwZm0arrnyFKvfZX6WqSwlK5OcNnM5W1Etg== dependencies: comment-parser "^0.7.6" debug "^4.1.1"