-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
_config.js
65 lines (63 loc) · 1.51 KB
/
_config.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
const assert = require('node:assert');
const path = require('node:path');
const ID_MAIN = path.join(__dirname, 'main.js');
module.exports = {
description: 'handles accessing module information via plugins with cache disabled',
options: {
cache: false,
plugins: [
{
renderStart() {
const info = this.getModuleInfo(ID_MAIN);
const ast = {
type: 'Program',
start: 0,
end: 19,
body: [
{
type: 'ExportDefaultDeclaration',
start: 0,
end: 18,
declaration: {
type: 'Literal',
start: 15,
end: 17,
value: 42,
raw: '42'
}
}
],
sourceType: 'module'
};
assert.deepStrictEqual(JSON.parse(JSON.stringify(info)), {
assertions: {},
ast,
code: 'export default 42;\n',
dynamicallyImportedIdResolutions: [],
dynamicallyImportedIds: [],
dynamicImporters: [],
exportedBindings: {
'.': ['default']
},
exports: ['default'],
hasDefaultExport: true,
id: ID_MAIN,
implicitlyLoadedAfterOneOf: [],
implicitlyLoadedBefore: [],
importedIdResolutions: [],
importedIds: [],
importers: [],
isEntry: true,
isExternal: false,
isIncluded: true,
meta: {},
moduleSideEffects: true,
syntheticNamedExports: false
});
// Call AST again to ensure line coverage for cached getter
assert.deepStrictEqual(JSON.parse(JSON.stringify(info.ast)), ast);
}
}
]
}
};