Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow call mm.restore on normal export #63

Merged
merged 1 commit into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ npm install mm --save-dev

```ts
import fs from 'node:fs';
import mm from 'mm';
import { mm } from 'mm';

mm(fs, 'readFileSync', function(filename) {
return filename + ' content';
Expand All @@ -44,7 +44,7 @@ console.log(fs.readFileSync('《九评 Java》'));
If mocked property is a function, it will be spied, every time it called, mm will modify `.called`, `.calledArguments` and `.lastCalledArguments`. For example:

```ts
import mm from 'mm';
import { mm } from 'mm';

const target = {
async add(a, b) {
Expand All @@ -68,7 +68,7 @@ assert.deepEqual(target.add.lastCalledArguments, [ 2, 2 ]);
If you only need spy and don't need mock, you can use `mm.spy` method directly:

```ts
import mm from 'mm';
import { mm } from 'mm';

const target = {
async add(a, b) {
Expand Down Expand Up @@ -96,7 +96,7 @@ assert.deepEqual(target.add.lastCalledArguments, [ 2, 2 ]);

```ts
import fs from 'node:fs';
import mm from 'mm';
import { mm } from 'mm';

mm.error(fs, 'readFile', 'mock fs.readFile return error');

Expand All @@ -120,7 +120,7 @@ Just like `mm.error()`, but only mock error once.

```ts
import fs from 'node:fs';
import mm from 'mm';
import { mm } from 'mm';

mm.errorOnce(fs, 'readFile', 'mock fs.readFile return error');

Expand Down Expand Up @@ -207,7 +207,7 @@ urllib.request = function (...args, callback) {
### .syncError(module, propertyName, errerMessage, errorProperties)

```js
var mm = require('mm');
var { mm } = require('mm');
var fs = require('fs');

mm.syncError(fs, 'readFileSync', 'mock fs.readFile return error', {code: 'ENOENT'});
Expand Down Expand Up @@ -256,7 +256,7 @@ mm.restore();
### .http.request(mockUrl, mockResData, mockResHeaders) and .https.request(mockUrl, mockResData, mockResHeaders)

```js
var mm = require('mm');
var { mm } = require('mm');
var http = require('http');

var mockURL = '/foo';
Expand Down Expand Up @@ -297,7 +297,7 @@ https.get({
### .http.requestError(mockUrl, reqError, resError) and .https.requestError(mockUrl, reqError, resError)

```js
var mm = require('mm');
var { mm } = require('mm');
var http = require('http');

var mockURL = '/foo';
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.17.1",
"@eggjs/bin": "7",
"@eggjs/tsconfig": "1",
"@types/mocha": "10",
"@types/node": "22",
"egg-bin": "6",
"eslint": "8",
"eslint-config-egg": "14",
"pedding": "^1.1.0",
"pedding": "^2.0.1",
"should": "^13.2.3",
"tshy": "3",
"tshy-after": "1",
Expand Down
53 changes: 34 additions & 19 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@

/**
* Mock async function error.
* @param {Object} mod, module object

Check warning on line 137 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 20)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 137 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 20)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 137 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18.19.0)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 137 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18.19.0)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 137 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 23)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 137 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 23)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 137 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 23)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 137 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 23)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 137 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18.19.0)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 137 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18.19.0)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 137 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 137 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 137 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 137 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 137 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 22)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 137 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 22)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 137 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 22)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 137 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 22)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 137 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 20)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 137 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 20)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 137 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18.19.0)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 137 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18.19.0)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 137 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 20)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 137 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 20)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 137 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 137 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 137 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 23)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 137 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 23)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 137 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 22)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 137 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 22)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"
* @param {String} method, mock module object method name.
* @param {String|Error} error, error string message or error instance.
* @param {Object} props, error properties
Expand All @@ -148,7 +148,7 @@

/**
* Mock async function error once.
* @param {Object} mod, module object

Check warning on line 151 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 20)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 151 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 20)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 151 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18.19.0)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 151 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18.19.0)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 151 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 23)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 151 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 23)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 151 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 23)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 151 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 23)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 151 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18.19.0)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 151 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18.19.0)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 151 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 151 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 151 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 151 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 151 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 22)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 151 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 22)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 151 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 22)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 151 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 22)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 151 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 20)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 151 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 20)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 151 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18.19.0)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 151 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18.19.0)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 151 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 20)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 151 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 20)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 151 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 151 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 151 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 23)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 151 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 23)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 151 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 22)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"

Check warning on line 151 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 22)

Expected @param names to be "mod, method, error, props, timeout". Got "mod,, method,, error,, props,, timeout,"
* @param {String} method, mock module object method name.
* @param {String|Error} error, error string message or error instance.
* @param {Object} props, error properties
Expand All @@ -163,7 +163,7 @@
/**
* mock return callback(null, data1, data2).
*
* @param {Object} mod, module object

Check warning on line 166 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 20)

Expected @param names to be "mod, method, datas, timeout". Got "mod,, method,, datas,, timeout,"

Check warning on line 166 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 20)

Expected @param names to be "mod, method, datas, timeout". Got "mod,, method,, datas,, timeout,"

Check warning on line 166 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18.19.0)

Expected @param names to be "mod, method, datas, timeout". Got "mod,, method,, datas,, timeout,"

Check warning on line 166 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18.19.0)

Expected @param names to be "mod, method, datas, timeout". Got "mod,, method,, datas,, timeout,"

Check warning on line 166 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 23)

Expected @param names to be "mod, method, datas, timeout". Got "mod,, method,, datas,, timeout,"

Check warning on line 166 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 23)

Expected @param names to be "mod, method, datas, timeout". Got "mod,, method,, datas,, timeout,"

Check warning on line 166 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 23)

Expected @param names to be "mod, method, datas, timeout". Got "mod,, method,, datas,, timeout,"

Check warning on line 166 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 23)

Expected @param names to be "mod, method, datas, timeout". Got "mod,, method,, datas,, timeout,"

Check warning on line 166 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18.19.0)

Expected @param names to be "mod, method, datas, timeout". Got "mod,, method,, datas,, timeout,"

Check warning on line 166 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18.19.0)

Expected @param names to be "mod, method, datas, timeout". Got "mod,, method,, datas,, timeout,"

Check warning on line 166 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18)

Expected @param names to be "mod, method, datas, timeout". Got "mod,, method,, datas,, timeout,"

Check warning on line 166 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18)

Expected @param names to be "mod, method, datas, timeout". Got "mod,, method,, datas,, timeout,"

Check warning on line 166 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18)

Expected @param names to be "mod, method, datas, timeout". Got "mod,, method,, datas,, timeout,"

Check warning on line 166 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18)

Expected @param names to be "mod, method, datas, timeout". Got "mod,, method,, datas,, timeout,"

Check warning on line 166 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 22)

Expected @param names to be "mod, method, datas, timeout". Got "mod,, method,, datas,, timeout,"

Check warning on line 166 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 22)

Expected @param names to be "mod, method, datas, timeout". Got "mod,, method,, datas,, timeout,"

Check warning on line 166 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 22)

Expected @param names to be "mod, method, datas, timeout". Got "mod,, method,, datas,, timeout,"

Check warning on line 166 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 22)

Expected @param names to be "mod, method, datas, timeout". Got "mod,, method,, datas,, timeout,"

Check warning on line 166 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 20)

Expected @param names to be "mod, method, datas, timeout". Got "mod,, method,, datas,, timeout,"

Check warning on line 166 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 20)

Expected @param names to be "mod, method, datas, timeout". Got "mod,, method,, datas,, timeout,"

Check warning on line 166 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18.19.0)

Expected @param names to be "mod, method, datas, timeout". Got "mod,, method,, datas,, timeout,"

Check warning on line 166 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18.19.0)

Expected @param names to be "mod, method, datas, timeout". Got "mod,, method,, datas,, timeout,"

Check warning on line 166 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 20)

Expected @param names to be "mod, method, datas, timeout". Got "mod,, method,, datas,, timeout,"

Check warning on line 166 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 20)

Expected @param names to be "mod, method, datas, timeout". Got "mod,, method,, datas,, timeout,"

Check warning on line 166 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18)

Expected @param names to be "mod, method, datas, timeout". Got "mod,, method,, datas,, timeout,"

Check warning on line 166 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18)

Expected @param names to be "mod, method, datas, timeout". Got "mod,, method,, datas,, timeout,"

Check warning on line 166 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 23)

Expected @param names to be "mod, method, datas, timeout". Got "mod,, method,, datas,, timeout,"

Check warning on line 166 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 23)

Expected @param names to be "mod, method, datas, timeout". Got "mod,, method,, datas,, timeout,"

Check warning on line 166 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 22)

Expected @param names to be "mod, method, datas, timeout". Got "mod,, method,, datas,, timeout,"

Check warning on line 166 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 22)

Expected @param names to be "mod, method, datas, timeout". Got "mod,, method,, datas,, timeout,"
* @param {String} method, mock module object method name.
* @param {Array} datas, return datas array.
* @param {Number} timeout, mock async callback timeout, default is 10.
Expand Down Expand Up @@ -203,7 +203,7 @@
/**
* mock return callback(null, data).
*
* @param {Object} mod, module object

Check warning on line 206 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 20)

Expected @param names to be "mod, method, data, timeout". Got "mod,, method,, data,, timeout,"

Check warning on line 206 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 20)

Expected @param names to be "mod, method, data, timeout". Got "mod,, method,, data,, timeout,"

Check warning on line 206 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18.19.0)

Expected @param names to be "mod, method, data, timeout". Got "mod,, method,, data,, timeout,"

Check warning on line 206 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18.19.0)

Expected @param names to be "mod, method, data, timeout". Got "mod,, method,, data,, timeout,"

Check warning on line 206 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 23)

Expected @param names to be "mod, method, data, timeout". Got "mod,, method,, data,, timeout,"

Check warning on line 206 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 23)

Expected @param names to be "mod, method, data, timeout". Got "mod,, method,, data,, timeout,"

Check warning on line 206 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 23)

Expected @param names to be "mod, method, data, timeout". Got "mod,, method,, data,, timeout,"

Check warning on line 206 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 23)

Expected @param names to be "mod, method, data, timeout". Got "mod,, method,, data,, timeout,"

Check warning on line 206 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18.19.0)

Expected @param names to be "mod, method, data, timeout". Got "mod,, method,, data,, timeout,"

Check warning on line 206 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18.19.0)

Expected @param names to be "mod, method, data, timeout". Got "mod,, method,, data,, timeout,"

Check warning on line 206 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18)

Expected @param names to be "mod, method, data, timeout". Got "mod,, method,, data,, timeout,"

Check warning on line 206 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18)

Expected @param names to be "mod, method, data, timeout". Got "mod,, method,, data,, timeout,"

Check warning on line 206 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18)

Expected @param names to be "mod, method, data, timeout". Got "mod,, method,, data,, timeout,"

Check warning on line 206 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18)

Expected @param names to be "mod, method, data, timeout". Got "mod,, method,, data,, timeout,"

Check warning on line 206 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 22)

Expected @param names to be "mod, method, data, timeout". Got "mod,, method,, data,, timeout,"

Check warning on line 206 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 22)

Expected @param names to be "mod, method, data, timeout". Got "mod,, method,, data,, timeout,"

Check warning on line 206 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 22)

Expected @param names to be "mod, method, data, timeout". Got "mod,, method,, data,, timeout,"

Check warning on line 206 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 22)

Expected @param names to be "mod, method, data, timeout". Got "mod,, method,, data,, timeout,"

Check warning on line 206 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 20)

Expected @param names to be "mod, method, data, timeout". Got "mod,, method,, data,, timeout,"

Check warning on line 206 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 20)

Expected @param names to be "mod, method, data, timeout". Got "mod,, method,, data,, timeout,"

Check warning on line 206 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18.19.0)

Expected @param names to be "mod, method, data, timeout". Got "mod,, method,, data,, timeout,"

Check warning on line 206 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18.19.0)

Expected @param names to be "mod, method, data, timeout". Got "mod,, method,, data,, timeout,"

Check warning on line 206 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 20)

Expected @param names to be "mod, method, data, timeout". Got "mod,, method,, data,, timeout,"

Check warning on line 206 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 20)

Expected @param names to be "mod, method, data, timeout". Got "mod,, method,, data,, timeout,"

Check warning on line 206 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18)

Expected @param names to be "mod, method, data, timeout". Got "mod,, method,, data,, timeout,"

Check warning on line 206 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18)

Expected @param names to be "mod, method, data, timeout". Got "mod,, method,, data,, timeout,"

Check warning on line 206 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 23)

Expected @param names to be "mod, method, data, timeout". Got "mod,, method,, data,, timeout,"

Check warning on line 206 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 23)

Expected @param names to be "mod, method, data, timeout". Got "mod,, method,, data,, timeout,"

Check warning on line 206 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 22)

Expected @param names to be "mod, method, data, timeout". Got "mod,, method,, data,, timeout,"

Check warning on line 206 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 22)

Expected @param names to be "mod, method, data, timeout". Got "mod,, method,, data,, timeout,"
* @param {String} method, mock module object method name.
* @param {Object} data, return data.
* @param {Number} timeout, mock async callback timeout, default is 0.
Expand All @@ -230,7 +230,7 @@
/**
* mock return callback(null, null).
*
* @param {Object} mod, module object

Check warning on line 233 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 20)

Expected @param names to be "mod, method, timeout". Got "mod,, method,, [timeout],"

Check warning on line 233 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 20)

Expected @param names to be "mod, method, timeout". Got "mod,, method,, [timeout],"

Check warning on line 233 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18.19.0)

Expected @param names to be "mod, method, timeout". Got "mod,, method,, [timeout],"

Check warning on line 233 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18.19.0)

Expected @param names to be "mod, method, timeout". Got "mod,, method,, [timeout],"

Check warning on line 233 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 23)

Expected @param names to be "mod, method, timeout". Got "mod,, method,, [timeout],"

Check warning on line 233 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 23)

Expected @param names to be "mod, method, timeout". Got "mod,, method,, [timeout],"

Check warning on line 233 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 23)

Expected @param names to be "mod, method, timeout". Got "mod,, method,, [timeout],"

Check warning on line 233 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 23)

Expected @param names to be "mod, method, timeout". Got "mod,, method,, [timeout],"

Check warning on line 233 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18.19.0)

Expected @param names to be "mod, method, timeout". Got "mod,, method,, [timeout],"

Check warning on line 233 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18.19.0)

Expected @param names to be "mod, method, timeout". Got "mod,, method,, [timeout],"

Check warning on line 233 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18)

Expected @param names to be "mod, method, timeout". Got "mod,, method,, [timeout],"

Check warning on line 233 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18)

Expected @param names to be "mod, method, timeout". Got "mod,, method,, [timeout],"

Check warning on line 233 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18)

Expected @param names to be "mod, method, timeout". Got "mod,, method,, [timeout],"

Check warning on line 233 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18)

Expected @param names to be "mod, method, timeout". Got "mod,, method,, [timeout],"

Check warning on line 233 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 22)

Expected @param names to be "mod, method, timeout". Got "mod,, method,, [timeout],"

Check warning on line 233 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 22)

Expected @param names to be "mod, method, timeout". Got "mod,, method,, [timeout],"

Check warning on line 233 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 22)

Expected @param names to be "mod, method, timeout". Got "mod,, method,, [timeout],"

Check warning on line 233 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 22)

Expected @param names to be "mod, method, timeout". Got "mod,, method,, [timeout],"

Check warning on line 233 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 20)

Expected @param names to be "mod, method, timeout". Got "mod,, method,, [timeout],"

Check warning on line 233 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 20)

Expected @param names to be "mod, method, timeout". Got "mod,, method,, [timeout],"

Check warning on line 233 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18.19.0)

Expected @param names to be "mod, method, timeout". Got "mod,, method,, [timeout],"

Check warning on line 233 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18.19.0)

Expected @param names to be "mod, method, timeout". Got "mod,, method,, [timeout],"

Check warning on line 233 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 20)

Expected @param names to be "mod, method, timeout". Got "mod,, method,, [timeout],"

Check warning on line 233 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 20)

Expected @param names to be "mod, method, timeout". Got "mod,, method,, [timeout],"

Check warning on line 233 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18)

Expected @param names to be "mod, method, timeout". Got "mod,, method,, [timeout],"

Check warning on line 233 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18)

Expected @param names to be "mod, method, timeout". Got "mod,, method,, [timeout],"

Check warning on line 233 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 23)

Expected @param names to be "mod, method, timeout". Got "mod,, method,, [timeout],"

Check warning on line 233 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 23)

Expected @param names to be "mod, method, timeout". Got "mod,, method,, [timeout],"

Check warning on line 233 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 22)

Expected @param names to be "mod, method, timeout". Got "mod,, method,, [timeout],"

Check warning on line 233 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 22)

Expected @param names to be "mod, method, timeout". Got "mod,, method,, [timeout],"
* @param {String} method, mock module object method name.
* @param {Number} [timeout], mock async callback timeout, default is 0.
*/
Expand All @@ -240,7 +240,7 @@

/**
* spy a function
* @param {Object} mod, module object

Check warning on line 243 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 20)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 243 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 20)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 243 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18.19.0)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 243 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18.19.0)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 243 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 23)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 243 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 23)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 243 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 23)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 243 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 23)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 243 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18.19.0)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 243 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18.19.0)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 243 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 243 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 243 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 243 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 243 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 22)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 243 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 22)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 243 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 22)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 243 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 22)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 243 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 20)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 243 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 20)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 243 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18.19.0)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 243 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18.19.0)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 243 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 20)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 243 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 20)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 243 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 243 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 243 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 23)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 243 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 23)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 243 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 22)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 243 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 22)

Expected @param names to be "mod, method". Got "mod,, method,"
* @param {String} method, mock module object method name.
*/
function spy(mod: any, method: string | symbol) {
Expand All @@ -257,7 +257,7 @@
/**
* mock function sync throw error
*
* @param {Object} mod, module object

Check warning on line 260 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 20)

Expected @param names to be "mod, method, error, props". Got "mod,, method,, error,, [props],"

Check warning on line 260 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 20)

Expected @param names to be "mod, method, error, props". Got "mod,, method,, error,, [props],"

Check warning on line 260 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18.19.0)

Expected @param names to be "mod, method, error, props". Got "mod,, method,, error,, [props],"

Check warning on line 260 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18.19.0)

Expected @param names to be "mod, method, error, props". Got "mod,, method,, error,, [props],"

Check warning on line 260 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 23)

Expected @param names to be "mod, method, error, props". Got "mod,, method,, error,, [props],"

Check warning on line 260 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 23)

Expected @param names to be "mod, method, error, props". Got "mod,, method,, error,, [props],"

Check warning on line 260 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 23)

Expected @param names to be "mod, method, error, props". Got "mod,, method,, error,, [props],"

Check warning on line 260 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 23)

Expected @param names to be "mod, method, error, props". Got "mod,, method,, error,, [props],"

Check warning on line 260 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18.19.0)

Expected @param names to be "mod, method, error, props". Got "mod,, method,, error,, [props],"

Check warning on line 260 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18.19.0)

Expected @param names to be "mod, method, error, props". Got "mod,, method,, error,, [props],"

Check warning on line 260 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18)

Expected @param names to be "mod, method, error, props". Got "mod,, method,, error,, [props],"

Check warning on line 260 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18)

Expected @param names to be "mod, method, error, props". Got "mod,, method,, error,, [props],"

Check warning on line 260 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18)

Expected @param names to be "mod, method, error, props". Got "mod,, method,, error,, [props],"

Check warning on line 260 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18)

Expected @param names to be "mod, method, error, props". Got "mod,, method,, error,, [props],"

Check warning on line 260 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 22)

Expected @param names to be "mod, method, error, props". Got "mod,, method,, error,, [props],"

Check warning on line 260 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 22)

Expected @param names to be "mod, method, error, props". Got "mod,, method,, error,, [props],"

Check warning on line 260 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 22)

Expected @param names to be "mod, method, error, props". Got "mod,, method,, error,, [props],"

Check warning on line 260 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 22)

Expected @param names to be "mod, method, error, props". Got "mod,, method,, error,, [props],"

Check warning on line 260 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 20)

Expected @param names to be "mod, method, error, props". Got "mod,, method,, error,, [props],"

Check warning on line 260 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 20)

Expected @param names to be "mod, method, error, props". Got "mod,, method,, error,, [props],"

Check warning on line 260 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18.19.0)

Expected @param names to be "mod, method, error, props". Got "mod,, method,, error,, [props],"

Check warning on line 260 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18.19.0)

Expected @param names to be "mod, method, error, props". Got "mod,, method,, error,, [props],"

Check warning on line 260 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 20)

Expected @param names to be "mod, method, error, props". Got "mod,, method,, error,, [props],"

Check warning on line 260 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 20)

Expected @param names to be "mod, method, error, props". Got "mod,, method,, error,, [props],"

Check warning on line 260 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18)

Expected @param names to be "mod, method, error, props". Got "mod,, method,, error,, [props],"

Check warning on line 260 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18)

Expected @param names to be "mod, method, error, props". Got "mod,, method,, error,, [props],"

Check warning on line 260 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 23)

Expected @param names to be "mod, method, error, props". Got "mod,, method,, error,, [props],"

Check warning on line 260 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 23)

Expected @param names to be "mod, method, error, props". Got "mod,, method,, error,, [props],"

Check warning on line 260 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 22)

Expected @param names to be "mod, method, error, props". Got "mod,, method,, error,, [props],"

Check warning on line 260 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 22)

Expected @param names to be "mod, method, error, props". Got "mod,, method,, error,, [props],"
* @param {String} method, mock module object method name.
* @param {String|Error} error, error string message or error instance.
* @param {Object} [props], error properties
Expand All @@ -272,7 +272,7 @@
/**
* mock function sync return data
*
* @param {Object} mod, module object

Check warning on line 275 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 20)

Expected @param names to be "mod, method, data". Got "mod,, method,, data,"

Check warning on line 275 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 20)

Expected @param names to be "mod, method, data". Got "mod,, method,, data,"

Check warning on line 275 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18.19.0)

Expected @param names to be "mod, method, data". Got "mod,, method,, data,"

Check warning on line 275 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18.19.0)

Expected @param names to be "mod, method, data". Got "mod,, method,, data,"

Check warning on line 275 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 23)

Expected @param names to be "mod, method, data". Got "mod,, method,, data,"

Check warning on line 275 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 23)

Expected @param names to be "mod, method, data". Got "mod,, method,, data,"

Check warning on line 275 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 23)

Expected @param names to be "mod, method, data". Got "mod,, method,, data,"

Check warning on line 275 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 23)

Expected @param names to be "mod, method, data". Got "mod,, method,, data,"

Check warning on line 275 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18.19.0)

Expected @param names to be "mod, method, data". Got "mod,, method,, data,"

Check warning on line 275 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18.19.0)

Expected @param names to be "mod, method, data". Got "mod,, method,, data,"

Check warning on line 275 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18)

Expected @param names to be "mod, method, data". Got "mod,, method,, data,"

Check warning on line 275 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18)

Expected @param names to be "mod, method, data". Got "mod,, method,, data,"

Check warning on line 275 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18)

Expected @param names to be "mod, method, data". Got "mod,, method,, data,"

Check warning on line 275 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18)

Expected @param names to be "mod, method, data". Got "mod,, method,, data,"

Check warning on line 275 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 22)

Expected @param names to be "mod, method, data". Got "mod,, method,, data,"

Check warning on line 275 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 22)

Expected @param names to be "mod, method, data". Got "mod,, method,, data,"

Check warning on line 275 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 22)

Expected @param names to be "mod, method, data". Got "mod,, method,, data,"

Check warning on line 275 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 22)

Expected @param names to be "mod, method, data". Got "mod,, method,, data,"

Check warning on line 275 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 20)

Expected @param names to be "mod, method, data". Got "mod,, method,, data,"

Check warning on line 275 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 20)

Expected @param names to be "mod, method, data". Got "mod,, method,, data,"

Check warning on line 275 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18.19.0)

Expected @param names to be "mod, method, data". Got "mod,, method,, data,"

Check warning on line 275 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18.19.0)

Expected @param names to be "mod, method, data". Got "mod,, method,, data,"

Check warning on line 275 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 20)

Expected @param names to be "mod, method, data". Got "mod,, method,, data,"

Check warning on line 275 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 20)

Expected @param names to be "mod, method, data". Got "mod,, method,, data,"

Check warning on line 275 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18)

Expected @param names to be "mod, method, data". Got "mod,, method,, data,"

Check warning on line 275 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18)

Expected @param names to be "mod, method, data". Got "mod,, method,, data,"

Check warning on line 275 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 23)

Expected @param names to be "mod, method, data". Got "mod,, method,, data,"

Check warning on line 275 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 23)

Expected @param names to be "mod, method, data". Got "mod,, method,, data,"

Check warning on line 275 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 22)

Expected @param names to be "mod, method, data". Got "mod,, method,, data,"

Check warning on line 275 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 22)

Expected @param names to be "mod, method, data". Got "mod,, method,, data,"
* @param {String} method, mock module object method name.
* @param {Object} data, return data.
*/
Expand All @@ -285,7 +285,7 @@
/**
* mock function sync return nothing
*
* @param {Object} mod, module object

Check warning on line 288 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 20)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 288 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 20)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 288 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18.19.0)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 288 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18.19.0)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 288 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 23)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 288 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 23)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 288 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 23)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 288 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 23)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 288 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18.19.0)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 288 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18.19.0)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 288 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 288 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 288 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 288 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 288 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 22)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 288 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 22)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 288 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 22)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 288 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 22)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 288 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 20)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 288 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 20)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 288 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18.19.0)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 288 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18.19.0)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 288 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 20)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 288 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 20)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 288 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 288 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 288 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 23)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 288 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 23)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 288 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 22)

Expected @param names to be "mod, method". Got "mod,, method,"

Check warning on line 288 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 22)

Expected @param names to be "mod, method". Got "mod,, method,"
* @param {String} method, mock module object method name.
*/
function syncEmpty(mod: any, method: string | symbol) {
Expand Down Expand Up @@ -337,7 +337,7 @@

/**
* Mock http.request().
* @param {String|RegExp|Object} url, request url path.

Check warning on line 340 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 20)

Expected @param names to be "url, data, headers, delay". Got "url,, data,, headers,, [delay],"

Check warning on line 340 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 20)

Expected @param names to be "url, data, headers, delay". Got "url,, data,, headers,, [delay],"

Check warning on line 340 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18.19.0)

Expected @param names to be "url, data, headers, delay". Got "url,, data,, headers,, [delay],"

Check warning on line 340 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18.19.0)

Expected @param names to be "url, data, headers, delay". Got "url,, data,, headers,, [delay],"

Check warning on line 340 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 23)

Expected @param names to be "url, data, headers, delay". Got "url,, data,, headers,, [delay],"

Check warning on line 340 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 23)

Expected @param names to be "url, data, headers, delay". Got "url,, data,, headers,, [delay],"

Check warning on line 340 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 23)

Expected @param names to be "url, data, headers, delay". Got "url,, data,, headers,, [delay],"

Check warning on line 340 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 23)

Expected @param names to be "url, data, headers, delay". Got "url,, data,, headers,, [delay],"

Check warning on line 340 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18.19.0)

Expected @param names to be "url, data, headers, delay". Got "url,, data,, headers,, [delay],"

Check warning on line 340 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18.19.0)

Expected @param names to be "url, data, headers, delay". Got "url,, data,, headers,, [delay],"

Check warning on line 340 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18)

Expected @param names to be "url, data, headers, delay". Got "url,, data,, headers,, [delay],"

Check warning on line 340 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18)

Expected @param names to be "url, data, headers, delay". Got "url,, data,, headers,, [delay],"

Check warning on line 340 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18)

Expected @param names to be "url, data, headers, delay". Got "url,, data,, headers,, [delay],"

Check warning on line 340 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18)

Expected @param names to be "url, data, headers, delay". Got "url,, data,, headers,, [delay],"

Check warning on line 340 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 22)

Expected @param names to be "url, data, headers, delay". Got "url,, data,, headers,, [delay],"

Check warning on line 340 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 22)

Expected @param names to be "url, data, headers, delay". Got "url,, data,, headers,, [delay],"

Check warning on line 340 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 22)

Expected @param names to be "url, data, headers, delay". Got "url,, data,, headers,, [delay],"

Check warning on line 340 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 22)

Expected @param names to be "url, data, headers, delay". Got "url,, data,, headers,, [delay],"

Check warning on line 340 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 20)

Expected @param names to be "url, data, headers, delay". Got "url,, data,, headers,, [delay],"

Check warning on line 340 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 20)

Expected @param names to be "url, data, headers, delay". Got "url,, data,, headers,, [delay],"

Check warning on line 340 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18.19.0)

Expected @param names to be "url, data, headers, delay". Got "url,, data,, headers,, [delay],"

Check warning on line 340 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18.19.0)

Expected @param names to be "url, data, headers, delay". Got "url,, data,, headers,, [delay],"

Check warning on line 340 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 20)

Expected @param names to be "url, data, headers, delay". Got "url,, data,, headers,, [delay],"

Check warning on line 340 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 20)

Expected @param names to be "url, data, headers, delay". Got "url,, data,, headers,, [delay],"

Check warning on line 340 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18)

Expected @param names to be "url, data, headers, delay". Got "url,, data,, headers,, [delay],"

Check warning on line 340 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18)

Expected @param names to be "url, data, headers, delay". Got "url,, data,, headers,, [delay],"

Check warning on line 340 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 23)

Expected @param names to be "url, data, headers, delay". Got "url,, data,, headers,, [delay],"

Check warning on line 340 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 23)

Expected @param names to be "url, data, headers, delay". Got "url,, data,, headers,, [delay],"

Check warning on line 340 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 22)

Expected @param names to be "url, data, headers, delay". Got "url,, data,, headers,, [delay],"

Check warning on line 340 in src/index.ts

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 22)

Expected @param names to be "url, data, headers, delay". Got "url,, data,, headers,, [delay],"
* If url is Object, should be {url: $url, host: $host}
* @param {String|Buffer|ReadStream} data, mock response data.
* If data is Array, then res will emit `data` event many times.
Expand Down Expand Up @@ -595,55 +595,70 @@
requestError: mockHttpsRequestError,
};

// import { mm, restore } from 'mm';
export {
const _mock = Object.assign(mock, {
isMocked,
mock,
mock as mm,
mockDatas as datas,
mm: mock,
datas: mockDatas,
mockDatas,
mockData as data,
data: mockData,
mockData,
dataWithAsyncDispose,
mockEmpty as empty,
empty: mockEmpty,
mockEmpty,
mockError as error,
error: mockError,
mockError,
spy,
errorOnce,
syncError,
syncEmpty,
syncData,
mockHttp as http,
mockHttps as https,
http: mockHttp,
https: mockHttps,
spawn,
restore,
classMethod,
};
});

// import mm from 'mm';
const proxyMock = new Proxy(_mock, {
apply(target, _, args) {
return target(args[0], args[1], args[2]);
},
get(_target, property, receiver) {
// import mm from 'mm';
// mm.isMocked(foo, 'bar')
return Reflect.get(_target, property, receiver);
},
}) as unknown as ((target: any, property: PropertyKey, value?: any) => void) & typeof _mock;

// import mm from 'mm';
export default Object.assign(mock, {
// mm.restore();
export default proxyMock;

// import { mm, restore } from 'mm';
export {
isMocked,
mock,
mm: mock,
datas: mockDatas,
_mock as mm,
mockDatas as datas,
mockDatas,
data: mockData,
mockData as data,
mockData,
dataWithAsyncDispose,
empty: mockEmpty,
mockEmpty as empty,
mockEmpty,
error: mockError,
mockError as error,
mockError,
spy,
errorOnce,
syncError,
syncEmpty,
syncData,
http: mockHttp,
https: mockHttps,
mockHttp as http,
mockHttps as https,
spawn,
restore,
classMethod,
});
};

10 changes: 5 additions & 5 deletions test/async-await.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { strict as assert } from 'node:assert';
import { mm, restore, mockDatas } from '../src/index.js';
import { mm } from '../src/index.js';

describe('test/async-await.test.ts', () => {
const foo = {
Expand All @@ -11,7 +11,7 @@ describe('test/async-await.test.ts', () => {
},
};

afterEach(restore);
afterEach(mm.restore);

describe('mm()', () => {
it('should mock async function', async () => {
Expand All @@ -22,7 +22,7 @@ describe('test/async-await.test.ts', () => {
datas = await foo.request();
assert.equal(datas, 'no');

restore();
mm.restore();
datas = await foo.request();
assert(datas, 'yes');
});
Expand Down Expand Up @@ -70,11 +70,11 @@ describe('test/async-await.test.ts', () => {
describe('datas(), data()', () => {
it('should mock async function', async () => {
let datas;
mockDatas(foo, 'request', 'no');
mm.mockDatas(foo, 'request', 'no');
datas = await foo.request();
assert.equal(datas, 'no');

restore();
mm.restore();
datas = await foo.request();
assert.equal(datas, 'yes');
});
Expand Down
2 changes: 1 addition & 1 deletion test/mm.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import child_process from 'node:child_process';
import { randomUUID } from 'node:crypto';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import pedding from 'pedding';
import { pedding } from 'pedding';
import mm from '../src/index.js';
import { foo } from './foo.js';

Expand Down
Loading