Skip to content

Commit

Permalink
import coverage map module via url
Browse files Browse the repository at this point in the history
Gets confused when the path looks like a url because windows drive letter.

Fix: #894
  • Loading branch information
isaacs committed Sep 17, 2023
1 parent edd23ad commit a685b06
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/run/src/coverage-map.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { LoadedConfig } from '@tapjs/config'
import { resolve } from 'path'
import { pathToFileURL } from 'url'

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

0 comments on commit a685b06

Please sign in to comment.