source: trip-planner-front/node_modules/piscina/test/load-with-esm.ts@ 571e0df

Last change on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 780 bytes
Line 
1import { test } from 'tap';
2
3const importESM : (specifier : string) => Promise<any> =
4 // eslint-disable-next-line no-eval
5 eval('(specifier) => import(specifier)');
6
7test('Piscina is default export', {}, async ({ equal }) => {
8 equal((await importESM('piscina')).default, require('../'));
9});
10
11test('Exports match own property names', {}, async ({ strictSame }) => {
12 // Check that version, workerData, etc. are re-exported.
13 const exported = new Set(Object.getOwnPropertyNames(await importESM('piscina')));
14 const required = new Set(Object.getOwnPropertyNames(require('../')));
15
16 // Remove constructor properties + default export.
17 for (const k of ['prototype', 'length', 'name']) required.delete(k);
18 exported.delete('default');
19
20 strictSame(exported, required);
21});
Note: See TracBrowser for help on using the repository browser.