jest-knobs
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

jest-knobs

Usage

First, install jest-knobs with npm:

npm i -D jest-knobs

In order to install the mocks, import jest-knobs into your Jest setup file or include jest-knobs itself as a setup file in your setupFilesAfterEnv

module.exports = {
  setupFilesAfterEnv: ["jest-knobs"]
};

In your tests, you can import jest-knobs and call mockKnobValues to change the knob values for a single test.

import knobs from "jest-knobs";
 
knobs.mockKnobValues({
  "knob name": "value"
});
 
// render the story after mocking the knob values
render(someStoryWithKnobs())

Readme

Keywords

none

Package Sidebar

Install

npm i jest-knobs

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

46.4 kB

Total Files

13

Last publish

Collaborators

  • btk5h