0.1.3 • Published 2 years ago

vitest-codemod v0.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

vitest-codemod

This repository contains a collection of codemod scripts for use with JSCodeshift that help migrate to vitest.

The vitest-codemod CLI is a lightweight wrapper over jscodeshift. It processes --help, --version and --transform options before passing them downstream.

Prerequisites

To use vitest-codemod, please install Node.js.

Usage

  • Optionally execute dry-run for the transform, and print transformed files on stdout:
    npx vitest-codemod --dry --print -t jest PATH...
  • Run transform, and make changes to files:
    npx vitest-codemod -t jest PATH...
  • To use the latest version of vitest-codemod, clear your npx cache. You can either manually delete folder $(npm get cache)/_npx/*, or run clear-npx-cache.
    npx clear-npx-cache

Example

$ cat example.spec.js
describe("basic", () => {
  test("Math.sqrt()", () => {
    expect(Math.sqrt(4)).toBe(2);
  })
});

$ npx vitest-codemod -t jest example.spec.js

$ cat example.spec.js
import { describe, expect, test } from "vitest";
describe("basic", () => {
  test("Math.sqrt()", () => {
    expect(Math.sqrt(4)).toBe(2);
  })
});

License

This library is licensed under the MIT License. See the LICENSE file.

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago

0.0.0

2 years ago