Skip to content

Commit a685b06

Browse files
committed
import coverage map module via url
Gets confused when the path looks like a url because windows drive letter. Fix: #894
1 parent edd23ad commit a685b06

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/run/src/coverage-map.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { LoadedConfig } from '@tapjs/config'
22
import { resolve } from 'path'
3+
import { pathToFileURL } from 'url'
34

45
const isStringArray = (a: any): a is string[] =>
56
Array.isArray(a) && !a.some(s => typeof s !== 'string')
@@ -10,7 +11,7 @@ export const getCoverageMap = async (config: LoadedConfig) => {
1011
const coverageMap = config.get('coverage-map')
1112
if (!coverageMap) return () => []
1213
const mapModule = (await import(
13-
resolve(config.globCwd, coverageMap)
14+
String(pathToFileURL(resolve(config.globCwd, coverageMap)))
1415
).catch(er => {
1516
throw new Error(
1617
`Coverage map ${coverageMap} is not a valid module. ${er.message}`

0 commit comments

Comments
 (0)