diff --git a/src/index.ts b/src/index.ts index c94f4a60..18e405d4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -10,10 +10,8 @@ export interface RimrafOptions { maxBackoff?: number } -/* c8 ignore start */ const typeOrUndef = (val: any, t: string) => typeof val === 'undefined' || typeof val === t -/* c8 ignore stop */ export const isRimrafOptions = (o: any): o is RimrafOptions => !!o && @@ -25,7 +23,6 @@ export const isRimrafOptions = (o: any): o is RimrafOptions => typeOrUndef(o.backoff, 'number') && typeOrUndef(o.maxBackoff, 'number') -/* c8 ignore start */ export const assertRimrafOptions: (o: any) => void = ( o: any ): asserts o is RimrafOptions => { @@ -33,7 +30,6 @@ export const assertRimrafOptions: (o: any) => void = ( throw new Error('invalid rimraf options') } } -/* c8 ignore stop */ import { rimrafManual, rimrafManualSync } from './rimraf-manual.js' import { rimrafMoveRemove, rimrafMoveRemoveSync } from './rimraf-move-remove.js' diff --git a/test/opt-arg.js b/test/opt-arg.js index cf14d13d..f1460ac7 100644 --- a/test/opt-arg.js +++ b/test/opt-arg.js @@ -3,3 +3,8 @@ const optArg = require('../dist/cjs/src/opt-arg.js').default const opt = { a: 1 } t.equal(optArg(opt), opt, 'returns object if provided') t.same(optArg(), {}, 'returns new object otherwise') + +t.throws(() => optArg(true)) +t.throws(() => optArg(null)) +t.throws(() => optArg('hello')) +t.throws(() => optArg({ maxRetries: 'banana' }))