forked from rollup/rollup
/
_config.js
33 lines (30 loc) · 920 Bytes
/
_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
const assert = require('node:assert');
const path = require('node:path');
const ID_MAIN = path.join(__dirname, 'main.js');
const ID_MODULE = path.join(__dirname, 'module.js');
const ID_MODULE_2 = path.join(__dirname, 'module2.js');
const expectedResult = {
[ID_MAIN]: {
exports: ['moduleAlias', '*'],
exportedBindings: { '.': [], './module.js': ['moduleAlias', '*'] }
},
[ID_MODULE]: {
exports: ['default', 'module', '*'],
exportedBindings: { '.': ['default', 'module'], './module2.js': ['*'] }
},
[ID_MODULE_2]: {
exports: ['module2'],
exportedBindings: { '.': ['module2'] }
}
};
module.exports = {
description: 'check exports and exportedBindings in moduleParsed as a supplementary test',
options: {
plugins: {
moduleParsed(moduleInfo) {
const { exports, exportedBindings, id } = moduleInfo;
assert.deepStrictEqual({ exports, exportedBindings }, expectedResult[id]);
}
}
}
};