diff --git a/.eslintrc.js b/.eslintrc.js index 3dfa57723a5b7626addfc3190a46f66ae123120c..81e656bc33249262b0fa2ca349f0fc0b56b5fe16 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -10,5 +10,7 @@ module.exports = { // Doit rester en dernier : 'plugin:prettier/recommended', ], - rules: {}, + rules: { + '@typescript-eslint/no-explicit-any': 0, + }, }; diff --git a/jest.config.js b/jest.config.js new file mode 100644 index 0000000000000000000000000000000000000000..e4a91780d323aef2ee2da80d9777ea5e5fa91793 --- /dev/null +++ b/jest.config.js @@ -0,0 +1,3 @@ +module.exports = { + preset: 'ts-jest', +}; diff --git a/package.json b/package.json index f94920f78c409214462bbd2bf9f9c3b3c08327a8..e862ef02533237549fbfb4ecb53d71f42ff4485c 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "directories": {}, "scripts": { "lint": "eslint --fix '{src,tests}/**/*.{js,ts}' --quiet --fix", - "test": "echo \"Error: no test specified\" && exit 1", + "test": "jest", "test:compile-generated": "tsc --project tsconfig.ci.json --pretty --noEmit", "test:lint": "eslint '{src,tests}/**/*.{js,ts}'" }, @@ -32,13 +32,16 @@ "devDependencies": { "@angular/common": "^7", "@angular/core": "^7", + "@types/jest": "^26.0.20", "@typescript-eslint/eslint-plugin": "^4.15.1", "@typescript-eslint/parser": "^4.15.1", "eslint": "^7.20.0", "eslint-config-prettier": "^7.2.0", "eslint-plugin-prettier": "^3.3.1", + "jest": "^26.6.3", "prettier": "^2.2.1", "rxjs-marbles": "^5.0.3", + "ts-jest": "^26.5.1", "typescript": "^3.7.2", "zone.js": "~0.8.26" } diff --git a/tsconfig.base.json b/tsconfig.base.json new file mode 100644 index 0000000000000000000000000000000000000000..0d01d281ea46fe397daba4cb6acd2e63038b4d91 --- /dev/null +++ b/tsconfig.base.json @@ -0,0 +1,14 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + + "extends": "@tsconfig/node10/tsconfig.json", + + "compileOnSave": false, + "compilerOptions": { + "noEmit": true, + "rootDir": "src/ts" + }, + + "include": ["src/ts/**/*.ts"], + "exclude": ["node_modules"] +} diff --git a/tsconfig.ci.json b/tsconfig.ci.json index f228d50840d06da88a591e7ef28338a81e137de3..44a4c47d186ff3927404166f579765a82ef7c355 100644 --- a/tsconfig.ci.json +++ b/tsconfig.ci.json @@ -1,16 +1,8 @@ { - "extends": "./node_modules/irstea-typescript-config/tsconfig.json", - "compileOnSave": false, - "compilerOptions": { - "outDir": "out-tsc/test", - "target": "es2015", - "declaration": true, - "sourceMap": true, - "inlineSources": false, - "experimentalDecorators": true, - "typeRoots": ["node_modules/@types"], - "moduleResolution": "node", - "lib": ["dom","es2018"] - }, - "include": ["output/**/*.ts"] + "$schema": "https://json.schemastore.org/tsconfig", + + "extends": "./tsconfig.base.json", + + "include": ["src/ts/**/*.ts", "output/**/*.ts"], + "exclude": ["node_modules", "**/*.spec.ts"] } diff --git a/tsconfig.lib.json b/tsconfig.lib.json new file mode 100644 index 0000000000000000000000000000000000000000..ffad58a50312a3db081c5b62b8a94da8e8f09dd9 --- /dev/null +++ b/tsconfig.lib.json @@ -0,0 +1,14 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + + "extends": "./tsconfig.base.json", + + "compilerOptions": { + "noEmit": false, + "outDir": "./dist", + "sourceMap": true, + "declaration": true, + "removeComments": true + }, + "exclude": ["node_modules", "**/*.spec.ts"] +}