Skip to content

Commit

Permalink
fix: Enable es-modules by default. (#889)
Browse files Browse the repository at this point in the history
A previous fix for #796 added an es-modules option and set it false by
default.  This default was a change of behavior in NYC as previously all
sources were parsed as ES modules by the instrumenter.  I believe the
old behavior is the correct default because it allows NYC to work with
modern code.  Code which uses certain features which violate strict mode
will have to disable es-modules.  This will not effect ES5 which follows
the rules of 'use strict'.
  • Loading branch information
coreyfarrell authored Jul 23, 2018
1 parent 6b6cd5e commit d0b76e2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/config-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Config.buildYargs = function (cwd) {
global: false
})
.option('es-modules', {
default: false,
default: true,
type: 'boolean',
describe: 'tell the instrumenter to treat files as ES Modules',
global: false
Expand Down
2 changes: 1 addition & 1 deletion test/nyc-bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -1035,6 +1035,7 @@ describe('the nyc cli', function () {
const args = [
bin,
'--cache', 'false',
'--es-modules', 'false',
process.execPath, './not-strict.js'
]

Expand Down Expand Up @@ -1065,7 +1066,6 @@ describe('the nyc cli', function () {
const args = [
bin,
'--cache', 'false',
'--es-modules', 'true',
'--exit-on-error', 'true',
process.execPath, './not-strict.js'
]
Expand Down

0 comments on commit d0b76e2

Please sign in to comment.