Skip to content

Commit

Permalink
feat: support CJS configs in ES packages (#553)
Browse files Browse the repository at this point in the history
Co-authored-by: Lachlan Miller <[email protected]>
  • Loading branch information
quisido and lmiller1990 authored Jul 12, 2023
1 parent 161ee05 commit 8015401
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions task-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,24 @@ function readNycOptions(workingDirectory) {
}
}

const nycConfigCommonJsFilename = join(workingDirectory, 'nyc.config.cjs')
let nycConfigCommonJs = {}
if (existsSync(nycConfigCommonJsFilename)) {
try {
nycConfigCommonJs = require(nycConfigCommonJsFilename)
} catch (error) {
throw new Error(`Failed to load nyc.config.cjs: ${error.message}`)
}
}

const nycOptions = combineNycOptions(
defaultNycOptions,
nycrc,
nycrcJson,
nycrcYaml,
nycrcYml,
nycConfig,
nycConfigCommonJs,
pkgNycOptions
)
debug('combined NYC options %o', nycOptions)
Expand Down

0 comments on commit 8015401

Please sign in to comment.