Skip to content

Commit

Permalink
docs(configuration-file): document async function
Browse files Browse the repository at this point in the history
See #3660
  • Loading branch information
nicojs authored and Jonathan Ginsburg committed Apr 8, 2022
1 parent 263a870 commit 7aeb3f8
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/config/01-configuration-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,20 @@ module.exports = (config) => {
}
```

Alternatively, you can use an `async` function instead (since v6.3).

```javascript
// karma.conf.js
module.exports = async (config) => {
const karmaConfig = await getKarmaConfig("dev");

config.set({
...karmaConfig
});
};
```


### Customized TypeScript Configuration
Under the hood Karma uses ts-node to transpile TypeScript to JavaScript. If the resolved `tsconfig.json` has `module` configured as `ES` formats. You might get errors like `SyntaxError: Unexpected token`. This is due that in Node `ES` module formats are not supported. To overcome this issue you need to configure ts-node to use `commonjs` module format.

Expand Down

0 comments on commit 7aeb3f8

Please sign in to comment.