mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-31 03:17:22 +02:00
Merge pull request #20710 from calixteman/normalize_path
Remove the leading slash in windows file path when instrumenting js files for ccov
This commit is contained in:
commit
1df6367ef9
@ -306,7 +306,15 @@ class WebServer {
|
|||||||
|
|
||||||
// Transform with Babel and istanbul plugin
|
// Transform with Babel and istanbul plugin
|
||||||
const result = babel.transformSync(content, {
|
const result = babel.transformSync(content, {
|
||||||
filename: fileURL.pathname,
|
// On Windows, the file URL starts with a slash (e.g.
|
||||||
|
// /C:/path/to/file.js).
|
||||||
|
// This leading slash makes the file path invalid and causes the
|
||||||
|
// instrumentation to fail, so we need to remove it before passing the
|
||||||
|
// path.
|
||||||
|
filename:
|
||||||
|
process.platform === "win32"
|
||||||
|
? fileURL.pathname.substring(1)
|
||||||
|
: fileURL.pathname,
|
||||||
plugins: ["babel-plugin-istanbul"],
|
plugins: ["babel-plugin-istanbul"],
|
||||||
sourceMaps: false,
|
sourceMaps: false,
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user