@@ -1030,6 +1030,76 @@ describe('the nyc cli', function () {
10301030 } )
10311031 } )
10321032
1033+ describe ( 'es-modules' , ( ) => {
1034+ it ( 'allows reserved word when es-modules is disabled' , ( done ) => {
1035+ const args = [
1036+ bin ,
1037+ '--cache' , 'false' ,
1038+ process . execPath , './not-strict.js'
1039+ ]
1040+
1041+ const proc = spawn ( process . execPath , args , {
1042+ cwd : fixturesCLI ,
1043+ env : env
1044+ } )
1045+
1046+ var stdout = ''
1047+ proc . stdout . on ( 'data' , function ( chunk ) {
1048+ stdout += chunk
1049+ } )
1050+
1051+ proc . on ( 'close' , function ( code ) {
1052+ code . should . equal ( 0 )
1053+ stdoutShouldEqual ( stdout , `
1054+ ---------------|----------|----------|----------|----------|-------------------|
1055+ File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
1056+ ---------------|----------|----------|----------|----------|-------------------|
1057+ All files | 100 | 100 | 100 | 100 | |
1058+ not-strict.js | 100 | 100 | 100 | 100 | |
1059+ ---------------|----------|----------|----------|----------|-------------------|` )
1060+ done ( )
1061+ } )
1062+ } )
1063+
1064+ it ( 'forbids reserved word when es-modules is not disabled' , ( done ) => {
1065+ const args = [
1066+ bin ,
1067+ '--cache' , 'false' ,
1068+ '--es-modules' , 'true' ,
1069+ '--exit-on-error' , 'true' ,
1070+ process . execPath , './not-strict.js'
1071+ ]
1072+
1073+ const proc = spawn ( process . execPath , args , {
1074+ cwd : fixturesCLI ,
1075+ env : env
1076+ } )
1077+
1078+ var stdout = ''
1079+ proc . stdout . on ( 'data' , function ( chunk ) {
1080+ stdout += chunk
1081+ } )
1082+
1083+ var stderr = ''
1084+ proc . stderr . on ( 'data' , function ( chunk ) {
1085+ stderr += chunk
1086+ } )
1087+
1088+ proc . on ( 'close' , function ( code ) {
1089+ code . should . equal ( 1 )
1090+ stdoutShouldEqual ( stderr , `
1091+ Failed to instrument ${ path . join ( fixturesCLI , 'not-strict.js' ) } ` )
1092+ stdoutShouldEqual ( stdout , `
1093+ ----------|----------|----------|----------|----------|-------------------|
1094+ File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
1095+ ----------|----------|----------|----------|----------|-------------------|
1096+ All files | 0 | 0 | 0 | 0 | |
1097+ ----------|----------|----------|----------|----------|-------------------|` )
1098+ done ( )
1099+ } )
1100+ } )
1101+ } )
1102+
10331103 describe ( 'merge' , ( ) => {
10341104 it ( 'combines multiple coverage reports' , ( done ) => {
10351105 const args = [
0 commit comments