From 7d7c9cbad5c9c568b39bf20ea723a2edb062f7d9 Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Sun, 23 Jun 2019 18:42:52 -0700 Subject: [PATCH] fix: Node >10.16.0 now uses new module wrap API --- lib/v8-to-istanbul.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/v8-to-istanbul.js b/lib/v8-to-istanbul.js index a7e4f56a..f09347c0 100644 --- a/lib/v8-to-istanbul.js +++ b/lib/v8-to-istanbul.js @@ -8,11 +8,11 @@ const CovSource = require('./source') const { readFileSync } = require('fs') const { SourceMapConsumer } = require('source-map') -const isNode10 = !!process.version.match(/^v10/) +const isOlderNode10 = /^v10\.[0-5]/u.test(process.version) -// Injected when Node.js is loading script into isolate pre Node 11. +// Injected when Node.js is loading script into isolate pre Node 10.16.x. // see: https://github.com/nodejs/node/pull/21573. -const cjsWrapperLength = isNode10 ? require('module').wrapper[0].length : 0 +const cjsWrapperLength = isOlderNode10 ? require('module').wrapper[0].length : 0 module.exports = class V8ToIstanbul { constructor (scriptPath, wrapperLength, sources) {