diff --git a/test/cjs-esm-compare.cjs b/test/cjs-esm-compare.mjs similarity index 58% rename from test/cjs-esm-compare.cjs rename to test/cjs-esm-compare.mjs index d42506f..090db95 100644 --- a/test/cjs-esm-compare.cjs +++ b/test/cjs-esm-compare.mjs @@ -2,6 +2,8 @@ /* global describe, it */ +import { createRequire } from 'module' +const require = createRequire(import.meta.url) require('chai').should() const text = `usage: git tag [-a | -s | -u ] [-f] [-m | -F ] [-e] @@ -15,20 +17,19 @@ const text = `usage: git tag [-a | -s | -u ] [-f] [-m | -F ] const cliuiCJS = require('../build/index.cjs') -import('../index.mjs').then(({ default: cliuiESM }) => { - describe('consistent wrapping', () => { - it('should produce matching output in cjs and esm', () => { - const uiCJS = cliuiCJS({}) - const uiESM = cliuiESM({}) - uiCJS.div({ - padding: [0, 0, 0, 0], - text, - }) - uiESM.div({ - padding: [0, 0, 0, 0], - text, - }) - uiCJS.toString().should.equal(uiESM.toString()) +import cliuiESM from '../index.mjs' +describe('consistent wrapping', () => { + it('should produce matching output in cjs and esm', () => { + const uiCJS = cliuiCJS({}) + const uiESM = cliuiESM({}) + uiCJS.div({ + padding: [0, 0, 0, 0], + text, }) + uiESM.div({ + padding: [0, 0, 0, 0], + text, + }) + uiCJS.toString().should.equal(uiESM.toString()) }) })