resolve-mocks

resolve-mocks

Methods

(static) resolveMocks(mocksDir, mockConfigFile, activateMocks) → {ResolvedMocks}

Source:
Returns an object containing arrays of paths to pass into the webpack `module.rules[jsLoader].include` and `entry` configuration fields. The returned arrays should be spread inside the arrays already present in those configuration fields. This will return empty arrays if `activateMocks` is false so that the user doesn't have to modify the respective webpack config fields when activating/deactivating mocks.
Parameters:
Name Type Description
mocksDir string Directory containing all mock-related code. Only needed if transpiling JS code containing mocks.
mockConfigFile string Entry JS file that configures all mocks.
activateMocks boolean If mocks should be activated/injected into build or not.
Returns:
- Object containing arrays of files to spread in `entry` and `include` webpack config fields
Type
ResolvedMocks

Type Definitions

ResolvedMocks

Source:
Properties:
Name Type Description
include Array.<string> Array containing mocks/ directory; spread it in `module.rules[jsLoader].include` webpack config field
entry Array.<string> Array containing mock entry file; spread it in `entry` webpack config field
Type:
  • Object