JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q51396F
  • License ISC

Module Substitutor for Testing

Package Exports

  • @xutl/test-modules

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@xutl/test-modules) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@xutl/modules

One eXtremely Useful Tool Library providing a simple preload module that allows replacing of depended modules with mock. Quite useful for testing.

Install

npm install --save-dev @xutl/modules

Usage

node -r @xutl/modules my-test.js

This will search along the path of the my-test.js file for a file called modules.json. This must contain a plain json mapping between strings. The key will be a regular expression such that:

actual = original.replace(new RegExp(<key>), <value>);

The path of the modules.json file is also added in the first order to the search-paths.