@putout/test 8.2.1 → 8.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.
Files changed (2) hide show
  1. package/lib/test.js +15 -0
  2. package/package.json +2 -1
package/lib/test.js CHANGED
@@ -11,6 +11,7 @@ const {
11
11
  unlinkSync,
12
12
  } = require('node:fs');
13
13
 
14
+ const montag = require('montag');
14
15
  const tryCatch = require('try-catch');
15
16
  const test = require('supertape');
16
17
  const putout = require('putout');
@@ -18,6 +19,7 @@ const currify = require('currify');
18
19
  const {createProgress} = require('@putout/engine-runner/progress');
19
20
 
20
21
  const {preTest} = require('./pre-test');
22
+ const {stringify} = JSON;
21
23
  const {isArray} = Array;
22
24
  const isString = (a) => typeof a === 'string';
23
25
  const isObject = (a) => typeof a === 'object';
@@ -276,6 +278,19 @@ const toObject = (array) => {
276
278
  };
277
279
 
278
280
  const progress = (dir, options) => (t) => async (name, expected) => {
281
+ if (!isString(name))
282
+ throw Error(montag`
283
+ ☝️ Looks like you forget to pass the 'name' of a fixture for 'progress()' operator.
284
+
285
+ Here is signature:
286
+ await progress(name: string, expected: ExpectedProgress): Operator
287
+
288
+ You passed:
289
+ name: ${typeof name} = ${stringify(name)}
290
+ expected: ${typeof expected} = ${stringify(expected) || typeof expected}
291
+
292
+ `);
293
+
279
294
  const full = join(dir, name);
280
295
  const [input, isTS] = readFixture(full);
281
296
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/test",
3
- "version": "8.2.1",
3
+ "version": "8.3.0",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Test runner for 🐊Putout plugins ",
@@ -44,6 +44,7 @@
44
44
  "@putout/eslint": "^3.0.0",
45
45
  "@putout/plugin-filesystem": "*",
46
46
  "currify": "^4.0.0",
47
+ "montag": "^1.2.1",
47
48
  "putout": "*",
48
49
  "supertape": "^9.0.0",
49
50
  "try-catch": "^3.0.0",