11'use strict' ;
22
33var invokeMochaAsync = require ( '../helpers' ) . invokeMochaAsync ;
4- var utils = require ( '../../../lib/utils' ) ;
54
65/**
76 * Extracts root hook log messages from run results
@@ -99,38 +98,28 @@ describe('root hooks', function() {
9998 } ) ;
10099
101100 describe ( 'support ESM when type=module or .mjs extension' , function ( ) {
102- before ( function ( ) {
103- if ( ! utils . supportsEsModules ( ) ) this . skip ( ) ;
104- } ) ;
105-
106101 it ( 'should run root hooks when provided via mochaHooks' , function ( ) {
107102 return expect (
108- runMochaForHookOutput (
109- [
110- '--require=' +
111- require . resolve (
112- // as object
113- '../fixtures/plugins/root-hooks/root-hook-defs-esm.fixture.mjs'
114- ) ,
115- '--require=' +
116- require . resolve (
117- // as function
118- '../fixtures/plugins/root-hooks/esm/root-hook-defs-esm.fixture.js'
119- ) ,
120- '--require=' +
121- require . resolve (
122- // mixed with commonjs
123- '../fixtures/plugins/root-hooks/root-hook-defs-a.fixture.js'
124- ) ,
103+ runMochaForHookOutput ( [
104+ '--require=' +
105+ require . resolve (
106+ // as object
107+ '../fixtures/plugins/root-hooks/root-hook-defs-esm.fixture.mjs'
108+ ) ,
109+ '--require=' +
125110 require . resolve (
126- '../fixtures/plugins/root-hooks/root-hook-test.fixture.js'
127- )
128- ] . concat (
129- + process . versions . node . split ( '.' ) [ 0 ] >= 13
130- ? [ ]
131- : '--experimental-modules'
111+ // as function
112+ '../fixtures/plugins/root-hooks/esm/root-hook-defs-esm.fixture.js'
113+ ) ,
114+ '--require=' +
115+ require . resolve (
116+ // mixed with commonjs
117+ '../fixtures/plugins/root-hooks/root-hook-defs-a.fixture.js'
118+ ) ,
119+ require . resolve (
120+ '../fixtures/plugins/root-hooks/root-hook-test.fixture.js'
132121 )
133- ) ,
122+ ] ) ,
134123 'to be fulfilled with' ,
135124 [
136125 'afterAll' ,
@@ -147,10 +136,6 @@ describe('root hooks', function() {
147136 } ) ;
148137
149138 describe ( 'support ESM via .js extension w/o type=module' , function ( ) {
150- before ( function ( ) {
151- if ( ! utils . supportsEsModules ( ) ) this . skip ( ) ;
152- } ) ;
153-
154139 it ( 'should fail due to ambiguous file type' , function ( ) {
155140 return expect (
156141 invokeMochaAsync (
@@ -160,11 +145,7 @@ describe('root hooks', function() {
160145 // as object
161146 '../fixtures/plugins/root-hooks/root-hook-defs-esm-broken.fixture.js'
162147 )
163- ] . concat (
164- + process . versions . node . split ( '.' ) [ 0 ] >= 13
165- ? [ ]
166- : '--experimental-modules'
167- ) ,
148+ ] ,
168149 'pipe'
169150 ) [ 1 ] ,
170151 'when fulfilled' ,
0 commit comments