Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(configuration-file): document async function #3761

Merged
merged 1 commit into from Apr 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions docs/config/01-configuration-file.md
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