瀏覽代碼

Simplified scripts and tests

sanex 4 年之前
父節點
當前提交
c1c0330609

+ 1 - 1
.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

+ 0 - 1
.npmignore

@@ -7,4 +7,3 @@ examples
 images
 webpack
 test
-test-tmp

+ 3 - 0
.nycrc.json

@@ -0,0 +1,3 @@
+{
+  "extends": "@istanbuljs/nyc-config-typescript"
+}

+ 0 - 1
.travis.yml

@@ -1,4 +1,3 @@
-sudo: false
 language: node_js
 
 node_js:

+ 5 - 6
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",

+ 0 - 1
scripts/build

@@ -1,6 +1,5 @@
 #!/bin/bash
 
-yarn run removeCacheDir &&
 yarn run webpack:prod &&
 yarn run eslint &&
 yarn test

+ 0 - 3
scripts/remove-cache-dir

@@ -1,3 +0,0 @@
-#!/bin/bash
-
-rm -rf .awcache

+ 0 - 4
scripts/test-compile

@@ -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/

+ 2 - 5
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
+yarn run test:mocha &&
+$(yarn bin)/nyc report --reporter=text-lcov | $(yarn bin)/coveralls

+ 1 - 4
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

+ 1 - 4
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
+$(yarn bin)/mocha --require ts-node/register --require source-map-support/register test/index.spec.ts --exit

+ 3 - 0
scripts/test-mocha-coverage

@@ -0,0 +1,3 @@
+#!/bin/bash
+
+$(yarn bin)/nyc --reporter text-summary yarn run test:mocha

+ 1 - 4
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

+ 0 - 3
scripts/test-remove-tmp-dir

@@ -1,3 +0,0 @@
-#!/bin/bash
-
-rm -rf test-tmp

+ 0 - 2
test/index.spec.ts

@@ -1,7 +1,5 @@
 import 'reflect-metadata';
 
-require('source-map-support').install();
-
 /**
  * Unit tests
  */

+ 0 - 1
test/tsconfig.test.json

@@ -1,7 +1,6 @@
 {
   "extends": "../tsconfig.json",
   "compilerOptions": {
-    "outDir": "../test-tmp",
     "noEmitHelpers": true,
     "importHelpers": true,
     "inlineSourceMap": true,

+ 19 - 12
yarn.lock

@@ -299,6 +299,13 @@
     js-yaml "^3.13.1"
     resolve-from "^5.0.0"
 
+"@istanbuljs/[email protected]":
+  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/[email protected].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/[email protected].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==
 
[email protected].2:
-  version "8.0.2"
-  resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.0.2.tgz#f7503a253311d4af42332bc188d5713edb2e030a"
-  integrity sha512-t0Dw7AOyeKs4nez4dhzkBDHB28ICo1pxk3UFsLfsCHOkLW+CwbAZJPMa0vBbq0Mqsslhb7n/7H4qB5txaVQ4ew==
[email protected].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 @@ [email protected]:
     resolve "^1.17.0"
     tsconfig-paths "^3.9.0"
 
[email protected].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==
[email protected].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"