]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
test: add type check to test command
authorEduardo San Martin Morote <posva13@gmail.com>
Mon, 1 Jul 2019 17:52:47 +0000 (19:52 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Mon, 1 Jul 2019 17:52:47 +0000 (19:52 +0200)
__tests__/tsconfig.json
jest.config.js
package.json
tsconfig.check-types.json [new file with mode: 0644]

index 59ce02054ccb6425435beb1ee11423638454649d..533ede6c2cc14427a64ed827b19e2d05212f13c9 100644 (file)
@@ -1,8 +1,12 @@
 {
-  "include": ["./**/*.ts"],
+  "include": ["./**/*.ts", "./**/*.js"],
+  "exclude": ["./helper.js"],
   "compilerOptions": {
     "target": "esnext",
     "module": "commonjs",
-    "allowJs": true
+    "noEmit": true,
+    "checkJs": true,
+    "allowJs": true,
+    "esModuleInterop": true
   }
 }
index 2ebfd6df82bbbac42dd795a0922085c9f6502f25..83e5bd1e0735a9cf7eac084e422923472e7663ff 100644 (file)
@@ -1,7 +1,12 @@
 module.exports = {
   preset: 'ts-jest',
   collectCoverageFrom: ['src/**/*.ts'],
-  coveragePathIgnorePatterns: ['/node_modules/', 'src/index.ts'],
+  coveragePathIgnorePatterns: [
+    '/node_modules/',
+    'src/index.ts',
+    'src/entries',
+    'src/consola.ts',
+  ],
   testMatch: [
     '**/__tests__/**/*.spec.[j]s?(x)',
     // '**/__tests__/**/*.spec.[jt]s?(x)',
index 6de03dd68a0ed3655cc87a63514638af05f5fd17..fd6b6ee71d8e65dfe35a74718d1ece9ef6e7b922 100644 (file)
@@ -9,11 +9,13 @@
   "types": "dist/index.d.ts",
   "license": "MIT",
   "scripts": {
-    "test:types": "tsc --build tsconfig.json",
+    "test:types:src": "tsc --build tsconfig.check-types.json",
+    "test:types:test": "tsc --build __tests__/tsconfig.json",
+    "test:types": "yarn test:types:src && yarn test:types:test",
     "test:unit": "jest --coverage",
     "test:mocha": "NODE_ENV=test mocha -r ts-node/register __tests__/**/*.spec.js __tests__/*.spec.js",
     "test:mocha:dev": "yarn run test:mocha -w --extension ts --reporter min",
-    "test": "yarn run test:types && yarn run test:unit",
+    "test": "yarn run test:types && yarn run test:unit && yarn build",
     "build": "yarn rollup -c rollup.config.js",
     "dev": "webpack-dev-server --mode=development"
   },
diff --git a/tsconfig.check-types.json b/tsconfig.check-types.json
new file mode 100644 (file)
index 0000000..1cc234a
--- /dev/null
@@ -0,0 +1,25 @@
+{
+  "include": ["src/**/*.ts"],
+  "compilerOptions": {
+    "target": "esnext",
+    "module": "commonjs",
+    // "lib": ["es2017.object"] ,
+    "allowJs": true,
+    "checkJs": true,
+    // "declaration": true ,
+    // "sourceMap": true ,
+    // "outFile": "./",                       /* Concatenate and emit output to single file. */
+    // "outDir": "./dist" ,
+    // "rootDir": "./",                       /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
+    // "composite": true,                     /* Enable project compilation */
+    "noEmit": true,
+
+    "strict": true,
+    "noUnusedLocals": true,
+    // "noUnusedParameters": true,
+    "noImplicitReturns": true,
+
+    "moduleResolution": "node",
+    "esModuleInterop": true
+  }
+}