@@ -24,38 +24,38 @@ import { GLOBAL, VERSION } from '../configs/poku.js';
24
24
const enforce = hasArg ( 'enforce' ) || hasArg ( 'x' , '-' ) ;
25
25
const configFile = getArg ( 'config' ) || getArg ( 'c' , '-' ) ;
26
26
27
- GLOBAL . defaultConfigs = await getConfigs ( configFile ) ;
28
- const { defaultConfigs } = GLOBAL ;
27
+ GLOBAL . configsFromFile = await getConfigs ( configFile ) ;
29
28
29
+ const { configsFromFile } = GLOBAL ;
30
30
const dirs : string [ ] =
31
31
getPaths ( '-' ) ??
32
- ( defaultConfigs ?. include
33
- ? Array . prototype . concat ( defaultConfigs ?. include )
32
+ ( configsFromFile ?. include
33
+ ? Array . prototype . concat ( configsFromFile ?. include )
34
34
: [ '.' ] ) ;
35
- const filter = getArg ( 'filter' ) ?? defaultConfigs ?. filter ;
36
- const exclude = getArg ( 'exclude' ) ?? defaultConfigs ?. exclude ;
35
+ const filter = getArg ( 'filter' ) ?? configsFromFile ?. filter ;
36
+ const exclude = getArg ( 'exclude' ) ?? configsFromFile ?. exclude ;
37
37
const killPort = getArg ( 'killPort' ) ;
38
38
const killRange = getArg ( 'killRange' ) ;
39
39
const killPID = getArg ( 'killPid' ) ;
40
40
/* c8 ignore start */ // Deno
41
- const denoAllow = argToArray ( 'denoAllow' ) ?? defaultConfigs ?. deno ?. allow ;
42
- const denoDeny = argToArray ( 'denoDeny' ) ?? defaultConfigs ?. deno ?. deny ;
41
+ const denoAllow = argToArray ( 'denoAllow' ) ?? configsFromFile ?. deno ?. allow ;
42
+ const denoDeny = argToArray ( 'denoDeny' ) ?? configsFromFile ?. deno ?. deny ;
43
43
const denoCJS =
44
44
getArg ( 'denoCjs' )
45
45
?. split ( ',' )
46
46
. map ( ( a ) => a . trim ( ) )
47
47
. filter ( ( a ) => a ) ||
48
48
hasArg ( 'denoCjs' ) ||
49
- defaultConfigs ?. deno ?. cjs ;
49
+ configsFromFile ?. deno ?. cjs ;
50
50
/* c8 ignore stop */
51
- const quiet = hasArg ( 'quiet' ) || hasArg ( 'q' , '-' ) || defaultConfigs ?. quiet ;
52
- const debug = hasArg ( 'debug' ) || hasArg ( 'd' , '-' ) || defaultConfigs ?. debug ;
53
- const failFast = hasArg ( 'failFast' ) || defaultConfigs ?. failFast ;
51
+ const quiet = hasArg ( 'quiet' ) || hasArg ( 'q' , '-' ) || configsFromFile ?. quiet ;
52
+ const debug = hasArg ( 'debug' ) || hasArg ( 'd' , '-' ) || configsFromFile ?. debug ;
53
+ const failFast = hasArg ( 'failFast' ) || configsFromFile ?. failFast ;
54
54
const watchMode = hasArg ( 'watch' ) || hasArg ( 'w' , '-' ) ;
55
55
const hasEnvFile = hasArg ( 'envFile' ) ;
56
56
const concurrency = ( ( ) => {
57
57
const value = Number ( getArg ( 'concurrency' ) ) ;
58
- return Number . isNaN ( value ) ? defaultConfigs ?. concurrency : value ;
58
+ return Number . isNaN ( value ) ? configsFromFile ?. concurrency : value ;
59
59
} ) ( ) ;
60
60
const sequential = hasArg ( 'sequential' ) ;
61
61
@@ -96,7 +96,7 @@ import { GLOBAL, VERSION } from '../configs/poku.js';
96
96
}
97
97
98
98
GLOBAL . configFile = configFile ;
99
- GLOBAL . options = {
99
+ GLOBAL . configs = {
100
100
filter :
101
101
typeof filter === 'string' ? new RegExp ( escapeRegExp ( filter ) ) : filter ,
102
102
exclude :
@@ -113,30 +113,30 @@ import { GLOBAL, VERSION } from '../configs/poku.js';
113
113
} ,
114
114
noExit : watchMode ,
115
115
beforeEach :
116
- 'beforeEach' in defaultConfigs ? defaultConfigs . beforeEach : undefined ,
116
+ 'beforeEach' in configsFromFile ? configsFromFile . beforeEach : undefined ,
117
117
afterEach :
118
- 'afterEach' in defaultConfigs ? defaultConfigs . afterEach : undefined ,
118
+ 'afterEach' in configsFromFile ? configsFromFile . afterEach : undefined ,
119
119
} ;
120
120
121
121
const tasks : Promise < unknown > [] = [];
122
122
123
- if (hasEnvFile || defaultConfigs ?.envFile) {
124
- GLOBAL . envFile = getArg ( 'envFile' ) ?? defaultConfigs ?. envFile ?? '.env' ;
123
+ if (hasEnvFile || configsFromFile ?.envFile) {
124
+ GLOBAL . envFile = getArg ( 'envFile' ) ?? configsFromFile ?. envFile ?? '.env' ;
125
125
}
126
126
127
127
if (enforce) require('../services/enforce.js').enforce();
128
128
129
129
/* c8 ignore start */ // Process-based
130
- if (killPort || defaultConfigs ?.kill?.port) {
130
+ if (killPort || configsFromFile ?.kill?.port) {
131
131
const ports =
132
- killPort ?. split ( ',' ) . map ( Number ) || defaultConfigs ?. kill ?. port || [ ] ;
132
+ killPort ?. split ( ',' ) . map ( Number ) || configsFromFile ?. kill ?. port || [ ] ;
133
133
tasks . push ( kill . port ( ports ) ) ;
134
134
}
135
135
136
- if (killRange || defaultConfigs ?.kill?.range) {
136
+ if (killRange || configsFromFile ?.kill?.range) {
137
137
const ranges =
138
138
killRange ?. split ( ',' ) ||
139
- defaultConfigs ?. kill ?. range ?. map ( ( range ) => `${ range [ 0 ] } -${ range [ 1 ] } ` ) ||
139
+ configsFromFile ?. kill ?. range ?. map ( ( range ) => `${ range [ 0 ] } -${ range [ 1 ] } ` ) ||
140
140
[ ] ;
141
141
142
142
for ( const range of ranges ) {
@@ -147,28 +147,28 @@ import { GLOBAL, VERSION } from '../configs/poku.js';
147
147
}
148
148
}
149
149
150
- if (killPID || defaultConfigs ?.kill?.pid) {
150
+ if (killPID || configsFromFile ?.kill?.pid) {
151
151
const PIDs =
152
- killPID ?. split ( ',' ) . map ( Number ) || defaultConfigs ?. kill ?. pid || [ ] ;
152
+ killPID ?. split ( ',' ) . map ( Number ) || configsFromFile ?. kill ?. pid || [ ] ;
153
153
154
154
tasks . push ( kill . pid ( PIDs ) ) ;
155
155
}
156
156
/* c8 ignore stop */
157
157
158
158
GLOBAL.envFile && tasks . push ( envFile ( GLOBAL . envFile ) ) ;
159
159
160
- if ( debug || defaultConfigs ?. debug ) {
160
+ if ( debug || configsFromFile ?. debug ) {
161
161
hr ( ) ;
162
162
log ( `${ format ( ' Debug Enabled ' ) . bg ( 'brightBlue' ) } \n` ) ;
163
163
log ( `${ format ( '…' ) . info ( ) . italic ( ) } ${ format ( 'Paths' ) . bold ( ) } ` ) ;
164
164
console . table ( dirs ) ;
165
165
log ( '\n' ) ;
166
166
log ( `${ format ( '…' ) . info ( ) . italic ( ) } ${ format ( 'Options' ) . bold ( ) } ` ) ;
167
- console . dir ( GLOBAL . options , { depth : null , colors : true } ) ;
167
+ console . dir ( GLOBAL . configs , { depth : null , colors : true } ) ;
168
168
}
169
169
170
170
await Promise.all(tasks);
171
- await poku(dirs, GLOBAL.options );
171
+ await poku(dirs);
172
172
173
- if (watchMode) await require('./watch.js').startWatch(dirs, GLOBAL.options );
173
+ if (watchMode) await require('./watch.js').startWatch(dirs);
174
174
} ) ( ) ;
0 commit comments