Skip to content

Commit bf3073b

Browse files
authored
test: relative directories for tmpDir and reportsDir
test: absolute directories for tmpDir and reportsDir
1 parent 4ae2a4d commit bf3073b

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

test/parse-args.js

+23-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const {
66
hideInstrumenterArgs
77
} = require('../lib/parse-args')
88

9-
const { join } = require('path')
9+
const { join, resolve } = require('path')
1010

1111
describe('parse-args', () => {
1212
describe('hideInstrumenteeArgs', () => {
@@ -63,6 +63,28 @@ describe('parse-args', () => {
6363
argv.lines.should.be.equal(100)
6464
argv.functions.should.be.equal(24)
6565
})
66+
it('should allow relative path reports directories', () => {
67+
const argsArray = ['node', 'c8', '--lines', '100', '--reports-dir', './coverage_']
68+
const argv = buildYargs().parse(argsArray)
69+
argv.reportsDir.should.be.equal('./coverage_')
70+
})
71+
it('should allow relative path temporary directories', () => {
72+
const argsArray = ['node', 'c8', '--lines', '100', '--temp-directory', './coverage/tmp_']
73+
const argv = buildYargs().parse(argsArray)
74+
argv.tempDirectory.should.be.equal('./coverage/tmp_')
75+
})
76+
it('should allow absolute path reports directories', () => {
77+
const tmpDir = resolve(process.cwd(), 'coverage_')
78+
const argsArray = ['node', 'c8', '--lines', '100', '--reports-dir', tmpDir]
79+
const argv = buildYargs().parse(argsArray)
80+
argv.reportsDir.should.be.equal(tmpDir)
81+
})
82+
it('should allow absolute path temporary directories', () => {
83+
const tmpDir = resolve(process.cwd(), './coverage/tmp_')
84+
const argsArray = ['node', 'c8', '--lines', '100', '--temp-directory', tmpDir]
85+
const argv = buildYargs().parse(argsArray)
86+
argv.tempDirectory.should.be.equal(tmpDir)
87+
})
6688
})
6789

6890
describe('--merge-async', () => {

0 commit comments

Comments
 (0)