Skip to content

Commit

Permalink
docs: add usage with TypeScript (#95)
Browse files Browse the repository at this point in the history
* docs: add usage with TypeScript

* Update README.md
  • Loading branch information
mxschmitt committed Apr 2, 2020
1 parent b692d6a commit b15a870
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,50 @@ If there is no defined browsers in config it will run tests for chromium browser
"test:parallel": "jest-playwright --parallel"
```

## Usage with Typescript

Example Jest configuration in combination with [ts-jest](https://github.com/kulshekhar/ts-jest):

```javascript
module.exports = {
preset: 'jest-playwright-preset',
transform: {
"^.+\\.ts$": "ts-jest"
},
};
```

Types are also available, which you can either use via directly in your test:

```typescript
/// <reference types="jest-playwright-preset" />
```

or at your central `tsconfig.json` either via `files`:

```
{
"files": [
"./global.d.ts",
"node_modules/jest-playwright-preset/types/global.d.ts"
],
}
```

or via `types`:

```
{
"compilerOptions": {
"types": [
"jest-playwright-preset"
]
},
}
```

It's important to not change the `testEnvironment` to `node`. Otherwise it won't work.

## Known issues

### Error reporting with Jest
Expand Down

0 comments on commit b15a870

Please sign in to comment.