Skip to content

Commit

Permalink
chore: add typescript + "type: module" tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeed committed Oct 9, 2021
1 parent e5eb473 commit 1368d98
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/config/index.ts
Expand Up @@ -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';
Expand All @@ -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~!');

0 comments on commit 1368d98

Please sign in to comment.