Skip to content

Commit

Permalink
Detect whether error source is on a different drive (on Windows)
Browse files Browse the repository at this point in the history
  • Loading branch information
novemberborn committed Sep 2, 2019
1 parent fb0c536 commit e598c30
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/serialize-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ function buildSource(source) {
const file = path.resolve(projectDir, source.file.trim());
const rel = path.relative(projectDir, file);

const isWithinProject = rel.split(path.sep)[0] !== '..';
const [segment] = rel.split(path.sep);
const isWithinProject = segment !== '..' && (process.platform !== 'win32' || !segment.includes(':'));
const isDependency = isWithinProject && path.dirname(rel).split(path.sep).includes('node_modules');

return {
Expand Down

0 comments on commit e598c30

Please sign in to comment.