Skip to content

Commit 17af799

Browse files
Updated test CLIs to use ES6 syntax
1 parent ef2b009 commit 17af799

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

test/fixtures/bin/echo-args

+4-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
*/
88
"use strict";
99

10-
process.argv.slice(2).forEach((arg, index) => {
10+
let args = process.argv.slice(2);
11+
12+
for (let [index, arg] of args.entries()) {
1113
console.log(`Argument #${index + 1}: ${arg}`);
12-
});
14+
}

test/fixtures/bin/echo-env

+10-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
*/
88
"use strict";
99

10-
process.argv.slice(2).forEach((arg) => {
11-
console.log(`${arg}: ${process.env[arg]}`);
12-
});
10+
let variableNames = process.argv.slice(2);
11+
12+
if (variableNames.length === 0) {
13+
console.log("No environment variables were specified");
14+
}
15+
else {
16+
for (let name of variableNames) {
17+
console.log(`${name}: ${process.env[name]}`);
18+
}
19+
}

0 commit comments

Comments
 (0)