-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(jest-config): add reusable config
- Loading branch information
Showing
8 changed files
with
21,138 additions
and
12,200 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
jest.config.d.ts | ||
jest.config.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.gitignore | ||
node_modules | ||
project.json | ||
jest.config.ts | ||
tsconfig.lib.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# @taiga-ui/stylelint-config | ||
|
||
Common Stylelint configuration for taiga-ui projects | ||
|
||
## Usage | ||
|
||
1. Install from npm | ||
|
||
```bash | ||
npm i --save-dev @taiga-ui/stylelint-config | ||
``` | ||
|
||
2. Create `stylelint.config.js` at project root | ||
|
||
```json5 | ||
{ | ||
extends: ['@taiga-ui/stylelint-config/taiga'], | ||
} | ||
``` | ||
|
||
More information about available at | ||
[stylelint documentation](https://github.com/stylelint/stylelint/blob/main/docs/user-guide/configure.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/// <reference lib="es2021" /> | ||
import {resolve} from 'node:path'; | ||
|
||
import type {JestConfigWithTsJest} from 'ts-jest'; | ||
import {pathsToModuleNameMapper} from 'ts-jest'; | ||
|
||
process.env.TZ = 'Europe/Moscow'; | ||
process.env.FORCE_COLOR = 'true'; | ||
process.env.TS_JEST_DISABLE_VER_CHECKER = 'true'; | ||
|
||
const {compilerOptions} = require(resolve(process.cwd(), 'tsconfig.json')); | ||
const maxParallel = require('node:os').cpus().length / 2; | ||
|
||
export default { | ||
rootDir: process.cwd(), | ||
preset: 'jest-preset-angular', | ||
testEnvironment: 'jsdom', | ||
setupFilesAfterEnv: [ | ||
resolve(process.cwd(), './node_modules/@taiga-ui/testing/setup-jest/index.ts'), | ||
], | ||
extensionsToTreatAsEsm: ['.ts'], | ||
transform: { | ||
'^.+\\.(ts|js|mjs|html|svg)$': [ | ||
'jest-preset-angular', | ||
{ | ||
tsconfig: resolve(process.cwd(), 'tsconfig.spec.json'), | ||
stringifyContentPathRegex: String.raw`\.html$`, | ||
isolatedModules: true, | ||
diagnostics: true, | ||
}, | ||
], | ||
}, | ||
transformIgnorePatterns: [ | ||
String.raw`node_modules/(?!@angular|rxjs|ngx-highlightjs|@maskito|@ng-web-apis|@taiga-ui\/event-plugins|@taiga-ui\/polymorpheus)`, | ||
], | ||
testMatch: ['<rootDir>/projects/**/*.spec.ts'], | ||
testPathIgnorePatterns: ['/cypress/', '/playwright/', '/node_modules/'], | ||
coverageDirectory: '<rootDir>/coverage', | ||
collectCoverageFrom: ['<rootDir>/**/*.ts'], | ||
coveragePathIgnorePatterns: ['node_modules', 'schematics', '.spec.ts', '.cy.ts'], | ||
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { | ||
prefix: `<rootDir>/${compilerOptions.baseUrl}/` | ||
.replaceAll('./', '/') | ||
.replaceAll(/\/\/+/g, '/'), | ||
}), | ||
modulePathIgnorePatterns: ['.cache', 'dist', '<rootDir>/dist/'], | ||
coverageReporters: ['lcov', 'clover'], | ||
cacheDirectory: '<rootDir>/node_modules/.cache/jest', | ||
maxConcurrency: maxParallel, | ||
maxWorkers: maxParallel, | ||
verbose: !process.env.CI, | ||
bail: 1, | ||
reporters: ['default'], | ||
passWithNoTests: true, | ||
collectCoverage: true, | ||
} satisfies JestConfigWithTsJest; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"name": "@taiga-ui/jest-config", | ||
"version": "0.222.5", | ||
"description": "Taiga UI jest config", | ||
"keywords": [ | ||
"jest", | ||
"prettier" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/taiga-family/configurations.git" | ||
}, | ||
"license": "Apache-2.0", | ||
"main": "jest.config.js", | ||
"types": "jest.config.d.ts", | ||
"peerDependencies": { | ||
"@taiga-ui/testing": ">=4.10.0", | ||
"@types/jest": ">=29.5.13", | ||
"jest": ">=29.7.0", | ||
"jest-preset-angular": ">=14.2.4", | ||
"ts-jest": ">=29.2.5" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "jest-config", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"prefix": "tui", | ||
"projectType": "library", | ||
"sourceRoot": "projects/jest-config", | ||
"targets": { | ||
"build": { | ||
"executor": "nx:run-commands", | ||
"options": { | ||
"command": "npx tsc -p {projectRoot}/tsconfig.lib.json" | ||
} | ||
}, | ||
"publish": { | ||
"executor": "nx:run-commands", | ||
"options": { | ||
"command": "npm publish ./projects/{projectName} --access=public --ignore-scripts" | ||
}, | ||
"dependsOn": [ | ||
{ | ||
"target": "build", | ||
"params": "ignore", | ||
"dependencies": false | ||
} | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"include": ["./jest.config.ts"], | ||
"compilerOptions": { | ||
"rootDir": ".", | ||
"baseUrl": ".", | ||
"outDir": ".", | ||
"target": "es6", | ||
"module": "commonjs", | ||
"declaration": true, | ||
"incremental": null, | ||
"verbatimModuleSyntax": false, | ||
"types": ["node", "jest"] | ||
} | ||
} |