Skip to content

Commit 53288c9

Browse files
committed
cli: Fix undefined util.print() when using --version or passing no tests
When using `--version`, or when failing to pass any code or test arguments, we used util.print() which was removed in Node.js 12. https://nodejs.org/docs/latest/api/deprecations.html#dep0026-utilprint Fixes #147.
1 parent 257cafd commit 53288c9

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

.github/workflows/CI.yaml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,21 @@ jobs:
99
strategy:
1010
matrix:
1111
include:
12-
- node: 10.x
13-
- node: 12.x
14-
- node: 14.x
15-
- node: 16.x
16-
- node: 18.x
17-
- node: 20.x
12+
- node: 10
13+
- node: 12
14+
- node: 14
15+
- node: 16
16+
- node: 18
17+
- node: 20
18+
- node: 24
1819

1920
name: Node ${{ matrix.node }}
2021
runs-on: ubuntu-latest
2122
steps:
22-
- uses: actions/checkout@v4
23+
- uses: actions/checkout@v6
2324

2425
- name: Install Node.js
25-
uses: actions/setup-node@v4
26+
uses: actions/setup-node@v6
2627
with:
2728
node-version: ${{ matrix.node }}
2829

bin/cli.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env node
22

3-
var util = require('util'),
4-
argsparser = require('argsparser'),
3+
var argsparser = require('argsparser'),
54
fs = require('fs');
65

76
var root = __dirname + '/..',
@@ -90,7 +89,7 @@ for (var key in args) {
9089
break;
9190
case '-v':
9291
case '--version':
93-
util.print(
92+
console.log(
9493
JSON.parse(
9594
fs.readFileSync(__dirname + '/../package.json')
9695
).version + '\n'
@@ -99,13 +98,13 @@ for (var key in args) {
9998
case '-h':
10099
case '-?':
101100
case '--help':
102-
util.print(help);
101+
console.log(help);
103102
return;
104103
}
105104
}
106105
if(!code || !tests) {
107-
util.print(help);
108-
util.print('\nBoth --code and --tests arguments are required\n');
106+
console.log(help);
107+
console.log('\nBoth --code and --tests arguments are required\n');
109108
return;
110109
}
111110

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"license": "MIT",
2525
"keywords": [
2626
"TDD",
27-
"QUnit",
27+
"qunit",
2828
"unit",
2929
"testing",
3030
"tests",

0 commit comments

Comments
 (0)