@putout/plugin-tape 6.7.0 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -2
- package/lib/declare/declarations.js +9 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -432,7 +432,38 @@ test('should call init before show', (t) => {
|
|
|
432
432
|
|
|
433
433
|
## declare
|
|
434
434
|
|
|
435
|
-
###
|
|
435
|
+
### `mockImport`
|
|
436
|
+
|
|
437
|
+
#### ❌ Incorrect code example
|
|
438
|
+
|
|
439
|
+
```js
|
|
440
|
+
import {stub} from 'supertape';
|
|
441
|
+
|
|
442
|
+
mockImport('fs/promises', {
|
|
443
|
+
readFile: stub().resolves(''),
|
|
444
|
+
});
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
##### ✅ Correct code Example
|
|
448
|
+
|
|
449
|
+
```js
|
|
450
|
+
import {stub} from 'supertape';
|
|
451
|
+
import {createMockImport} from 'mock-import';
|
|
452
|
+
|
|
453
|
+
const {
|
|
454
|
+
mockImport,
|
|
455
|
+
stopAll,
|
|
456
|
+
reImport,
|
|
457
|
+
} = createMockImport(import.meta.url);
|
|
458
|
+
|
|
459
|
+
mockImport('fs/promises', {
|
|
460
|
+
readFile: stub().resolves(''),
|
|
461
|
+
});
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
### `tape`
|
|
465
|
+
|
|
466
|
+
#### ❌ Incorrect code example
|
|
436
467
|
|
|
437
468
|
```js
|
|
438
469
|
test('xxx', (t) => {
|
|
@@ -441,7 +472,7 @@ test('xxx', (t) => {
|
|
|
441
472
|
});
|
|
442
473
|
```
|
|
443
474
|
|
|
444
|
-
|
|
475
|
+
#### ✅ Correct code example
|
|
445
476
|
|
|
446
477
|
```js
|
|
447
478
|
import {
|
|
@@ -5,4 +5,13 @@ module.exports = {
|
|
|
5
5
|
stub: 'import {stub} from "supertape"',
|
|
6
6
|
Test: 'import {Test} from "supertape"',
|
|
7
7
|
Stub: 'import {Stub} from "supertape"',
|
|
8
|
+
|
|
9
|
+
mockImport: `const {mockImport} = createMockImport(import.meta.url)`,
|
|
10
|
+
mockRequire: `const mockRequire = require('mock-require')`,
|
|
11
|
+
reImport: `const {reImport} = createMockImport(import.meta.url)`,
|
|
12
|
+
stopAll: {
|
|
13
|
+
esm: `const {stopAll} = createMockImport(import.meta.url)`,
|
|
14
|
+
commonjs: `const {stopAll} = mockRequire`,
|
|
15
|
+
},
|
|
16
|
+
createMockImport: `import {createMockImport} from 'mock-import'`,
|
|
8
17
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-tape",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
5
5
|
"description": "putout plugin helps with tests",
|
|
6
6
|
"homepage": "https://github.com/coderaiser/putout/tree/master/packages/plugin-tape",
|
|
@@ -33,18 +33,18 @@
|
|
|
33
33
|
"putout"
|
|
34
34
|
],
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@putout/test": "^
|
|
36
|
+
"@putout/test": "^4.0.0",
|
|
37
37
|
"c8": "^7.5.0",
|
|
38
38
|
"eslint": "^8.0.1",
|
|
39
39
|
"eslint-plugin-node": "^11.0.0",
|
|
40
|
-
"eslint-plugin-putout": "^
|
|
40
|
+
"eslint-plugin-putout": "^12.0.0",
|
|
41
41
|
"lerna": "^4.0.0",
|
|
42
42
|
"madrun": "^8.0.1",
|
|
43
43
|
"montag": "^1.2.1",
|
|
44
44
|
"nodemon": "^2.0.1"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"putout": ">=
|
|
47
|
+
"putout": ">=22.5"
|
|
48
48
|
},
|
|
49
49
|
"license": "MIT",
|
|
50
50
|
"engines": {
|