-
Notifications
You must be signed in to change notification settings - Fork 8
/
test.js
47 lines (38 loc) · 1.66 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
'use strict';
const pluginTester = require('babel-plugin-tester');
const createBabylonOptions = require('babylon-options');
const plugin = require('./');
const babelOptions = {
filename: 'test.js',
parserOpts: createBabylonOptions({
stage: 0
})
};
pluginTester({
plugin,
babelOptions,
snapshot: true,
tests: {
'defaults': { code: 'import("./a")' },
'all true': {
code: 'import("./a")',
pluginOptions: {
currentModuleFileName: true,
importedModulePath: true,
serverSideRequirePath: true,
webpackRequireWeakId: true,
timeToImport: true
}
},
'currentModuleFileName: false': { code: 'import("./a")', pluginOptions: { currentModuleFileName: false } },
'currentModuleFileName: true': { code: 'import("./a")', pluginOptions: { currentModuleFileName: true } },
'importedModulePath: false': { code: 'import("./a")', pluginOptions: { importedModulePath: false } },
'importedModulePath: true': { code: 'import("./a")', pluginOptions: { importedModulePath: true } },
'serverSideRequirePath: false': { code: 'import("./a")', pluginOptions: { serverSideRequirePath: false } },
'serverSideRequirePath: true': { code: 'import("./a")', pluginOptions: { serverSideRequirePath: true } },
'webpackRequireWeakId: false': { code: 'import("./a")', pluginOptions: { webpackRequireWeakId: false } },
'webpackRequireWeakId: true': { code: 'import("./a")', pluginOptions: { webpackRequireWeakId: true } },
'timeToImport: false': { code: 'import("./a")', pluginOptions: { timeToImport: false } },
'timeToImport: true': { code: 'import("./a")', pluginOptions: { timeToImport: true } },
}
});