Skip to content

Commit

Permalink
fix: shebang handling supported in Node v12 (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoe committed Oct 24, 2020
1 parent 0d3b57f commit 522e4c2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/source.js
Expand Up @@ -206,10 +206,10 @@ function originalPositionTryBoth (sourceMap, line, column) {
return original
}

// Not required since Node 13, see: https://github.com/nodejs/node/pull/27375
const isPrerNode13 = /^v1[0-2]\./u.test(process.version)
// Not required since Node 12, see: https://github.com/nodejs/node/pull/27375
const isPreNode12 = /^v1[0-1]\./u.test(process.version)
function getShebangLength (source) {
if (isPrerNode13 && source.indexOf('#!') === 0) {
if (isPreNode12 && source.indexOf('#!') === 0) {
const match = source.match(/(?<shebang>#!.*)/)
if (match) {
return match.groups.shebang.length
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/shebang.js
@@ -1,6 +1,6 @@
module.exports = {
describe: 'shebang',
maxNodeVersion: 'v13.0.0',
maxNodeVersion: 'v12.0.0',
coverageV8: {
"scriptId": "56",
"url": "./test/fixtures/scripts/shebang.js",
Expand Down

0 comments on commit 522e4c2

Please sign in to comment.