Skip to content

Commit 4a9a19f

Browse files
committed
Refactor use of process
1 parent 5c085ae commit 4a9a19f

5 files changed

Lines changed: 70 additions & 19 deletions

File tree

lib/node_modules/@stdlib/bench/harness/README.md

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -325,10 +325,12 @@ Returns a results [stream][nodejs-stream].
325325
<!-- eslint-disable no-restricted-syntax -->
326326

327327
```javascript
328+
var stdout = require( '@stdlib/streams/node/stdout' );
329+
328330
var stream = bench.createStream();
329331

330332
// Direct all results to `stdout`:
331-
stream.pipe( process.stdout );
333+
stream.pipe( stdout );
332334

333335
var opts = {
334336
'iterations': 1,
@@ -487,12 +489,13 @@ Returns a results [stream][nodejs-stream].
487489
<!-- eslint-disable no-restricted-syntax -->
488490

489491
```javascript
490-
var harness = bench.createHarness();
492+
var stdout = require( '@stdlib/streams/node/stdout' );
491493

494+
var harness = bench.createHarness();
492495
var stream = harness.createStream();
493496

494497
// Direct all results to `stdout`:
495-
stream.pipe( process.stdout );
498+
stream.pipe( stdout );
496499

497500
var opts = {
498501
'iterations': 1,
@@ -540,10 +543,12 @@ Closes a benchmark harness. Any pending benchmarks are cleared from the harness
540543
<!-- eslint-disable no-restricted-syntax -->
541544

542545
```javascript
546+
var stdout = require( '@stdlib/streams/node/stdout' );
547+
543548
var harness = bench.createHarness();
544549

545550
var stream = harness.createStream();
546-
stream.pipe( process.stdout );
551+
stream.pipe( stdout );
547552

548553
var opts = {
549554
'iterations': 5,
@@ -600,10 +605,12 @@ Forcefully exits a benchmark harness. All pending benchmarks will generate **fai
600605
<!-- eslint-disable no-restricted-syntax -->
601606

602607
```javascript
608+
var stdout = require( '@stdlib/streams/node/stdout' );
609+
603610
var harness = bench.createHarness();
604611

605612
var stream = harness.createStream();
606-
stream.pipe( process.stdout );
613+
stream.pipe( stdout );
607614

608615
var opts = {
609616
'iterations': 5
@@ -708,6 +715,8 @@ A `Benchmark` instance has the following properties and methods...
708715

709716
<!-- run-disable -->
710717

718+
<!-- eslint-disable stdlib/doctest -->
719+
711720
```javascript
712721
var str = b.name;
713722
// returns <string>
@@ -721,6 +730,8 @@ var str = b.name;
721730

722731
<!-- run-disable -->
723732

733+
<!-- eslint-disable stdlib/doctest -->
734+
724735
```javascript
725736
var iter = b.iterations;
726737
// returns <number>
@@ -833,6 +844,8 @@ Writes a message without breaking [TAP][tap] output.
833844

834845
<!-- run-disable -->
835846

847+
<!-- eslint-disable stdlib/doctest -->
848+
836849
```javascript
837850
b.comment( 'This is a comment.' );
838851
```
@@ -851,6 +864,8 @@ Generates an assertion which will be skipped.
851864

852865
<!-- run-disable -->
853866

867+
<!-- eslint-disable stdlib/doctest -->
868+
854869
```javascript
855870
b.skip( false, 'This is skipped.' );
856871
b.skip( true, 'This is skipped.' );
@@ -869,6 +884,8 @@ Generates an assertion which should be implemented.
869884

870885
<!-- run-disable -->
871886

887+
<!-- eslint-disable stdlib/doctest -->
888+
872889
```javascript
873890
b.todo( false, 'This is a todo.' );
874891
b.todo( true, 'This is a todo.' );
@@ -893,6 +910,8 @@ Generates a failing assertion.
893910

894911
<!-- run-disable -->
895912

913+
<!-- eslint-disable stdlib/doctest -->
914+
896915
```javascript
897916
b.fail( 'This is a failing assertion.' );
898917
```
@@ -913,6 +932,8 @@ Generates a passing assertion.
913932

914933
<!-- run-disable -->
915934

935+
<!-- eslint-disable stdlib/doctest -->
936+
916937
```javascript
917938
b.pass( 'This is a passing assertion.' );
918939
```
@@ -929,6 +950,8 @@ Asserts that a `value` is truthy.
929950

930951
<!-- run-disable -->
931952

953+
<!-- eslint-disable stdlib/doctest -->
954+
932955
```javascript
933956
b.ok( [] );
934957
```
@@ -941,6 +964,8 @@ To override the default message, provide a `msg` argument.
941964

942965
<!-- run-disable -->
943966

967+
<!-- eslint-disable stdlib/doctest -->
968+
944969
```javascript
945970
b.ok( true, 'This asserts a value is truthy.' );
946971
b.ok( false, 'This asserts a value is truthy.' );
@@ -963,6 +988,8 @@ Asserts that a `value` is falsy.
963988

964989
<!-- run-disable -->
965990

991+
<!-- eslint-disable stdlib/doctest -->
992+
966993
```javascript
967994
b.notOk( null );
968995
```
@@ -975,6 +1002,8 @@ To override the default message, provide a `msg` argument.
9751002

9761003
<!-- run-disable -->
9771004

1005+
<!-- eslint-disable stdlib/doctest -->
1006+
9781007
```javascript
9791008
b.notOk( false, 'This asserts a value is falsy.' );
9801009
b.notOk( true, 'This asserts a value is falsy.' );
@@ -997,6 +1026,8 @@ Asserts that `actual` is **strictly** equal to `expected`.
9971026

9981027
<!-- run-disable -->
9991028

1029+
<!-- eslint-disable stdlib/doctest -->
1030+
10001031
```javascript
10011032
var expected = [];
10021033
var actual = expected;
@@ -1012,6 +1043,8 @@ To override the default message, provide a `msg` argument.
10121043

10131044
<!-- run-disable -->
10141045

1046+
<!-- eslint-disable stdlib/doctest -->
1047+
10151048
```javascript
10161049
var expected = [];
10171050
var actual = expected;
@@ -1037,6 +1070,8 @@ Asserts that `actual` is not **strictly** equal to `expected`.
10371070

10381071
<!-- run-disable -->
10391072

1073+
<!-- eslint-disable stdlib/doctest -->
1074+
10401075
```javascript
10411076
var expected = [];
10421077
var actual = [];
@@ -1052,6 +1087,8 @@ To override the default message, provide a `msg` argument.
10521087

10531088
<!-- run-disable -->
10541089

1090+
<!-- eslint-disable stdlib/doctest -->
1091+
10551092
```javascript
10561093
var expected = [];
10571094
var actual = [];
@@ -1077,6 +1114,8 @@ Asserts that `actual` is **deeply** equal to `expected`.
10771114

10781115
<!-- run-disable -->
10791116

1117+
<!-- eslint-disable stdlib/doctest -->
1118+
10801119
```javascript
10811120
var expected = {
10821121
'a': 'b'
@@ -1096,6 +1135,8 @@ To override the default message, provide a `msg` argument.
10961135

10971136
<!-- run-disable -->
10981137

1138+
<!-- eslint-disable stdlib/doctest -->
1139+
10991140
```javascript
11001141
var expected = {
11011142
'a': 'b'
@@ -1122,6 +1163,8 @@ Asserts that `actual` is not **deeply** equal to `expected`.
11221163

11231164
<!-- run-disable -->
11241165

1166+
<!-- eslint-disable stdlib/doctest -->
1167+
11251168
```javascript
11261169
var expected = {
11271170
'a': 'b'
@@ -1141,6 +1184,8 @@ To override the default message, provide a `msg` argument.
11411184

11421185
<!-- run-disable -->
11431186

1187+
<!-- eslint-disable stdlib/doctest -->
1188+
11441189
```javascript
11451190
var expected = {
11461191
'a': 'b'

lib/node_modules/@stdlib/bench/harness/lib/exit_harness.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,10 @@ var proc = require( './utils/process.js' );
7575
* });
7676
*
7777
* @example
78+
* var stdout = require( '@stdlib/streams/node/stdout' );
79+
*
7880
* var stream = createExitHarness().createStream();
79-
* stream.pipe( proc.stdout );
81+
* stream.pipe( stdout );
8082
*/
8183
function createExitHarness() {
8284
var exitCode;

lib/node_modules/@stdlib/bench/harness/lib/harness/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,10 @@ var init = require( './init.js' );
7575
* });
7676
*
7777
* @example
78+
* var stdout = require( '@stdlib/streams/node/stdout' );
79+
*
7880
* var stream = createHarness().createStream();
79-
* stream.pipe( process.stdout );
81+
* stream.pipe( stdout );
8082
*/
8183
function createHarness( options, clbk ) {
8284
var exitCode;

lib/node_modules/@stdlib/bench/harness/test/test.cli.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ var tape = require( 'tape' );
2727
var contains = require( '@stdlib/assert/contains' );
2828
var IS_BROWSER = require( '@stdlib/assert/is-browser' );
2929
var IS_WINDOWS = require( '@stdlib/assert/is-windows' );
30+
var EXEC_PATH = require( '@stdlib/process/exec-path' );
3031
var readFileSync = require( '@stdlib/fs/read-file' ).sync;
3132

3233

@@ -58,7 +59,7 @@ tape( 'when invoked with a `--help` flag, the command-line interface prints the
5859
'encoding': 'utf8'
5960
});
6061
cmd = [
61-
process.execPath,
62+
EXEC_PATH,
6263
fpath,
6364
'--help'
6465
];
@@ -84,7 +85,7 @@ tape( 'when invoked with a `-h` flag, the command-line interface prints the help
8485
'encoding': 'utf8'
8586
});
8687
cmd = [
87-
process.execPath,
88+
EXEC_PATH,
8889
fpath,
8990
'-h'
9091
];
@@ -104,7 +105,7 @@ tape( 'when invoked with a `-h` flag, the command-line interface prints the help
104105

105106
tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) {
106107
var cmd = [
107-
process.execPath,
108+
EXEC_PATH,
108109
fpath,
109110
'--version'
110111
];
@@ -124,7 +125,7 @@ tape( 'when invoked with a `--version` flag, the command-line interface prints t
124125

125126
tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) {
126127
var cmd = [
127-
process.execPath,
128+
EXEC_PATH,
128129
fpath,
129130
'-V'
130131
];
@@ -144,7 +145,7 @@ tape( 'when invoked with a `-V` flag, the command-line interface prints the vers
144145

145146
tape( 'the command-line interface runs a benchmark', opts, function test( t ) {
146147
var cmd = [
147-
process.execPath,
148+
EXEC_PATH,
148149
fpath,
149150
join( __dirname, 'fixtures', 'benchmark1.js' )
150151
];
@@ -166,7 +167,7 @@ tape( 'the command-line interface runs a benchmark', opts, function test( t ) {
166167

167168
tape( 'the command-line interface runs a benchmark (using require option)', opts, function test( t ) {
168169
var cmd = [
169-
process.execPath,
170+
EXEC_PATH,
170171
fpath,
171172
'-r',
172173
join( __dirname, 'fixtures', 'rsin.js' ),

lib/node_modules/@stdlib/bench/test/test.cli.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ var tape = require( 'tape' );
2727
var contains = require( '@stdlib/assert/contains' );
2828
var IS_BROWSER = require( '@stdlib/assert/is-browser' );
2929
var IS_WINDOWS = require( '@stdlib/assert/is-windows' );
30+
var EXEC_PATH = require( '@stdlib/process/exec-path' );
3031
var readFileSync = require( '@stdlib/fs/read-file' ).sync;
3132

3233

@@ -58,7 +59,7 @@ tape( 'when invoked with a `--help` flag, the command-line interface prints the
5859
'encoding': 'utf8'
5960
});
6061
cmd = [
61-
process.execPath,
62+
EXEC_PATH,
6263
fpath,
6364
'--help'
6465
];
@@ -84,7 +85,7 @@ tape( 'when invoked with a `-h` flag, the command-line interface prints the help
8485
'encoding': 'utf8'
8586
});
8687
cmd = [
87-
process.execPath,
88+
EXEC_PATH,
8889
fpath,
8990
'-h'
9091
];
@@ -104,7 +105,7 @@ tape( 'when invoked with a `-h` flag, the command-line interface prints the help
104105

105106
tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) {
106107
var cmd = [
107-
process.execPath,
108+
EXEC_PATH,
108109
fpath,
109110
'--version'
110111
];
@@ -124,7 +125,7 @@ tape( 'when invoked with a `--version` flag, the command-line interface prints t
124125

125126
tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) {
126127
var cmd = [
127-
process.execPath,
128+
EXEC_PATH,
128129
fpath,
129130
'-V'
130131
];
@@ -144,7 +145,7 @@ tape( 'when invoked with a `-V` flag, the command-line interface prints the vers
144145

145146
tape( 'the command-line interface runs a benchmark', opts, function test( t ) {
146147
var cmd = [
147-
process.execPath,
148+
EXEC_PATH,
148149
fpath,
149150
join( __dirname, 'fixtures', 'benchmark1.js' )
150151
];
@@ -166,7 +167,7 @@ tape( 'the command-line interface runs a benchmark', opts, function test( t ) {
166167

167168
tape( 'the command-line interface runs a benchmark (using require option)', opts, function test( t ) {
168169
var cmd = [
169-
process.execPath,
170+
EXEC_PATH,
170171
fpath,
171172
'-r',
172173
join( __dirname, 'fixtures', 'rsin.js' ),

0 commit comments

Comments
 (0)