8
8
9
9
import fs from 'fs' ;
10
10
import temp from 'temp' ;
11
- import { expression } from '../../tests/utils' ;
11
+ import { expression , noopImporter } from '../../tests/utils' ;
12
12
import parse , { ERROR_MISSING_DEFINITION } from '../parse' ;
13
13
14
14
describe ( 'parse' , ( ) => {
15
15
it ( 'allows custom component definition resolvers' , ( ) => {
16
16
const path = expression ( '{foo: "bar"}' ) ;
17
17
const resolver = jest . fn ( ( ) => path ) ;
18
18
const handler = jest . fn ( ) ;
19
- parse ( '//empty' , resolver , [ handler ] ) ;
19
+ parse ( '//empty' , resolver , [ handler ] , noopImporter ) ;
20
20
21
21
expect ( resolver ) . toBeCalled ( ) ;
22
22
expect ( handler . mock . calls [ 0 ] [ 1 ] ) . toBe ( path ) ;
23
23
} ) ;
24
24
25
25
it ( 'errors if component definition is not found' , ( ) => {
26
26
const resolver = jest . fn ( ) ;
27
- expect ( ( ) => parse ( '//empty' , resolver ) ) . toThrowError (
27
+ expect ( ( ) => parse ( '//empty' , resolver , [ ] , noopImporter ) ) . toThrowError (
28
28
ERROR_MISSING_DEFINITION ,
29
29
) ;
30
30
expect ( resolver ) . toBeCalled ( ) ;
31
31
32
- expect ( ( ) => parse ( '//empty' , resolver ) ) . toThrowError (
32
+ expect ( ( ) => parse ( '//empty' , resolver , [ ] , noopImporter ) ) . toThrowError (
33
33
ERROR_MISSING_DEFINITION ,
34
34
) ;
35
35
expect ( resolver ) . toBeCalled ( ) ;
@@ -43,7 +43,7 @@ describe('parse', () => {
43
43
fs . writeFileSync ( `${ dir } /.babelrc` , '{}' ) ;
44
44
45
45
expect ( ( ) =>
46
- parse ( 'const chained = () => a |> b' , ( ) => { } , null , null , {
46
+ parse ( 'const chained = () => a |> b' , ( ) => { } , [ ] , noopImporter , {
47
47
cwd : dir ,
48
48
filename : `${ dir } /component.js` ,
49
49
} ) ,
@@ -58,7 +58,7 @@ describe('parse', () => {
58
58
59
59
it ( 'supports custom parserOptions with plugins' , ( ) => {
60
60
expect ( ( ) =>
61
- parse ( 'const chained: Type = 1;' , ( ) => { } , null , null , {
61
+ parse ( 'const chained: Type = 1;' , ( ) => { } , [ ] , noopImporter , {
62
62
parserOptions : {
63
63
plugins : [
64
64
// no flow
@@ -71,7 +71,7 @@ describe('parse', () => {
71
71
72
72
it ( 'supports custom parserOptions without plugins' , ( ) => {
73
73
expect ( ( ) =>
74
- parse ( 'const chained: Type = 1;' , ( ) => { } , null , null , {
74
+ parse ( 'const chained: Type = 1;' , ( ) => { } , [ ] , noopImporter , {
75
75
parserOptions : {
76
76
allowSuperOutsideMethod : true ,
77
77
} ,
0 commit comments