@putout/plugin-tape 15.0.0 → 16.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 CHANGED
@@ -817,6 +817,10 @@ t.notCalled(fn);
817
817
  test.only('some test', (t) => {
818
818
  t.end();
819
819
  });
820
+
821
+ testDeclareBeforeReference.only('some test', (t) => {
822
+ t.end();
823
+ });
820
824
  ```
821
825
 
822
826
  ### ✅ Example of correct code
@@ -825,6 +829,10 @@ test.only('some test', (t) => {
825
829
  test('some test', (t) => {
826
830
  t.end();
827
831
  });
832
+
833
+ testDeclareBeforeReference('some test', (t) => {
834
+ t.end();
835
+ });
828
836
  ```
829
837
 
830
838
  ## remove-skip
@@ -16,21 +16,25 @@ module.exports.fix = ({__a}) => {
16
16
  };
17
17
 
18
18
  const MOCK_REQUIRE = 'mockRequire(__a, __b)';
19
+ const MOCK_IMPORT = 'mockImport(__a, __b)';
19
20
 
20
21
  module.exports.traverse = ({push}) => ({
21
- [MOCK_REQUIRE](path) {
22
- const {__a} = getTemplateValues(path, MOCK_REQUIRE);
23
-
24
- if (!isStringLiteral(__a))
25
- return;
26
-
27
- if (__a.value.startsWith('node:'))
28
- return;
29
-
30
- if (isBuiltin(__a.value))
31
- push({
32
- path,
33
- __a,
34
- });
35
- },
22
+ [MOCK_REQUIRE]: createTraverser(push, MOCK_REQUIRE),
23
+ [MOCK_IMPORT]: createTraverser(push, MOCK_IMPORT),
36
24
  });
25
+
26
+ const createTraverser = (push, template) => (path) => {
27
+ const {__a} = getTemplateValues(path, template);
28
+
29
+ if (!isStringLiteral(__a))
30
+ return;
31
+
32
+ if (__a.value.startsWith('node:'))
33
+ return;
34
+
35
+ if (isBuiltin(__a.value))
36
+ push({
37
+ path,
38
+ __a,
39
+ });
40
+ };
@@ -1,8 +1,5 @@
1
1
  'use strict';
2
2
 
3
- const {types} = require('putout');
4
- const {isIdentifier} = types;
5
-
6
3
  module.exports.report = () => `Remove 'test.only'`;
7
4
 
8
5
  module.exports.replace = () => ({
@@ -11,7 +8,6 @@ module.exports.replace = () => ({
11
8
  });
12
9
 
13
10
  module.exports.filter = (path) => {
14
- return isIdentifier(path.node.callee.object, {
15
- name: 'test',
16
- });
11
+ const {name} = path.node.callee.object;
12
+ return name.startsWith('test');
17
13
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-tape",
3
- "version": "15.0.0",
3
+ "version": "16.0.0",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout plugin helps with tests",
@@ -11,7 +11,7 @@
11
11
  "changelog": false,
12
12
  "repository": {
13
13
  "type": "git",
14
- "url": "git://github.com/coderaiser/putout.git"
14
+ "url": "git+https://github.com/coderaiser/putout.git"
15
15
  },
16
16
  "scripts": {
17
17
  "test": "madrun test",
@@ -36,14 +36,14 @@
36
36
  "c8": "^10.0.0",
37
37
  "eslint": "^9.0.0",
38
38
  "eslint-plugin-n": "^17.0.0",
39
- "eslint-plugin-putout": "^22.0.0",
39
+ "eslint-plugin-putout": "^23.0.0",
40
40
  "lerna": "^6.0.1",
41
41
  "madrun": "^10.0.0",
42
42
  "montag": "^1.2.1",
43
43
  "nodemon": "^3.0.1"
44
44
  },
45
45
  "peerDependencies": {
46
- "putout": ">=36"
46
+ "putout": ">=37"
47
47
  },
48
48
  "license": "MIT",
49
49
  "engines": {