Skip to content

Commit 7aeb3f8

Browse files
nicojsJonathan Ginsburg
authored andcommitted
docs(configuration-file): document async function
See #3660
1 parent 263a870 commit 7aeb3f8

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

docs/config/01-configuration-file.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,20 @@ module.exports = (config) => {
5353
}
5454
```
5555

56+
Alternatively, you can use an `async` function instead (since v6.3).
57+
58+
```javascript
59+
// karma.conf.js
60+
module.exports = async (config) => {
61+
const karmaConfig = await getKarmaConfig("dev");
62+
63+
config.set({
64+
...karmaConfig
65+
});
66+
};
67+
```
68+
69+
5670
### Customized TypeScript Configuration
5771
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.
5872

0 commit comments

Comments
 (0)