Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
os:
- linux
- windows

node_js:
- "8"
- "10"
- "14"
- "16"
language: node_js
install:
- npm install
- npm install -g codecov istanbul
script:
- npm test
- istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec
- codecov
- codecov
10 changes: 7 additions & 3 deletions module.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@ class Link extends Code {
this.importedCodeRef = importedCodeRef;
}

unixify(str) {
return str.replace(/[\\\/]+/g, '/');
}

toString() {
if (this.importedCodeRef.external) {
return `require('${this.importedCodeRef.getPath()}')`;
return `require('${this.unixify(this.importedCodeRef.getPath())}')`;
}
const path = relative(Path.resolve(this.hostCodeRef.getPath(), '..'),
this.importedCodeRef.getPath());
const path = this.unixify(relative(Path.resolve(this.hostCodeRef.getPath(), '..'),
this.importedCodeRef.getPath()));
return `require('${/\./.test(path) ? path : `./${path}`}')`;
}
}
Expand Down