From 31e567bd7f45f19704a9671483b6a0c367be2a25 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Fri, 10 Apr 2020 13:43:24 +0200 Subject: [PATCH] add test for dynamic import --- e2e/__tests__/__snapshots__/nativeEsm.test.ts.snap | 2 +- e2e/native-esm/__tests__/native-esm.test.js | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/e2e/__tests__/__snapshots__/nativeEsm.test.ts.snap b/e2e/__tests__/__snapshots__/nativeEsm.test.ts.snap index 4a6a74329208..7aa2b751b2f4 100644 --- a/e2e/__tests__/__snapshots__/nativeEsm.test.ts.snap +++ b/e2e/__tests__/__snapshots__/nativeEsm.test.ts.snap @@ -2,7 +2,7 @@ exports[`on node ^12.16.0 || >=13.0.0 runs test with native ESM 1`] = ` Test Suites: 1 passed, 1 total -Tests: 3 passed, 3 total +Tests: 4 passed, 4 total Snapshots: 0 total Time: <> Ran all test suites. diff --git a/e2e/native-esm/__tests__/native-esm.test.js b/e2e/native-esm/__tests__/native-esm.test.js index 0f7e54319151..4fde434ab166 100644 --- a/e2e/native-esm/__tests__/native-esm.test.js +++ b/e2e/native-esm/__tests__/native-esm.test.js @@ -38,3 +38,10 @@ test('should support importing node core modules', () => { type: 'module', }); }); + +test('dynamic import should work', async () => { + const {double: importedDouble} = await import('../index'); + + expect(importedDouble).toBe(double); + expect(importedDouble(1)).toBe(2); +});