Skip to content

Commit 8015401

Browse files
quisidolmiller1990
andauthored
feat: support CJS configs in ES packages (#553)
Co-authored-by: Lachlan Miller <[email protected]>
1 parent 161ee05 commit 8015401

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

task-utils.js

+11
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,24 @@ function readNycOptions(workingDirectory) {
6262
}
6363
}
6464

65+
const nycConfigCommonJsFilename = join(workingDirectory, 'nyc.config.cjs')
66+
let nycConfigCommonJs = {}
67+
if (existsSync(nycConfigCommonJsFilename)) {
68+
try {
69+
nycConfigCommonJs = require(nycConfigCommonJsFilename)
70+
} catch (error) {
71+
throw new Error(`Failed to load nyc.config.cjs: ${error.message}`)
72+
}
73+
}
74+
6575
const nycOptions = combineNycOptions(
6676
defaultNycOptions,
6777
nycrc,
6878
nycrcJson,
6979
nycrcYaml,
7080
nycrcYml,
7181
nycConfig,
82+
nycConfigCommonJs,
7283
pkgNycOptions
7384
)
7485
debug('combined NYC options %o', nycOptions)

0 commit comments

Comments
 (0)