Skip to content

Commit

Permalink
Merge pull request #14 from Celtian/feat/jest-optimized
Browse files Browse the repository at this point in the history
Feat/jest optimized
  • Loading branch information
Celtian authored May 30, 2024
2 parents 9c4ffe5 + c6ea4c5 commit f984722
Show file tree
Hide file tree
Showing 7 changed files with 443 additions and 259 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
run: yarn lint

- name: 🧪 Run tests
run: yarn test --project demo && yarn test:coverage
run: yarn test:jest

- name: ⬆️ Upload coverage reports
uses: codecov/codecov-action@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
run: yarn lint

- name: 🧪 Run tests
run: yarn test --project demo && yarn test:coverage
run: yarn test:jest

- name: ⬆️ Upload coverage reports
uses: codecov/codecov-action@v4
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ Thumbs.db

# Temporary files
version.ts
.swc
21 changes: 20 additions & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { swcAngularJestTransformer } from '@jscutlery/swc-angular-preset';
import type { Config } from 'jest';

const config: Config = {
Expand All @@ -8,7 +9,25 @@ const config: Config = {
preset: 'jest-preset-angular',
setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],
testEnvironment: 'jsdom',
testMatch: ['<rootDir>/projects/ngx-repeat/**/*.spec.ts']
testMatch: ['<rootDir>/projects/demo/src/app/**/*.spec.ts', '<rootDir>/projects/ngx-repeat/src/lib/**/*.spec.ts'],
collectCoverageFrom: [
'<rootDir>/projects/ngx-repeat/src/lib/**/*.ts',
'!<rootDir>/projects/ngx-repeat/src/lib/**/index.ts'
],
moduleNameMapper: {
'projects/ngx-repeat/src/public-api': '<rootDir>/projects/ngx-repeat/src/public-api'
},
transform: {
'^.+\\.(ts|mjs|js)$': swcAngularJestTransformer(),
'^.+\\.(html)$': [
'jest-preset-angular',
{
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$'
}
]
},
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)']
};

export default config;
42 changes: 23 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"build:demo": "ng build demo --configuration production",
"build": "ng build ngx-repeat --configuration production",
"test": "ng test",
"test:coverage": "jest --coverage",
"test:jest": "jest",
"lint": "ng lint",
"script:create-version": "yarn tsx ./scripts/create-version.ts",
"script:sync-projects": "yarn tsx ./scripts/sync-projects.ts",
Expand All @@ -33,32 +33,36 @@
"fix-vulnerabilities": "npx yarn-audit-fix && npx browserslist --update-db"
},
"dependencies": {
"@angular/animations": "^18.0.0",
"@angular/common": "^18.0.0",
"@angular/compiler": "^18.0.0",
"@angular/core": "^18.0.0",
"@angular/forms": "^18.0.0",
"@angular/platform-browser": "^18.0.0",
"@angular/platform-browser-dynamic": "^18.0.0",
"@angular/router": "^18.0.0",
"@angular/animations": "^18.0.1",
"@angular/common": "^18.0.1",
"@angular/compiler": "^18.0.1",
"@angular/core": "^18.0.1",
"@angular/forms": "^18.0.1",
"@angular/platform-browser": "^18.0.1",
"@angular/platform-browser-dynamic": "^18.0.1",
"@angular/router": "^18.0.1",
"rxjs": "^7.8.1",
"tslib": "^2.6.2",
"zone.js": "^0.14.6"
},
"devDependencies": {
"@angular-devkit/build-angular": "^18.0.1",
"@angular-eslint/builder": "17.5.2",
"@angular-eslint/eslint-plugin": "17.5.2",
"@angular-eslint/eslint-plugin-template": "17.5.2",
"@angular-eslint/schematics": "17.5.2",
"@angular-eslint/template-parser": "17.5.2",
"@angular/cli": "^18.0.1",
"@angular/compiler-cli": "^18.0.0",
"@angular/language-service": "^18.0.0",
"@angular-devkit/build-angular": "^18.0.2",
"@angular-eslint/builder": "18.0.0",
"@angular-eslint/eslint-plugin": "18.0.0",
"@angular-eslint/eslint-plugin-template": "18.0.0",
"@angular-eslint/schematics": "18.0.0",
"@angular-eslint/template-parser": "18.0.0",
"@angular/cli": "^18.0.2",
"@angular/compiler-cli": "^18.0.1",
"@angular/language-service": "^18.0.1",
"@commitlint/cli": "^19.3.0",
"@commitlint/config-angular": "^19.3.0",
"@jscutlery/swc-angular-preset": "^0.3.0",
"@jscutlery/swc-plugin-angular": "^0.11.0",
"@swc/core": "~1.4.0",
"@swc/jest": "^0.2.36",
"@types/jest": "^29.5.12",
"@types/node": "^20.12.12",
"@types/node": "^20.12.13",
"@typescript-eslint/eslint-plugin": "^7.11.0",
"@typescript-eslint/parser": "^7.11.0",
"auto-changelog": "^2.4.0",
Expand Down
1 change: 1 addition & 0 deletions setup-jest.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import 'jest-preset-angular/setup-jest';
import 'reflect-metadata';
Loading

0 comments on commit f984722

Please sign in to comment.