-
Notifications
You must be signed in to change notification settings - Fork 411
Expand file tree
/
Copy pathdetect-core-js.test.js
More file actions
32 lines (29 loc) · 941 Bytes
/
detect-core-js.test.js
File metadata and controls
32 lines (29 loc) · 941 Bytes
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
import cp from 'child_process';
const waitForProcess = async process => {
return new Promise(resolve => {
let output = '';
process.stdout.on('data', chunk => {
output += chunk.toString();
});
process.on('close', () => {
resolve(output);
});
});
};
it('Ensures that package do not include core-js dependency after build', async () => {
const packageJSON = require('../../package.json');
const buildScript = packageJSON.scripts['build:lib'];
const proc = cp.exec(buildScript, {
stdio: 'ignore',
env: {
...process.env,
DEBUG_CORE_JS: 'true',
},
});
const result = await waitForProcess(proc);
// run `DEBUG_CORE_JS=true yarn build:lib` to debug issues with introduced core-js dependency
expect(result).not.toContain('Added following core-js polyfill');
expect(result).toContain(
'Based on your code and targets, core-js polyfills were not added'
);
}, 15000);