Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Commit

Permalink
fix: fixed tests in windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Feb 6, 2018
1 parent c30f51d commit 5e19840
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/handle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {CLIError, config, ExitError} from '../src'
import {handle} from '../src/handle'

const errlog = path.join(__dirname, '../tmp/mytest/error.log')
const x = process.platform === 'win32' ? '×' : '✖'

describe('handle', () => {
fancy
Expand All @@ -31,7 +32,7 @@ describe('handle', () => {
.finally(() => delete process.exitCode)
.it('shows a cli error', ctx => {
handle(new CLIError('x'))
expect(ctx.stderr).to.equal(' ✖ Error: x\n')
expect(ctx.stderr).to.equal(` ${x} Error: x\n`)
expect(process.exitCode).to.equal(2)
})

Expand All @@ -53,7 +54,7 @@ describe('handle', () => {
.finally(() => delete process.exitCode)
.it('logs when errlog is set', async ctx => {
handle(new CLIError('uh oh!'))
expect(ctx.stderr).to.equal(' ✖ Error: uh oh!\n')
expect(ctx.stderr).to.equal(` ${x} Error: uh oh!\n`)
expect(process.exitCode).to.equal(2)
await config.errorLogger!.flush()
expect(fs.readFileSync(errlog, 'utf8')).to.contain('Error: uh oh!')
Expand Down

0 comments on commit 5e19840

Please sign in to comment.