From: Eduardo San Martin Morote Date: Mon, 1 Jul 2019 17:52:47 +0000 (+0200) Subject: test: add type check to test command X-Git-Tag: v4.0.0-alpha.0~315 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf9b51932998b5ccef1e2709db9c4efbae1a1178;p=thirdparty%2Fvuejs%2Frouter.git test: add type check to test command --- diff --git a/__tests__/tsconfig.json b/__tests__/tsconfig.json index 59ce0205..533ede6c 100644 --- a/__tests__/tsconfig.json +++ b/__tests__/tsconfig.json @@ -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 } } diff --git a/jest.config.js b/jest.config.js index 2ebfd6df..83e5bd1e 100644 --- a/jest.config.js +++ b/jest.config.js @@ -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)', diff --git a/package.json b/package.json index 6de03dd6..fd6b6ee7 100644 --- a/package.json +++ b/package.json @@ -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 index 00000000..1cc234a0 --- /dev/null +++ b/tsconfig.check-types.json @@ -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 + } +}