From 38acabfa6089ab8ac469c12b5f55022fb96935e5 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 23 Aug 2021 16:46:06 -0300 Subject: added web vendors --- .../react/__tests__/detect-core-js.test.js | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 @linaria/packages/react/__tests__/detect-core-js.test.js (limited to '@linaria/packages/react/__tests__/detect-core-js.test.js') diff --git a/@linaria/packages/react/__tests__/detect-core-js.test.js b/@linaria/packages/react/__tests__/detect-core-js.test.js new file mode 100644 index 0000000..22bfbe4 --- /dev/null +++ b/@linaria/packages/react/__tests__/detect-core-js.test.js @@ -0,0 +1,35 @@ +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 () => { + // eslint-disable-next-line import/no-extraneous-dependencies + const packageJSON = require('@linaria/babel-preset/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( + 'The corejs3 polyfill added the following polyfills' + ); + expect(result).toContain( + 'Based on your code and targets, the corejs3 polyfill did not add any polyfill' + ); +}, 15000); -- cgit v1.2.3