Skip to content

Commit

Permalink
Artifact Directory Unit Tests
Browse files Browse the repository at this point in the history
test: relative directories for tmpDir and reportsDir
test: absolute directories for tmpDir and reportsDir
  • Loading branch information
mcknasty committed Jul 30, 2023
1 parent a13584d commit 5ed96e5
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
12 changes: 10 additions & 2 deletions test/integration.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ hey
---------------------------------------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
---------------------------------------|---------|----------|---------|---------|-------------------
All files | 1.81 | 12.24 | 6.38 | 1.81 |
All files | 1.55 | 11.53 | 6 | 1.55 |
c8 | 0 | 0 | 0 | 0 |
index.js | 0 | 0 | 0 | 0 | 1
c8/bin | 0 | 0 | 0 | 0 |
Expand All @@ -165,6 +165,10 @@ All files | 1.81 | 12.24 | 6.38 | 1.81
block-navigation.js | 0 | 0 | 0 | 0 | 1-87
prettify.js | 0 | 0 | 0 | 0 | 1-2
sorter.js | 0 | 0 | 0 | 0 | 1-196
c8/coverage/lcov-report | 0 | 0 | 0 | 0 |
block-navigation.js | 0 | 0 | 0 | 0 | 1-87
prettify.js | 0 | 0 | 0 | 0 | 1-2
sorter.js | 0 | 0 | 0 | 0 | 1-196
c8/lib | 0 | 0 | 0 | 0 |
is-cjs-esm-bridge.js | 0 | 0 | 0 | 0 | 1-10
parse-args.js | 0 | 0 | 0 | 0 | 1-224
Expand Down Expand Up @@ -522,7 +526,7 @@ hey
---------------------------------------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
---------------------------------------|---------|----------|---------|---------|-------------------
All files | 1.81 | 12.24 | 6.38 | 1.81 |
All files | 1.55 | 11.53 | 6 | 1.55 |
c8 | 0 | 0 | 0 | 0 |
index.js | 0 | 0 | 0 | 0 | 1
c8/bin | 0 | 0 | 0 | 0 |
Expand All @@ -531,6 +535,10 @@ All files | 1.81 | 12.24 | 6.38 | 1.81
block-navigation.js | 0 | 0 | 0 | 0 | 1-87
prettify.js | 0 | 0 | 0 | 0 | 1-2
sorter.js | 0 | 0 | 0 | 0 | 1-196
c8/coverage/lcov-report | 0 | 0 | 0 | 0 |
block-navigation.js | 0 | 0 | 0 | 0 | 1-87
prettify.js | 0 | 0 | 0 | 0 | 1-2
sorter.js | 0 | 0 | 0 | 0 | 1-196
c8/lib | 0 | 0 | 0 | 0 |
is-cjs-esm-bridge.js | 0 | 0 | 0 | 0 | 1-10
parse-args.js | 0 | 0 | 0 | 0 | 1-224
Expand Down
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 5ed96e5

Please sign in to comment.