@putout/plugin-tape 21.1.0 → 21.3.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.
@@ -5,6 +5,7 @@ import {
5
5
  } from 'putout';
6
6
 
7
7
  const {compare, compareAny} = operator;
8
+
8
9
  const {
9
10
  expressionStatement,
10
11
  isCallExpression,
@@ -6,7 +6,7 @@ const isBool = (a) => typeof a === 'boolean';
6
6
  const isNumber = (a) => typeof a === 'number';
7
7
  const isString = (a) => typeof a === 'string';
8
8
  const isPrimitive = (a) => isString(a) || isNumber(a) || isBool(a) || isNull(a) || isUndefined(a);
9
- const {compute} = operator;
9
+ const {compute, compare} = operator;
10
10
 
11
11
  const {
12
12
  isLiteral,
@@ -68,5 +68,8 @@ function checkExpected(path) {
68
68
 
69
69
  const initPath = binding.path.get('init');
70
70
 
71
- return initPath.isTaggedTemplateExpression();
71
+ if (initPath.isTaggedTemplateExpression())
72
+ return true;
73
+
74
+ return compare(initPath, '__array.join(__b)');
72
75
  }
@@ -64,6 +64,7 @@ function doReplace({__a}, path) {
64
64
  for (let i = 0; i < n; i++) {
65
65
  let nodes = [];
66
66
  const current = body[i];
67
+
67
68
  const {
68
69
  expression = current,
69
70
  } = current;
@@ -1,17 +1,21 @@
1
1
  import {template, operator} from 'putout';
2
2
 
3
- const {insertBefore} = operator;
3
+ const {
4
+ insertBefore,
5
+ getStringFromRegExp,
6
+ } = operator;
4
7
 
5
8
  export const report = () => 'try-catch should be used instead of t.throws';
6
9
 
7
10
  export const replace = () => ({
8
11
  't.throws(__a, __b)': ({__a}, path) => {
9
12
  putTryCatch(__a, path);
10
- return `t.ok(error, __b)`;
13
+ return '';
11
14
  },
12
15
  't.throws(__a, __b, __c)': ({__a, __b}, path) => {
13
16
  putTryCatch(__a, path);
14
- return `t.equal(error.message, '${__b.pattern}', __c)`;
17
+
18
+ return `t.equal(error.message, '${getStringFromRegExp(__b)}', __c)`;
15
19
  },
16
20
  });
17
21
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-tape",
3
- "version": "21.1.0",
3
+ "version": "21.3.0",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout plugin helps with tests",
@@ -36,7 +36,7 @@
36
36
  "eslint-plugin-n": "^17.0.0",
37
37
  "eslint-plugin-putout": "^31.0.0",
38
38
  "madrun": "^13.0.0",
39
- "montag": "^1.2.1",
39
+ "montag": "^2.0.0",
40
40
  "nodemon": "^3.0.1",
41
41
  "superc8": "^12.0.0"
42
42
  },