Skip to content

Commit

Permalink
docs: update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ahnpnl committed Nov 15, 2024
1 parent 3023caa commit ca71a60
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,26 @@ npm install -D jest jest-preset-angular @types/jest
In your project root, create `setup-jest.ts` file with following contents:

```ts
import 'jest-preset-angular/setup-jest';
// setup-jest.ts
import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';

setupZoneTestEnv();
```

Add the following section:

- to your root `jest.config.js`
- to your root `jest.config.ts`

```ts
// jest.config.ts
import type { Config } from 'jest';

```js
// jest.config.js
module.exports = {
const jestConfig: Config = {
preset: 'jest-preset-angular',
setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],
globalSetup: 'jest-preset-angular/global-setup',
};

export default jestConfig;
```

- or to your root `package.json`
Expand All @@ -56,8 +62,7 @@ module.exports = {
{
"jest": {
"preset": "jest-preset-angular",
"setupFilesAfterEnv": ["<rootDir>/setup-jest.ts"],
"globalSetup": "jest-preset-angular/global-setup"
"setupFilesAfterEnv": ["<rootDir>/setup-jest.ts"]
}
}
```
Expand All @@ -68,8 +73,7 @@ Adjust your `tsconfig.spec.json` to be:
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/spec",
"module": "CommonJs",
"module": "CommonJS",
"types": ["jest"]
},
"include": ["src/**/*.spec.ts", "src/**/*.d.ts"]
Expand Down

0 comments on commit ca71a60

Please sign in to comment.