Skip to content

Commit

Permalink
chore(deps): update standard from 14.3.1 to 17.0.0 (#10)
Browse files Browse the repository at this point in the history
* chore(deps): update standard from 14.3.1 to 17.0.0

* ci: run standard --fix

* fix: replace unexpected var with let
  • Loading branch information
cschanaj authored Aug 26, 2022
1 parent 19bb979 commit 63c9578
Show file tree
Hide file tree
Showing 9 changed files with 2,550 additions and 2,236 deletions.
2 changes: 1 addition & 1 deletion bin/nyc.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ async function main () {
if (!argv.instrument) argv.instrumenter = './lib/instrumenters/noop'
else argv.instrumenter = './lib/instrumenters/istanbul'

var nyc = (new NYC(argv))
const nyc = (new NYC(argv))
if (argv.clean) {
await nyc.reset()
} else {
Expand Down
16 changes: 8 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const selfCoverageHelper = global[nycSelfCoverageHelper] || {
}

function coverageFinder () {
var coverage = global.__coverage__
let coverage = global.__coverage__
if (typeof __coverage__ === 'object') coverage = __coverage__
if (!coverage) coverage = global.__coverage__ = {}
return coverage
Expand Down Expand Up @@ -105,7 +105,7 @@ class NYC {
// when running --all we should not load source-file from
// cache, we want to instead return the fake source.
disableCache: this._disableCachingTransform(),
ext: ext
ext
}
if (this._eagerInstantiation) {
opts.transform = this._transformFactory(this.cacheDirectory)
Expand Down Expand Up @@ -153,8 +153,8 @@ class NYC {
}

_readTranspiledSource (filePath) {
var source = null
var ext = path.extname(filePath)
let source = null
let ext = path.extname(filePath)
if (typeof Module._extensions[ext] === 'undefined') {
ext = '.js'
}
Expand Down Expand Up @@ -386,7 +386,7 @@ class NYC {
}

writeCoverageFile () {
var coverage = coverageFinder()
const coverage = coverageFinder()

// Remove any files that should be excluded but snuck into the coverage
Object.keys(coverage).forEach(function (absFile) {
Expand All @@ -403,8 +403,8 @@ class NYC {
}, this)
}

var id = this.processInfo.uuid
var coverageFilename = path.resolve(this.tempDirectory(), id + '.json')
const id = this.processInfo.uuid
const coverageFilename = path.resolve(this.tempDirectory(), id + '.json')

fs.writeFileSync(
coverageFilename,
Expand Down Expand Up @@ -493,7 +493,7 @@ class NYC {

_checkCoverage (summary, thresholds, file) {
Object.keys(thresholds).forEach(function (key) {
var coverage = summary[key].pct
const coverage = summary[key].pct
if (coverage < thresholds[key]) {
process.exitCode = 1
if (file) {
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ exports.builder = function (yargs) {

exports.handler = cliWrapper(async argv => {
process.env.NYC_CWD = process.cwd()
var nyc = new NYC(argv)
const nyc = new NYC(argv)
await nyc.report().catch(suppressEPIPE)
if (argv.checkCoverage) {
await nyc.checkCoverage({
Expand Down
4 changes: 2 additions & 2 deletions lib/instrumenters/istanbul.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ function InstrumenterIstanbul (options) {

return {
instrumentSync (code, filename, { sourceMap, registerMap }) {
var instrumented = instrumenter.instrumentSync(code, filename, sourceMap)
let instrumented = instrumenter.instrumentSync(code, filename, sourceMap)
if (instrumented !== code) {
registerMap()
}

// the instrumenter can optionally produce source maps,
// this is useful for features like remapping stack-traces.
if (options.produceSourceMap) {
var lastSourceMap = instrumenter.lastSourceMap()
const lastSourceMap = instrumenter.lastSourceMap()
/* istanbul ignore else */
if (lastSourceMap) {
instrumented += '\n' + convertSourceMap.fromObject(lastSourceMap).toComment()
Expand Down
8 changes: 4 additions & 4 deletions lib/process-args.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = {
// don't pass arguments that are meant
// for nyc to the bin being instrumented.
hideInstrumenterArgs: function (yargv) {
var argv = process.argv.slice(1)
let argv = process.argv.slice(1)
argv = argv.slice(argv.indexOf(yargv._[0]))
if (argv[0][0] === '-') {
argv.unshift(process.execPath)
Expand All @@ -22,10 +22,10 @@ module.exports = {
// don't pass arguments for the bin being
// instrumented to nyc.
hideInstrumenteeArgs: function () {
var argv = process.argv.slice(2)
var yargv = Parser(argv)
let argv = process.argv.slice(2)
const yargv = Parser(argv)
if (!yargv._.length) return argv
for (var i = 0, command; (command = yargv._[i]) !== undefined; i++) {
for (let i = 0, command; (command = yargv._[i]) !== undefined; i++) {
if (~commands.indexOf(command)) return argv
}

Expand Down
Loading

0 comments on commit 63c9578

Please sign in to comment.