-
-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Copy link
Labels
Description
Description
This codemod should replace process.assert()
calls with the assert module. It's useful to migrate code that uses the deprecated internal assertion API which has been removed.
It should replace process.assert()
with require('node:assert')() for robust assertions. It should handle both CommonJS and ESM imports. It should preserve assertion logic and error handling.
Examples
Case 1
Before:
process.assert(condition, "Assertion failed");
After:
const assert = require("node:assert");
assert(condition, "Assertion failed");
Case 2
Before:
function validateInput(input) {
process.assert(typeof input === "string", "Input must be string");
return input.trim();
}
After:
const assert = require("node:assert");
function validateInput(input) {
assert(typeof input === "string", "Input must be string");
return input.trim();
}
Case 3
Before:
process.assert(config.port, "Port must be configured");
After:
import assert from "node:assert";
assert(config.port, "Port must be configured");
REFS
fabricionaweb
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
🔖 Todo