Skip to content

Commit

Permalink
ci: increase node memory.
Browse files Browse the repository at this point in the history
  • Loading branch information
knightedcodemonkey committed Sep 30, 2024
1 parent 9005b99 commit 60659a4
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ jobs:
- name: Lint
run: npm run lint
- name: Test
env:
NODE_OPTIONS: "--max-old-space-size=8192"
run: npm test
- name: Report Coverage
uses: codecov/[email protected]
Expand Down
10 changes: 5 additions & 5 deletions test/integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ describe('duel', () => {
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 () => {
Expand All @@ -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 () => {
Expand All @@ -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`, {
shell,
cwd: resolve(__dirname, '..'),
Expand All @@ -213,7 +213,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')

Expand All @@ -234,7 +234,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 () => {
Expand Down
101 changes: 101 additions & 0 deletions test/integrationOther.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import { describe, it, before } from 'node:test'
import assert from 'node:assert/strict'
import { fileURLToPath } from 'node:url'
import { dirname, resolve, join } from 'node:path'
import { rm } from 'node:fs/promises'
import { existsSync } from 'node:fs'
import { execSync } from 'node:child_process'
import { platform } from 'node:process'

import { duel } from '../src/duel.js'

const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
const plain = resolve(__dirname, '__fixtures__/plain')
const project = resolve(__dirname, '__fixtures__/project')
const esmProject = resolve(__dirname, '__fixtures__/esmProject')
const plainDist = join(plain, 'dist')
const proDist = join(project, 'dist')
const esmDist = join(esmProject, 'dist')
const errDist = resolve(__dirname, '__fixtures__/compileErrors/dist')
const rmDist = async distPath => {
await rm(distPath, { recursive: true, force: true })
}
const shell = platform === 'win32'

describe('duel', () => {
before(async () => {
await rmDist(proDist)
await rmDist(esmDist)
await rmDist(errDist)
await rmDist(plainDist)
})

it.skip('supports both builds output to directories', async t => {
const spy = t.mock.method(global.console, 'log')

t.after(async () => {
await rmDist(proDist)
})
await duel(['-p', 'test/__fixtures__/project/tsconfig.json', '-k', project, '-d'])

assert.ok(
spy.mock.calls[3].arguments[0].startsWith('Successfully created a dual CJS build'),
)
assert.ok(existsSync(resolve(proDist, 'esm/index.js')))
assert.ok(existsSync(resolve(proDist, 'cjs/index.cjs')))
})

it.skip('supports import attributes and ts import assertion resolution mode', async t => {
const spy = t.mock.method(global.console, 'log')

t.after(async () => {
await rmDist(plainDist)
})
await duel(['-p', plain, '-k', plain])

assert.ok(
spy.mock.calls[2].arguments[0].startsWith('Successfully created a dual CJS build'),
)
})

it.skip('works as a cli script', () => {
const resp = execSync(`${resolve('./src/duel.js')} -h`, {
shell,
cwd: resolve(__dirname, '..'),
})

assert.ok(resp.toString().indexOf('Options:') > -1)
})

it.skip('reports compilation errors during a build', async t => {
const spy = t.mock.method(global.console, 'log')
const spyExit = t.mock.method(process, 'exit')

t.after(async () => {
await rmDist(errDist)
})
spyExit.mock.mockImplementation(number => {
throw new Error(`Mocked process.exit: ${number}`)
})
await assert.rejects(
async () => {
await duel(['-p', 'test/__fixtures__/compileErrors/tsconfig.json'])
},
{ message: /Mocked process\.exit/ },
)

assert.ok(spyExit.mock.calls[0].arguments > 0)
assert.equal(spy.mock.calls[1].arguments[1], 'Compilation errors found.')
})

it.skip('reports an error when no package.json file found', async t => {
const spy = t.mock.method(global.console, 'log')

t.after(async () => {
await rmDist(esmDist)
})
await duel(['-p', 'test/__fixtures__/esmProject/tsconfig.json', '--pkg-dir', '/'])
assert.equal(spy.mock.calls[0].arguments[1], 'No package.json file found.')
})
})

0 comments on commit 60659a4

Please sign in to comment.