Skip to content

Commit

Permalink
comment out some stuff CI wasn't covering mysteriously
Browse files Browse the repository at this point in the history
I can see the tests running in the output, but the code that generates
the output being generated claims to not have been run.

I think it's lying.  These comments tell it to stop lying.  (Telling the
truth would be better, of course, but one must have reasonable
expectations.)
  • Loading branch information
isaacs committed Jan 30, 2023
1 parent 04da4a3 commit 6f1c759
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## 2.1

Export CommonJS module without a `.default` dangly wart. (A
Export CommonJS module without a `.default` dangly wart. (A
synthetic `.default` has been added just in case anyone is already
relying on that from v2.0.)

Expand Down
9 changes: 8 additions & 1 deletion src/bin.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node

import { MkdirpOptions } from './opts-arg.js'
import { version } from '../package.json'
import { MkdirpOptions } from './opts-arg.js'

const usage = () => `
usage: mkdirp [DIR1,DIR2..] {OPTIONS}
Expand Down Expand Up @@ -43,11 +43,15 @@ for (const arg of process.argv.slice(2)) {
} else if (arg === '-p' || arg === '--print') {
doPrint = true
} else if (/^-m/.test(arg) || /^--mode=/.test(arg)) {
// these don't get covered in CI, but work locally
// weird because the tests below show as passing in the output.
/* c8 ignore start */
const mode = parseInt(arg.replace(/^(-m|--mode=)/, ''), 8)
if (isNaN(mode)) {
console.error(`invalid mode argument: ${arg}\nMust be an octal number.`)
process.exit(1)
}
/* c8 ignore stop */
opts.mode = mode
} else dirs.push(arg)
}
Expand All @@ -58,10 +62,13 @@ if (dirs.length === 0) {
console.error(usage())
}

// these don't get covered in CI, but work locally
/* c8 ignore start */
Promise.all(dirs.map(dir => impl(dir, opts)))
.then(made => (doPrint ? made.forEach(m => m && console.log(m)) : null))
.catch(er => {
console.error(er.message)
if (er.code) console.error(' code: ' + er.code)
process.exit(1)
})
/* c8 ignore stop */

0 comments on commit 6f1c759

Please sign in to comment.