Registry
Nnodejs avatar

nodejs/process-assert-to-node-assert

Handle DEP0100 via transforming `process.assert` to `node:assert`.

nodejs6,151 executions

  • transformation
  • migration
Connect a repo
npx codemod @nodejs/process-assert-to-node-assert

process.assert to node:assert DEP0100

This recipe transforms the usage of process.assert to use node:assert module.

See DEP0100.

Example

diff
+ import assert from "node:assert";
- process.assert(condition, "Assertion failed");
+ assert(condition, "Assertion failed");

Additional Notes

This codemod use fs capability to read the package.json file and determine if the project is using ES modules or CommonJS. Based on this information, it adds the appropriate import statement for the assert module.

Ready to evolve your codebase?

Build tailored, compiler-aware skills to assess, plan, and automate complex codebase changes.