Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit 5fab99e

Browse files
muzeaKnisterPeter
authored andcommitted
test: allow users to set additional babylon plugins
1 parent 9798c08 commit 5fab99e

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

tests/babylon-plugin.d.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
declare module 'Component' {
2+
import * as React from 'react';
3+
4+
export interface ComponentProps {
5+
}
6+
7+
export default class Component extends React.Component<ComponentProps, any> {
8+
render(): JSX.Element;
9+
10+
}
11+
12+
}

tests/babylon-plugin.jsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import * as React from 'react';
2+
3+
export default class Component extends React.PureComponent {
4+
5+
render() {
6+
return <p onClick={() => {
7+
import('./fake-dialog-box.js')
8+
.then(dialogBox => {
9+
dialogBox.open();
10+
})
11+
.catch(error => {
12+
/* Error handling */
13+
})
14+
}} />;
15+
}
16+
}

tests/parsing-test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,12 @@ test('Parsing should suppport custom eol style', t => {
123123
fs.readFileSync(path.join(basedir, 'pure-component.d.ts')).toString().replace('\r\n', '\n')
124124
);
125125
});
126+
test('Parsing should suppport users to set additional babylon plugins', t => {
127+
compare(
128+
t,
129+
'Component',
130+
'babylon-plugin.jsx',
131+
'babylon-plugin.d.ts',
132+
{ babylonPlugins: ['dynamicImport'] }
133+
);
134+
});

0 commit comments

Comments
 (0)