Skip to content

Commit db94041

Browse files
committed
v3.0
1 parent 9d8f3e1 commit db94041

3 files changed

Lines changed: 18 additions & 18 deletions

File tree

LICENSE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
MIT License
1+
MIT License
22

3-
Copyright (c) 2021 Manuel Lõhmus
3+
Copyright (c) Manuel Lõhmus
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** Copyright (c) 2024, Manuel Lõhmus (MIT License). */
1+
/** Copyright (c) Manuel Lõhmus (MIT License). */
22

33
'use strict';
44

index.test.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** Copyright (c) 2024, Manuel Lõhmus (MIT). */
1+
/** Copyright (c) Manuel Lõhmus (MIT). */
22

33
'use strict';
44

@@ -55,7 +55,7 @@ testRunner('TESTS for config-sets', { skip: false }, (test) => {
5555

5656
/**
5757
* Test runner. Function to run unit tests in the console.
58-
* @author Manuel Lõhmus 2024 (MIT License)
58+
* @author Manuel Lõhmus (MIT License)
5959
* @version 1.1.5
6060
* [2024-12-29] adde d functionality to select tests by ID in the command line arguments (e.g. --testIDs=1 2 3)
6161
* @example `npm test '--'` or `node index.test.js`
@@ -98,9 +98,9 @@ testRunner('TESTS for config-sets', { skip: false }, (test) => {
9898
*/
9999
function testRunner(runnerName, options, cb) {
100100

101-
var globalScope = this || globalThis;
101+
var globalContext = this || globalThis;
102102

103-
globalScope?.process?.on('uncaughtException', function noop() { });
103+
globalContext?.process?.on('uncaughtException', function noop() { });
104104

105105
testRunner.testRunnerOK = true;
106106
clearTimeout(testRunner.exitTimeoutID);
@@ -128,8 +128,8 @@ The following options are supported:
128128
--testID Number of the test to run (e.g. node index.test.js --testID=1 --testID=2 --testID=3)
129129
`);
130130

131-
if (globalScope?.process?.argv[1].endsWith(".js")) { exitPressKey(); }
132-
else { globalScope?.process?.exit(0); }
131+
if (globalContext?.process?.argv[1].endsWith(".js")) { exitPressKey(); }
132+
else { globalContext?.process?.exit(0); }
133133

134134
return;
135135
}
@@ -284,42 +284,42 @@ The following options are supported:
284284
print_stdout();
285285
}
286286

287-
globalScope?.process?.removeAllListeners('uncaughtException');
287+
globalContext?.process?.removeAllListeners('uncaughtException');
288288

289-
if (globalScope?.process?.argv[1].endsWith(".js")) {
289+
if (globalContext?.process?.argv[1].endsWith(".js")) {
290290

291291
exitPressKey();
292292
}
293-
else if (globalScope?.process) {
293+
else if (globalContext?.process) {
294294

295295
if (!testRunnerOK) { testRunner.testRunnerOK = false; }
296296

297297
testRunner.exitTimeoutID = setTimeout(function (exit) {
298298

299299
exit(testRunner.testRunnerOK ? 0 : 1);
300300

301-
}, 100, globalScope?.process?.exit);
301+
}, 100, globalContext?.process?.exit);
302302
}
303303
}
304304
}
305305

306306
function exitPressKey() {
307307

308-
globalScope?.process?.stdin.setRawMode(true);
309-
globalScope?.process?.stdin.resume();
310-
globalScope?.process?.stdin.on('data', globalScope?.process?.exit.bind(globalScope?.process, testRunnerOK ? 0 : 1));
308+
globalContext?.process?.stdin.setRawMode(true);
309+
globalContext?.process?.stdin.resume();
310+
globalContext?.process?.stdin.on('data', globalContext?.process?.exit.bind(globalContext?.process, testRunnerOK ? 0 : 1));
311311

312312
console.log('Press any key to exit');
313313
}
314314

315315
function arg_options() {
316316

317-
if ("undefined" === typeof globalScope?.process) { return {}; }
317+
if ("undefined" === typeof globalContext?.process) { return {}; }
318318

319319
var isKey = false,
320320
key = '',
321321
values,
322-
args = globalScope?.process?.argv
322+
args = globalContext?.process?.argv
323323
.slice(2)
324324
.join('')
325325
.split('')

0 commit comments

Comments
 (0)