Skip to content

Function to set up boiler plate test file with imports auto-mocked

Notifications You must be signed in to change notification settings

Jamadan/test-my-ride

Repository files navigation

test-my-ride

Creates a test file next to the passed filename, mocks all imports and creates describe block per function with correct mocks inserted

Installation

npm install -g test-my-ride

Usage example

test-my-ride src/path/to/file.js --function functionName --config path/to/config/file.json

Run this from terminal. Will create a src/path/to/file.test-my-ride.js file.

Currently used for boiler plate test file generation.

Config structure:

{
  "prettier": {
    "semi": true,
    "singleQuote": true
  },
  "outputPostfix": ".test-jam"
}

The settings for prettier are overridable and docco is here

outputPostfix overrides the default .test-my-ride postfix to the test file.

The following values are not overridable:

  parser: 'babel',
  plugins: [prettierBabylon]

Stuff coming soon:

  • handle require/resquire.default/require.names/import * as
  • handle root config file for local installs
  • updated function wrapper list
  • ignore enums, types or interfaces when calling setMockValue in createIt

About

Function to set up boiler plate test file with imports auto-mocked

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published