Skip to content

Commit

Permalink
fix: broken test workspace with angular
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslanguns committed Dec 11, 2022
1 parent 27e718a commit d9b9583
Show file tree
Hide file tree
Showing 12 changed files with 90 additions and 36 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ node_modules/
*.tsbuildinfo
!**/**/src/lib

.angular

# Logs
logs
Expand Down
17 changes: 5 additions & 12 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"cli": {
"packageManager": "yarn"
"packageManager": "yarn",
"analytics": false
},
"newProjectRoot": "integration",
"projects": {
Expand All @@ -13,26 +14,18 @@
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"tsConfig": "packages/angular/tsconfig.lib.prod.json",
"tsConfig": "packages/angular/tsconfig.lib.json",
"project": "packages/angular/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "packages/angular/tsconfig.lib.prod.json"
}
}
},
"test": {
"builder": "@angular-builders/jest:run",
"options": {
"main": "packages/shared/src/test.ts",
"tsConfig": "packages/shared/tsconfig.spec.json"
}
}
}
}
},
"defaultProject": "@ruso/angular"
}
}
9 changes: 5 additions & 4 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
moduleFileExtensions: ['js', 'json', 'ts'],
rootDir: 'src',
testRegex: '.spec.ts$',
transform: {
'^.+\\.ts$': 'ts-jest',
},
testRegex: '.*\\.spec\\.ts$',
coverageDirectory: './coverage',
collectCoverageFrom: ['src/**/*.ts', '!**/*.module.ts'],
testEnvironment: 'node',
transform: {
'^.+\\.(t|j)s$': ['ts-jest'],
},
};
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"prepare": "husky install"
},
"devDependencies": {
"@angular-builders/jest": "^14.1.0",
"@angular-devkit/build-angular": "15.0.3",
"@angular-devkit/build-ng-packagr": "0.1002.0",
"@angular/animations": "15.0.3",
Expand Down Expand Up @@ -75,7 +76,7 @@
"express": "4.18.2",
"husky": "8.0.2",
"jest": "29.3.1",
"jest-preset-angular": "12.2.3",
"jest-preset-angular": "^12.2.3",
"lerna": "6.1.0",
"lint-staged": "13.1.0",
"ng-packagr": "15.0.3",
Expand All @@ -86,7 +87,7 @@
"rxjs": "7.6.0",
"snyk": "1.1069.0",
"supertest": "6.3.3",
"ts-jest": "29.0.3",
"ts-jest": "^29.0.3",
"ts-loader": "9.4.2",
"ts-node": "10.9.1",
"tsickle": "0.46.3",
Expand Down
5 changes: 4 additions & 1 deletion packages/angular/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
const baseConfig = require('../../jest.config');

module.exports = {
...baseConfig,
rootDir: '',
roots: ['<rootDir>/src'],
preset: 'jest-preset-angular',
setupFilesAfterEnv: ['<rootDir>/setupJest.ts'],
modulePaths: ['<rootDir>/src'],
transform: {
'^.+\\.js$': 'babel-jest',
},
};
1 change: 0 additions & 1 deletion packages/angular/setupJest.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/angular/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"compilerOptions": {
"module": "esnext",
"outDir": "lib",
"declarationMap": true,
"target": "ES2022",
"declaration": true,
"inlineSources": true,
"types": [],
"lib": ["dom", "es2018"]
},
"angularCompilerOptions": {
Expand Down
1 change: 0 additions & 1 deletion packages/angular/tsconfig.lib.prod.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"declarationMap": false
},
"angularCompilerOptions": {
"enableIvy": true,
"compilationMode": "partial"
}
}
3 changes: 1 addition & 2 deletions packages/angular/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"extends": "./tsconfig.lib.json",
"compilerOptions": {
"outDir": "spec",
"types": ["jest", "node"]
"outDir": "../../out-tsc/spec"
},
"include": ["**/*.spec.ts", "**/*.d.ts"]
}
15 changes: 15 additions & 0 deletions packages/angular/xjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const baseConfig = require('../../jest.config');

module.exports = {
...baseConfig,
globals: {
'ts-jest': {
allowSyntheticDefaultImports: true,
},
},
roots: ['<rootDir>/src'],
modulePaths: ['<rootDir>/src'],
transform: {
'^.+\\.js$': 'babel-jest',
},
};
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"target": "ES2022",
"noUnusedLocals": false,
"allowJs": false,
"lib": ["ES2022", "dom"]
"lib": ["ES2022", "dom"],
"esModuleInterop": true
},
"exclude": ["node_modules", "lib"],
"angularCompilerOptions": {
Expand Down
64 changes: 53 additions & 11 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@
"@jridgewell/gen-mapping" "^0.1.0"
"@jridgewell/trace-mapping" "^0.3.9"

"@angular-builders/jest@^14.1.0":
version "14.1.0"
resolved "https://registry.yarnpkg.com/@angular-builders/jest/-/jest-14.1.0.tgz#04c19959021f8462d0027ec895059c7a720e8016"
integrity sha512-uGXyJ40F7HXfoWwW1EK5U75sUUQ4zVireLYPUYWT1/t1vqizss0mIPR026bMWwScWJhetdopxlWcql4wfNuXyQ==
dependencies:
"@angular-devkit/architect" ">=0.1400.0 < 0.1500.0"
"@angular-devkit/core" "^14.0.0"
jest-preset-angular "12.2.2"
lodash "^4.17.15"

"@angular-devkit/[email protected]":
version "0.1002.0"
resolved "https://registry.yarnpkg.com/@angular-devkit/architect/-/architect-0.1002.0.tgz#470b78aaf79308a23da6a0d3935f2d1f85dcb212"
Expand All @@ -26,6 +36,14 @@
"@angular-devkit/core" "15.0.3"
rxjs "6.6.7"

"@angular-devkit/architect@>=0.1400.0 < 0.1500.0":
version "0.1402.10"
resolved "https://registry.yarnpkg.com/@angular-devkit/architect/-/architect-0.1402.10.tgz#e5c552a7d9bcb90aab59964cb9b6c6ca6524e3cc"
integrity sha512-/6YmPrgataj1jD2Uqd1ED+CG4DaZGacoeZd/89hH7hF76Nno8K18DrSOqJAEmDnOWegpSRGVLd0qP09IHmaG5w==
dependencies:
"@angular-devkit/core" "14.2.10"
rxjs "6.6.7"

"@angular-devkit/[email protected]":
version "15.0.3"
resolved "https://registry.yarnpkg.com/@angular-devkit/build-angular/-/build-angular-15.0.3.tgz#c81f30377afbed9bfebedde681515962af5b56b5"
Expand Down Expand Up @@ -131,6 +149,17 @@
rxjs "6.6.7"
source-map "0.7.4"

"@angular-devkit/[email protected]", "@angular-devkit/core@^14.0.0":
version "14.2.10"
resolved "https://registry.yarnpkg.com/@angular-devkit/core/-/core-14.2.10.tgz#9eedb7cf783030252f0c7546ce80fc321633b499"
integrity sha512-K4AO7mROTdbhQ7chtyQd6oPwmuL+BPUh+wn6Aq1qrmYJK4UZYFOPp8fi/Ehs8meCEeywtrssOPfrOE4Gsre9dg==
dependencies:
ajv "8.11.0"
ajv-formats "2.1.1"
jsonc-parser "3.1.0"
rxjs "6.6.7"
source-map "0.7.4"

"@angular-devkit/[email protected]":
version "14.2.2"
resolved "https://registry.yarnpkg.com/@angular-devkit/core/-/core-14.2.2.tgz#d616ada7c9a0610454da47445e64520a0b34e400"
Expand Down Expand Up @@ -8693,7 +8722,20 @@ jest-pnp-resolver@^1.2.2:
resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.2.tgz#b704ac0ae028a89108a4d040b3f919dfddc8e33c"
integrity sha512-olV41bKSMm8BdnuMsewT4jqlZ8+3TCARAXjZGT9jcoSnrfUnRCqnMoF9XEeoWjbzObpqF9dRhHQj0Xb9QdF6/w==

[email protected]:
[email protected]:
version "12.2.2"
resolved "https://registry.yarnpkg.com/jest-preset-angular/-/jest-preset-angular-12.2.2.tgz#f7414e15e165e34efdc4fd8404a19e8e4856441e"
integrity sha512-aj5ZwVW6cGGzZKUn6e/jDwFgQh6FHy1zCCXWOeqFCuM3WODrbdUJ93zKrex18e9K1+PvOcP0e20yKbj3gwhfFg==
dependencies:
bs-logger "^0.2.6"
esbuild-wasm ">=0.13.8"
jest-environment-jsdom "^28.0.0"
pretty-format "^28.0.0"
ts-jest "^28.0.0"
optionalDependencies:
esbuild ">=0.13.8"

jest-preset-angular@^12.2.3:
version "12.2.3"
resolved "https://registry.yarnpkg.com/jest-preset-angular/-/jest-preset-angular-12.2.3.tgz#2a0db250f6e1c83b451a21f5ca4136925f17d5b1"
integrity sha512-9vgawXuki/lg4IRPtl5k83krWLKADTal7BBm06xNAWOK09AbHK1foXqZdVOMObsWbaMDeQ1cjba60vS/aEVY4Q==
Expand Down Expand Up @@ -12709,28 +12751,28 @@ trim-newlines@^3.0.0:
resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-3.0.1.tgz#260a5d962d8b752425b32f3a7db0dcacd176c144"
integrity sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==

ts-jest@29.0.3:
version "29.0.3"
resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.0.3.tgz#63ea93c5401ab73595440733cefdba31fcf9cb77"
integrity sha512-Ibygvmuyq1qp/z3yTh9QTwVVAbFdDy/+4BtIQR2sp6baF2SJU/8CKK/hhnGIDY2L90Az2jIqTwZPnN2p+BweiQ==
ts-jest@^28.0.0:
version "28.0.8"
resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-28.0.8.tgz#cd204b8e7a2f78da32cf6c95c9a6165c5b99cc73"
integrity sha512-5FaG0lXmRPzApix8oFG8RKjAz4ehtm8yMKOTy5HX3fY6W8kmvOrmcY0hKDElW52FJov+clhUbrKAqofnj4mXTg==
dependencies:
bs-logger "0.x"
fast-json-stable-stringify "2.x"
jest-util "^29.0.0"
jest-util "^28.0.0"
json5 "^2.2.1"
lodash.memoize "4.x"
make-error "1.x"
semver "7.x"
yargs-parser "^21.0.1"

ts-jest@^28.0.0:
version "28.0.8"
resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-28.0.8.tgz#cd204b8e7a2f78da32cf6c95c9a6165c5b99cc73"
integrity sha512-5FaG0lXmRPzApix8oFG8RKjAz4ehtm8yMKOTy5HX3fY6W8kmvOrmcY0hKDElW52FJov+clhUbrKAqofnj4mXTg==
ts-jest@^29.0.3:
version "29.0.3"
resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.0.3.tgz#63ea93c5401ab73595440733cefdba31fcf9cb77"
integrity sha512-Ibygvmuyq1qp/z3yTh9QTwVVAbFdDy/+4BtIQR2sp6baF2SJU/8CKK/hhnGIDY2L90Az2jIqTwZPnN2p+BweiQ==
dependencies:
bs-logger "0.x"
fast-json-stable-stringify "2.x"
jest-util "^28.0.0"
jest-util "^29.0.0"
json5 "^2.2.1"
lodash.memoize "4.x"
make-error "1.x"
Expand Down

0 comments on commit d9b9583

Please sign in to comment.