Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

patch removed util methods for vows #389

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"version": "genversion --es6 lib/version.ts && git add lib/version.ts",
"test": "npm run test:ts && npm run test:legacy",
"test:ts": "jest",
"test:legacy": "npm run build -- --declaration false && vows test/*_test.js",
"test:legacy": "npm run build -- --declaration false && ./test/scripts/vows.js test/*_test.js",
"typecheck": "tsc --noEmit",
"cover": "jest --coverage",
"eslint": "eslint --env node --ext .ts .",
Expand Down
15 changes: 15 additions & 0 deletions test/scripts/vows.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env node
/**
* @fileoverview Vows logs using methods from `util` that were removed in node v12. To avoid cryptic
* error messages when tests fail, we patch those methods using `console.log`.
* @see {@link https://nodejs.org/api/deprecations.html#DEP0026|`util.print` deprecation}
* @see {@link https://nodejs.org/api/deprecations.html#DEP0027|`util.puts` deprecation}
* @see {@link https://nodejs.org/docs/latest-v0.10.x/api/util.html|Docs for deprecated `util` methods}
*/

// Patch deprecated util methods
const util = require("node:util");
util.print = (...args) => console.log(args.join(''));
util.puts = (...args) => console.log(args.join('\n'));
// Call vows executable
require("vows/bin/vows");
Loading