Skip to content

Commit

Permalink
fix: fs.promises was not introduced until 10 (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoe committed Oct 7, 2019
1 parent 3715f72 commit cdcc225
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/v8-to-istanbul.js
Expand Up @@ -5,9 +5,14 @@ const { dirname, join } = require('path')
const CovBranch = require('./branch')
const CovFunction = require('./function')
const CovSource = require('./source')
const { readFile } = require('fs').promises
const compatError = Error(`requires Node.js ${require('../package.json').engines.node}`)
let readFile = () => { throw compatError }
try {
readFile = require('fs').promises.readFile
} catch (_err) {
// most likely we're on an older version of Node.js.
}
const { SourceMapConsumer } = require('source-map')

const isOlderNode10 = /^v10\.(([0-9]\.)|(1[0-5]\.))/u.test(process.version)

// Injected when Node.js is loading script into isolate pre Node 10.16.x.
Expand Down

0 comments on commit cdcc225

Please sign in to comment.