Skip to content

Commit

Permalink
test: relative directories for tmpDir and reportsDir
Browse files Browse the repository at this point in the history
test: absolute directories for tmpDir and reportsDir
  • Loading branch information
mcknasty committed Jan 15, 2024
1 parent 4ae2a4d commit bf3073b
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion test/parse-args.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const {
hideInstrumenterArgs
} = require('../lib/parse-args')

const { join } = require('path')
const { join, resolve } = require('path')

describe('parse-args', () => {
describe('hideInstrumenteeArgs', () => {
Expand Down Expand Up @@ -63,6 +63,28 @@ describe('parse-args', () => {
argv.lines.should.be.equal(100)
argv.functions.should.be.equal(24)
})
it('should allow relative path reports directories', () => {
const argsArray = ['node', 'c8', '--lines', '100', '--reports-dir', './coverage_']
const argv = buildYargs().parse(argsArray)
argv.reportsDir.should.be.equal('./coverage_')
})
it('should allow relative path temporary directories', () => {
const argsArray = ['node', 'c8', '--lines', '100', '--temp-directory', './coverage/tmp_']
const argv = buildYargs().parse(argsArray)
argv.tempDirectory.should.be.equal('./coverage/tmp_')
})
it('should allow absolute path reports directories', () => {
const tmpDir = resolve(process.cwd(), 'coverage_')
const argsArray = ['node', 'c8', '--lines', '100', '--reports-dir', tmpDir]
const argv = buildYargs().parse(argsArray)
argv.reportsDir.should.be.equal(tmpDir)
})
it('should allow absolute path temporary directories', () => {
const tmpDir = resolve(process.cwd(), './coverage/tmp_')
const argsArray = ['node', 'c8', '--lines', '100', '--temp-directory', tmpDir]
const argv = buildYargs().parse(argsArray)
argv.tempDirectory.should.be.equal(tmpDir)
})
})

describe('--merge-async', () => {
Expand Down

0 comments on commit bf3073b

Please sign in to comment.