From 1368d98fcabceae70fcd2837e47cc5c37ef2d0b4 Mon Sep 17 00:00:00 2001 From: Luke Edwards Date: Sat, 9 Oct 2021 14:34:36 -0700 Subject: [PATCH] chore: add typescript + "type: module" tests --- test/config/index.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/config/index.ts b/test/config/index.ts index c0d4f70..25696b7 100644 --- a/test/config/index.ts +++ b/test/config/index.ts @@ -6,6 +6,8 @@ import * as js from '../fixtures/math.js'; import * as mjs from '../fixtures/utils.mjs'; // @ts-ignore - cannot find types import * as cjs from '../fixtures/utils.cjs'; +// @ts-ignore - cannot find types +import * as esm from '../fixtures/module/index.js'; // NOTE: avoid need for syntheticDefault + analysis import * as data from '../fixtures/data.json'; @@ -31,4 +33,11 @@ assert.equal(typeof cjs, 'object', 'CJS :: typeof'); assert.equal(typeof cjs.dashify, 'function', 'CJS :: typeof :: dashify'); assert.equal(cjs.dashify('FooBar'), 'foo-bar', 'CJS :: value :: dashify'); +// Checking ".js" with ESM content (type: module) +assert.equal(typeof esm, 'object', 'ESM.js :: typeof'); +// @ts-ignore +assert.equal(typeof esm.hello, 'function', 'ESM.js :: typeof :: hello'); +// @ts-ignore +assert.equal(esm.hello('you'), 'hello, you', 'ESM.js :: value :: hello'); + console.log('DONE~!');