File tree 6 files changed +18
-15
lines changed
6 files changed +18
-15
lines changed Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
- module . exports = require ( '../lib/worker/main' ) ;
2
+ module . exports = require ( '../lib/worker/main.cjs ' ) ;
Original file line number Diff line number Diff line change 1
- import test from '../lib/worker/main.js' ; // eslint-disable-line import/extensions
1
+ import test from '../lib/worker/main.cjs' ;
2
2
export default test ;
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ const run = async options => {
21
21
const dependencyTracking = require ( './dependency-tracker' ) ;
22
22
const lineNumberSelection = require ( './line-numbers' ) ;
23
23
24
- const { sharedWorkerTeardowns} = require ( './state.cjs' ) ;
24
+ const { flags , refs , sharedWorkerTeardowns} = require ( './state.cjs' ) ;
25
25
26
26
async function exit ( code ) {
27
27
if ( ! process . exitCode ) {
@@ -61,6 +61,8 @@ const run = async options => {
61
61
updateSnapshots : options . updateSnapshots
62
62
} ) ;
63
63
64
+ refs . runnerChain = runner . chain ;
65
+
64
66
channel . peerFailed . then ( ( ) => { // eslint-disable-line promise/prefer-await-to-then
65
67
runner . interrupt ( ) ;
66
68
} ) ;
@@ -118,12 +120,6 @@ const run = async options => {
118
120
exit ( 1 ) ;
119
121
} ) ;
120
122
121
- let accessedRunner = false ;
122
- exports . getRunner = ( ) => {
123
- accessedRunner = true ;
124
- return runner ;
125
- } ;
126
-
127
123
// Store value to prevent required modules from modifying it.
128
124
const testPath = options . file ;
129
125
@@ -195,7 +191,7 @@ const run = async options => {
195
191
196
192
await load ( testPath ) ;
197
193
198
- if ( accessedRunner ) {
194
+ if ( flags . loadedMain ) {
199
195
// Unreference the channel if the test file required AVA. This stops it
200
196
// from keeping the event loop busy, which means the `beforeExit` event can be
201
197
// used to detect when tests stall.
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+ require ( './guard-environment.cjs' ) ; // eslint-disable-line import/no-unassigned-import
3
+
4
+ const assert = require ( 'assert' ) ;
5
+ const { flags, refs} = require ( './state.cjs' ) ;
6
+ assert ( refs . runnerChain ) ;
7
+
8
+ flags . loadedMain = true ;
9
+
10
+ module . exports = refs . runnerChain ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
+ exports . flags = { loadedMain : false } ;
3
+ exports . refs = { runnerChain : null } ;
2
4
exports . sharedWorkerTeardowns = [ ] ;
3
5
exports . waitForReady = [ ] ;
You can’t perform that action at this time.
0 commit comments