Skip to content

Commit

Permalink
feat: allow babel cache to be enabled (#517)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoe authored Feb 7, 2017
1 parent 50adde4 commit 98ebdff
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
11 changes: 7 additions & 4 deletions bin/nyc.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#!/usr/bin/env node

// the babel cache does not play nicely with nyc.
process.env.BABEL_DISABLE_CACHE = '1'

var configUtil = require('../lib/config-util')
var foreground = require('foreground-child')
var NYC
Expand Down Expand Up @@ -50,9 +47,15 @@ if (argv._[0] === 'report') {
NYC_CONFIG: JSON.stringify(config),
NYC_CWD: process.cwd(),
NYC_ROOT_ID: nyc.rootId,
BABEL_DISABLE_CACHE: 1,
NYC_INSTRUMENTER: config.instrumenter
}

if (config['babel-cache'] === false) {
// babel's cache interferes with some configurations, so is
// disabled by default. opt in by setting babel-cache=true.
env.BABEL_DISABLE_CACHE = process.env.BABEL_DISABLE_CACHE = '1'
}

sw([wrapper], env)

// Both running the test script invocation and the check-coverage run may
Expand Down
5 changes: 5 additions & 0 deletions lib/config-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ Config.buildYargs = function (cwd) {
type: 'boolean',
describe: 'cache instrumentation results for improved performance'
})
.option('babel-cache', {
default: false,
type: 'boolean',
describe: 'cache babel transpilation results for improved performance'
})
.option('extension', {
alias: 'e',
default: [],
Expand Down

0 comments on commit 98ebdff

Please sign in to comment.