diff --git a/test/integration.js b/test/integration.js index 4986566..c2a00e2 100644 --- a/test/integration.js +++ b/test/integration.js @@ -34,21 +34,21 @@ describe('duel', () => { await rmDist(plainDist) }) - it.skip('prints options help', async t => { + it('prints options help', async t => { const spy = t.mock.method(global.console, 'log') await duel(['--help']) assert.ok(spy.mock.calls[1].arguments[0].startsWith('Options:')) }) - it.skip('reports errors when passing invalid options', async t => { + it('reports errors when passing invalid options', async t => { const spy = t.mock.method(global.console, 'log') await duel(['--invalid']) assert.equal(spy.mock.calls[0].arguments[1], "Unknown option '--invalid'") }) - it.skip('uses default --project value of "tsconfig.json"', async t => { + it('uses default --project value of "tsconfig.json"', async t => { const spy = t.mock.method(global.console, 'log') const tsConfigPath = resolve('./tsconfig.json') const tsConfigPathTemp = tsConfigPath.replace('tsconfig', 'tsconfig.temp') @@ -59,21 +59,21 @@ describe('duel', () => { await rename(tsConfigPathTemp, tsConfigPath) }) - it.skip('reports errors when --project is a directory with no tsconfig.json', async t => { + it('reports errors when --project is a directory with no tsconfig.json', async t => { const spy = t.mock.method(global.console, 'log') await duel(['-p', 'test/__fixtures__']) assert.ok(spy.mock.calls[0].arguments[1].endsWith('no tsconfig.json.')) }) - it.skip('reports errors when --project is not valid json', async t => { + it('reports errors when --project is not valid json', async t => { const spy = t.mock.method(global.console, 'log') await duel(['-p', 'test/__fixtures__/esmProject/tsconfig.not.json']) assert.ok(spy.mock.calls[0].arguments[1].endsWith('not parsable as JSONC.')) }) - it.skip('reports errors when using deprecated --target-extension', async t => { + it('reports errors when using deprecated --target-extension', async t => { const spy = t.mock.method(global.console, 'log') await duel(['-x', '.mjs']) @@ -132,7 +132,7 @@ describe('duel', () => { assert.equal(statusCjs, 0) }) - it.skip('creates a dual ESM build while transforming module globals', async t => { + it('creates a dual ESM build while transforming module globals', async t => { const spy = t.mock.method(global.console, 'log') t.after(async () => { @@ -165,18 +165,18 @@ describe('duel', () => { const { status: statusCjs } = spawnSync( 'node', ['test/__fixtures__/cjsProject/dist/index.js'], - { stdio: 'inherit' }, + { shell, stdio: 'inherit' }, ) assert.equal(statusCjs, 0) const { status: statusEsm } = spawnSync( 'node', ['test/__fixtures__/cjsProject/dist/esm/index.mjs'], - { stdio: 'inherit' }, + { shell, stdio: 'inherit' }, ) assert.equal(statusEsm, 0) }) - it.skip('supports both builds output to directories', async t => { + it('supports both builds output to directories', async t => { const spy = t.mock.method(global.console, 'log') t.after(async () => { @@ -191,7 +191,7 @@ describe('duel', () => { assert.ok(existsSync(resolve(proDist, 'cjs/index.cjs'))) }) - it.skip('supports import attributes and ts import assertion resolution mode', async t => { + it('supports import attributes and ts import assertion resolution mode', async t => { const spy = t.mock.method(global.console, 'log') t.after(async () => { @@ -204,7 +204,7 @@ describe('duel', () => { ) }) - it.skip('works as a cli script', () => { + it('works as a cli script', () => { const resp = execSync(`${resolve('./src/duel.js')} -h`, { cwd: resolve(__dirname, '..'), }) @@ -212,7 +212,7 @@ describe('duel', () => { assert.ok(resp.toString().indexOf('Options:') > -1) }) - it.skip('reports compilation errors during a build', async t => { + it('reports compilation errors during a build', async t => { const spy = t.mock.method(global.console, 'log') const spyExit = t.mock.method(process, 'exit') @@ -233,7 +233,7 @@ describe('duel', () => { assert.equal(spy.mock.calls[1].arguments[1], 'Compilation errors found.') }) - it.skip('reports an error when no package.json file found', async t => { + it('reports an error when no package.json file found', async t => { const spy = t.mock.method(global.console, 'log') t.after(async () => { diff --git a/test/monorepos.js b/test/monorepos.js index a3b29ac..45e384f 100644 --- a/test/monorepos.js +++ b/test/monorepos.js @@ -3,6 +3,7 @@ import assert from 'node:assert/strict' import { resolve, join } from 'node:path' import { rm } from 'node:fs/promises' import { spawnSync } from 'node:child_process' +import { platform } from 'node:process' import { duel } from '../src/duel.js' @@ -10,6 +11,7 @@ const fixtures = resolve(import.meta.dirname, '__fixtures__') const npm = join(fixtures, 'mononpm') const npmOne = join(npm, 'one') const npmTwo = join(npm, 'two') +const shell = platform === 'win32' const rmDist = async distPath => { await rm(distPath, { recursive: true, force: true }) } @@ -26,7 +28,7 @@ describe('duel monorepos', () => { await rmDist(join(npmTwo, 'dist')) }) - spawnSync('npm', ['install'], { cwd: npm }) + spawnSync('npm', ['install'], { shell, cwd: npm }) // Build the packages (dependency first) await duel(['-p', npmTwo, '-k', npmTwo, '-m']) @@ -34,23 +36,25 @@ describe('duel monorepos', () => { // Check for runtime errors against Node.js const { status: twoEsm } = spawnSync('node', [join(npmTwo, 'dist', 'file.js')], { + shell, stdio: 'inherit', }) assert.equal(twoEsm, 0) const { status: twoCjs } = spawnSync( 'node', [join(npmTwo, 'dist', 'cjs', 'file.cjs')], - { stdio: 'inherit' }, + { shell, stdio: 'inherit' }, ) assert.equal(twoCjs, 0) const { status: oneEsm } = spawnSync('node', [join(npmOne, 'dist', 'main.js')], { + shell, stdio: 'inherit', }) assert.equal(oneEsm, 0) const { status: oneCjs } = spawnSync( 'node', [join(npmOne, 'dist', 'cjs', 'main.cjs')], - { stdio: 'inherit' }, + { shell, stdio: 'inherit' }, ) assert.equal(oneCjs, 0) })