Skip to content
Draft
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
880 changes: 104 additions & 776 deletions package-lock.json

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions recipes/jest-to-node-test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Jest to Node Test

This package transforms Jest test files into `node:test` files.

This is a one-and-done process, and the updated source-code should be committed to your version control (eg git); thereafter, source-code import statements should be authored compliant with the ECMAScript (JavaScript) standard.

## TODO:

- Remove `jest`, `@types/jest`, `@jest/globals` and related modules from `package.json`
- Check/install `expect`
- Update `package.json` scripts that use `jest`
- remove `jest` config files
- remove `jest` config from `package.json` and `tsconfig.json`
- Migrate snapshots ✅
- Convert mocks ✅
- Convert setup/teardown files
- Migrate assertions
- Migrate test/it config (e.g. timeout)
- Migrate suite methods (e.g. `it.each`)
- Check non-TS CJS/ESM support
21 changes: 21 additions & 0 deletions recipes/jest-to-node-test/codemod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
schema_version: "1.0"
name: "@nodejs/jest-to-node-test-runner"
version: 1.0.0
description: Convert Jest tests to Node Test Runner tests
author: Carlos Espa
license: MIT
workflow: workflow.yaml
category: migration

targets:
languages:
- javascript
- typescript

keywords:
- transformation
- migration

registry:
access: public
visibility: public
31 changes: 31 additions & 0 deletions recipes/jest-to-node-test/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "@nodejs/jest-to-node-test",
"version": "1.0.0-rc.1",
"description": "Convert Jest tests to node:test tests",
"type": "module",
"main": "./src/workflow.ts",
"scripts": {
"test": "npx codemod@next jssg test -l typescript ./src/workflow.ts ./"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"test": "npx codemod@next jssg test -l typescript ./src/workflow.ts ./"
"test": "npx codemod jssg test -l typescript ./src/workflow.ts ./"

BTW no nedeed anymore

},
"repository": {
"type": "git",
"url": "git+https://github.com/nodejs/userland-migrations.git",
"directory": "recipes/jest-to-node-test-runner",
"bugs": "https://github.com/nodejs/userland-migrations/issues"
},
"author": "Carlos Espa",
"license": "MIT",
"bugs": {
"url": "https://github.com/nodejs/userland-migrations/issues"
},
"homepage": "https://github.com/nodejs/userland-migrations/tree/main/jest-to-node-test-runner#readme",
"devDependencies": {
"@codemod.com/jssg-types": "^1.0.3",
"@types/node": "^24.2.0"
},
"dependencies": {
"@jest/globals": "^30.2.0",
"@nodejs/codemod-utils": "*",
"expect": "^30.2.0"
}
}
Loading
Loading