npm

assert-to-expect
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

assert-to-expect

change from assert to jest's expect

Installation

npm install assert-to-expect

Usage

npx assert-to-expect [path] -m [matchRegex]

Example:

npx assert-to-expect ./src -m .*\\.tsx$

You can change the code using assert to use expect as bellow.

The code before change,

import assert from 'assert';

assert(wrapper.instance() instanceof Int);
assert.strictEqual(wrapper.find('Dropdown').length, 1);
assert.deepStrictEqual(wrapper.prop('texts'), ['react', 'vue']);

The code after change,

expect(wrapper.instance() instanceof Int).toBe(true);
expect(wrapper.find('Dropdown').length).toBe(1);
expect(wrapper.prop('texts')).toEqual(['react', 'vue']);

path

The value of path to change.

matchRegex

Regular expression for matching files.

Readme

Keywords

Package Sidebar

Install

npm i assert-to-expect

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

11.6 kB

Total Files

6

Last publish

Collaborators

  • kingller