Skip to content

Commit 05d711f

Browse files
committed
Add ecmaScript option
1 parent 6fd557d commit 05d711f

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ module.exports = (config) => {
2828
moduleResolverPreprocessor: {
2929
addExtension: 'js',
3030
customResolver: null,
31+
ecmaVersion: 6,
3132
aliases: {
3233
project: "./project"
3334
}
@@ -97,3 +98,9 @@ import Foo from 'foo';
9798
// Rewrites to
9899
import Foo from 'http://example.com/foo';
99100
```
101+
102+
#### `ecmaVersion`
103+
104+
Default value: `6`
105+
106+
ECMAScript version as accepted by [espree](https://github.com/eslint/espree), e.g. `6`, `9`, `2015`, `2018`.

index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const path = require('path');
44
const defaultOptions = {
55
addExtension: 'js',
66
customResolver: null,
7+
ecmaVersion: 6,
78
aliases: {}
89
};
910

@@ -68,6 +69,7 @@ const createModuleResolverPreprocessor = (karmaConfig, args = {}, config = {}, l
6869
let ast = null;
6970
try {
7071
ast = espree.parse(content, {
72+
ecmaVersion: options.ecmaVersion,
7173
sourceType: 'module'
7274
});
7375
} catch (e) {

0 commit comments

Comments
 (0)