testdouble
Advanced tools
Comparing version
@@ -12,2 +12,3 @@ "use strict"; | ||
const replace_1 = require("./replace"); | ||
const list_1 = require("./list"); | ||
const explain_1 = require("./explain"); | ||
@@ -31,2 +32,3 @@ const reset_1 = require("./reset"); | ||
replaceEsm: replace_1.replaceEsm, | ||
listReplacedModules: list_1.default, | ||
explain: explain_1.default, | ||
@@ -33,0 +35,0 @@ reset: reset_1.default, |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = '3.19.0'; | ||
exports.default = '3.20.0'; |
{ | ||
"name": "testdouble", | ||
"version": "3.19.0", | ||
"version": "3.20.0", | ||
"description": "A minimal test double library for TDD with JavaScript", | ||
@@ -47,3 +47,3 @@ "homepage": "https://github.com/testdouble/testdouble.js", | ||
"test:safe": "teenytest --helper test/helper.js \"test/safe/**/*.test.{js,ts}\"", | ||
"test:esm": "cross-env NODE_OPTIONS=\"--loader=quibble\" TS_NODE_IGNORE=\"node_modules,notypescript\" ./test/safe-esm/teenytest-proxy.js --helper test/helper.js test/safe-esm/replace.test.js", | ||
"test:esm": "cross-env NODE_OPTIONS=\"--loader=quibble\" TS_NODE_IGNORE=\"node_modules,notypescript\" ./test/safe-esm/teenytest-proxy.js --helper test/helper.js test/safe-esm/replace.test.js test/safe-esm/list.test.js", | ||
"test:esm-auto-loader": "node test/esm-lib/supports-auto-load.js not || TS_NODE_IGNORE=\"node_modules,notypescript\" ./test/safe-esm/teenytest-proxy.js --helper test/helper.js test/safe-esm/replace.test.js", | ||
@@ -102,3 +102,3 @@ "test:no-loader-esm": "node test/esm-lib/supports-auto-load.js || cross-env TS_NODE_IGNORE=\"node_modules,notypescript\" teenytest test/helper.js './test/safe-esm/*.no-loader-test.{mjs,js}'", | ||
"lodash": "^4.17.21", | ||
"quibble": "^0.8.0", | ||
"quibble": "^0.9.0", | ||
"stringify-object-es5": "^2.5.0", | ||
@@ -108,5 +108,5 @@ "theredoc": "^1.0.0" | ||
"devDependencies": { | ||
"@types/node": "^20.6.0", | ||
"@typescript-eslint/eslint-plugin": "^6.7.0", | ||
"@typescript-eslint/parser": "^6.7.0", | ||
"@types/node": "^20.8.7", | ||
"@typescript-eslint/eslint-plugin": "^6.8.0", | ||
"@typescript-eslint/parser": "^6.8.0", | ||
"browserify": "^17.0.0", | ||
@@ -123,7 +123,7 @@ "codeclimate-test-reporter": "^0.5.1", | ||
"nyc": "^15.1.0", | ||
"rimraf": "^5.0.1", | ||
"rimraf": "^5.0.5", | ||
"standard": "^17.1.0", | ||
"teenytest": "^6.0.5", | ||
"teenytest-promise": "^1.0.0", | ||
"testdouble": "^3.18.0", | ||
"testdouble": "^3.19.0", | ||
"ts-node": "^10.9.1", | ||
@@ -130,0 +130,0 @@ "tsify": "^5.0.4", |
@@ -100,3 +100,3 @@ # testdouble.js (AKA td.js) | ||
Additionally, if you're using Node 16 or newer, you can replace native ES modules with `td.replaceEsm()`. More details | ||
For ES modules, you should use `td.replaceEsm()`. More details | ||
[here](docs/7-replacing-dependencies.md#how-module-replacement-works-for-es-modules-using-import). | ||
@@ -572,2 +572,32 @@ | ||
### `td.listReplacedModules()` for listing the modules that were replaced | ||
**`td.listReplacedModules()`** | ||
Use `td.listReplacedModules()` to list the modules that are replaced. This function will return an array of the modules that are | ||
currently being replaced via `td.replace()` or `td.replaceEsm()`. | ||
The list is in no particular order, and returns the full path to the module that was replaced. | ||
The path is returned as a `file:` URL as is customary in ESM (this is true even if the | ||
replaced module was CJS). | ||
For example, if you do this: | ||
```js | ||
td.replace('../src/save') | ||
``` | ||
Then | ||
```js | ||
td.listReplacedModules() | ||
``` | ||
will return something like: | ||
```js | ||
['file:///users/example/code/foo/src/save.js'] | ||
``` | ||
### Other functions | ||
@@ -574,0 +604,0 @@ |
@@ -10,2 +10,3 @@ import tdFunction from './function' | ||
import replace, { replaceEsm } from './replace' | ||
import listReplacedModules from './list' | ||
import explain from './explain' | ||
@@ -30,2 +31,3 @@ import reset from './reset' | ||
replaceEsm, | ||
listReplacedModules, | ||
explain, | ||
@@ -32,0 +34,0 @@ reset, |
@@ -1,1 +0,1 @@ | ||
export default '3.19.0' | ||
export default '3.20.0' |
Sorry, the diff of this file is too big to display
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
470509
0.33%170
1.19%12512
0.2%615
5.13%3
-25%+ Added
- Removed
Updated