supertape 8.3.0 → 8.4.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/ChangeLog CHANGED
@@ -1,3 +1,14 @@
1
+ 2023.07.10, v8.4.0
2
+
3
+ feature:
4
+ - f3faec5 package: c8 v8.0.0
5
+ - 74f7265 package: eslint-plugin-n v16.0.1
6
+ - 098bc4a package: eslint-plugin-putout v18.0.0
7
+ - 1a73835 package: putout v30.2.3
8
+ - 4ca9bb2 package: typescript v5.1.6
9
+ - 4b4842e package: putout v29.0.4
10
+ - ebaca5b (package) check-dts v0.7.0
11
+
1
12
  2023.02.03, v8.3.0
2
13
 
3
14
  fix:
package/README.md CHANGED
@@ -234,6 +234,7 @@ const {extend} = require('supertape');
234
234
  const test = extend({
235
235
  transform: (operator) => (a, b, message = 'should transform') => {
236
236
  const {is, output} = operator.equal(a + 1, b - 1);
237
+
237
238
  return {
238
239
  is,
239
240
  output,
package/bin/supertape.mjs CHANGED
@@ -15,4 +15,3 @@ export default cli({
15
15
  cwd: process.cwd(),
16
16
  argv: process.argv.slice(2),
17
17
  });
18
-
package/lib/cli.js CHANGED
@@ -148,7 +148,10 @@ async function cli({argv, cwd, stdout, isStop}) {
148
148
  const allFiles = [];
149
149
 
150
150
  for (const arg of args._) {
151
- const files = glob.sync(arg).filter(isExclude);
151
+ const files = glob
152
+ .sync(arg)
153
+ .filter(isExclude);
154
+
152
155
  allFiles.push(...files);
153
156
  }
154
157
 
@@ -194,4 +197,3 @@ async function cli({argv, cwd, stdout, isStop}) {
194
197
  }
195
198
 
196
199
  module.exports._filesCount = filesCount;
197
-
package/lib/diff.mjs CHANGED
@@ -1,6 +1,5 @@
1
1
  import {diff} from 'jest-diff';
2
2
  import strip from 'strip-ansi';
3
-
4
3
  import {
5
4
  formatOutput,
6
5
  addSpaces,
@@ -27,4 +26,3 @@ export default (a, b) => {
27
26
 
28
27
  return output.join('\n');
29
28
  };
30
-
package/lib/exit-codes.js CHANGED
@@ -15,4 +15,3 @@ module.exports = {
15
15
  INVALID_OPTION,
16
16
  SKIPED,
17
17
  };
18
-
package/lib/format.js CHANGED
@@ -27,4 +27,3 @@ module.exports.formatOutput = (str) => {
27
27
  function cutMockImport(str) {
28
28
  return str.replace(/\?mock-import-count=\d+/g, '');
29
29
  }
30
-
@@ -67,4 +67,3 @@ function run(reporter, type, data) {
67
67
 
68
68
  return reporter.end(data);
69
69
  }
70
-
@@ -78,4 +78,3 @@ module.exports.createFormatter = async (name) => {
78
78
  harness,
79
79
  };
80
80
  };
81
-
package/lib/help.js CHANGED
@@ -3,10 +3,7 @@
3
3
  module.exports.help = () => {
4
4
  const bin = require('../help.json');
5
5
  const usage = 'Usage: supertape [options] [path]';
6
- const result = [
7
- usage,
8
- 'Options',
9
- ];
6
+ const result = [usage, 'Options'];
10
7
 
11
8
  for (const name of Object.keys(bin)) {
12
9
  result.push(` ${name} ${bin[name]}`);
@@ -14,4 +11,3 @@ module.exports.help = () => {
14
11
 
15
12
  return result.join('\n') + '\n';
16
13
  };
17
-
package/lib/is-debug.js CHANGED
@@ -3,4 +3,3 @@
3
3
  const argv = process.execArgv.join();
4
4
 
5
5
  module.exports = argv.includes('inspect') || argv.includes('debug');
6
-
package/lib/operators.mjs CHANGED
@@ -1,5 +1,4 @@
1
1
  import deepEqualCheck from 'deep-equal';
2
-
3
2
  import diff from './diff.mjs';
4
3
  import {
5
4
  formatOutput,
@@ -139,7 +138,9 @@ const notDeepEqual = (result, expected, message = 'should not deep equal') => {
139
138
  };
140
139
 
141
140
  const comment = ({formatter}) => (message) => {
142
- const messages = message.trim().split('\n');
141
+ const messages = message
142
+ .trim()
143
+ .split('\n');
143
144
 
144
145
  for (const current of messages) {
145
146
  const line = current
@@ -211,11 +212,7 @@ function validateEnd({name, operators, runnerState}) {
211
212
  } = runnerState;
212
213
 
213
214
  if (name === 'end' && isEnded())
214
- return [INVALID, run(
215
- 'fail',
216
- runnerState,
217
- operators.fail(`Cannot use a couple 't.end()' operators in one test`),
218
- )];
215
+ return [INVALID, run('fail', runnerState, operators.fail(`Cannot use a couple 't.end()' operators in one test`))];
219
216
 
220
217
  if (name === 'end') {
221
218
  isEnded(true);
@@ -225,11 +222,7 @@ function validateEnd({name, operators, runnerState}) {
225
222
  incAssertionsCount();
226
223
 
227
224
  if (isEnded()) {
228
- return [INVALID, run(
229
- 'fail',
230
- runnerState,
231
- operators.fail(`Cannot run assertions after 't.end()' called`),
232
- )];
225
+ return [INVALID, run('fail', runnerState, operators.fail(`Cannot run assertions after 't.end()' called`))];
233
226
  }
234
227
 
235
228
  return [VALID];
@@ -280,7 +273,9 @@ function run(name, {formatter, count, incCount, incPassed, incFailed}, testState
280
273
  expected,
281
274
  output,
282
275
  errorStack: formatOutput(errorStack),
283
- at: at || parseAt(errorStack, {reason}),
276
+ at: at || parseAt(errorStack, {
277
+ reason,
278
+ }),
284
279
  });
285
280
  }
286
281
 
@@ -311,7 +306,9 @@ export const initOperators = ({formatter, count, incCount, incPassed, incFailed,
311
306
  notOk: operator('notOk'),
312
307
  pass: operator('pass'),
313
308
  fail: operator('fail'),
314
- comment: comment({formatter}),
309
+ comment: comment({
310
+ formatter,
311
+ }),
315
312
  match: operator('match'),
316
313
  notMatch: operator('notMatch'),
317
314
  end: operator('end'),
@@ -319,4 +316,3 @@ export const initOperators = ({formatter, count, incCount, incPassed, incFailed,
319
316
  ...extendedOperators,
320
317
  };
321
318
  };
322
-
package/lib/run-tests.js CHANGED
@@ -14,9 +14,7 @@ const notSkip = ({skip}) => !skip;
14
14
 
15
15
  const getInitOperators = async () => await import('./operators.mjs');
16
16
 
17
- const {
18
- SUPERTAPE_TIMEOUT = 3000,
19
- } = process.env;
17
+ const {SUPERTAPE_TIMEOUT = 3000} = process.env;
20
18
 
21
19
  const DEBUG_TIME = 3000 * 1000;
22
20
 
@@ -1,22 +1,19 @@
1
1
  import {OperatorStub} from '@supertape/operator-stub';
2
-
3
2
  import {
4
3
  stub,
5
4
  Stub,
6
5
  } from '@cloudcmd/stub';
7
6
 
8
7
  type OperationResult = {
9
- is: boolean,
10
- expected: unknown,
11
- result: unknown,
12
- message: string,
13
- output: string,
8
+ is: boolean;
9
+ expected: unknown;
10
+ result: unknown;
11
+ message: string;
12
+ output: string;
14
13
  };
15
-
16
14
  type Operator = {
17
15
  [index: string]: (...args: any[]) => OperationResult;
18
16
  };
19
-
20
17
  type Test = Operator & OperatorStub & {
21
18
  equal: (result: unknown, expected: unknown, message?: string) => OperationResult;
22
19
  notEqual: (result: unknown, expected: unknown, message?: string) => OperationResult;
@@ -31,11 +28,10 @@ type Test = Operator & OperatorStub & {
31
28
  notMatch: (result: string, pattern: string | RegExp, message?: string) => OperationResult;
32
29
  end: () => void;
33
30
  };
34
-
35
31
  type TestOptions = {
36
- checkAssertionsCount?: boolean,
37
- checkScopes?: boolean,
38
- checkDuplicates?: boolean,
32
+ checkAssertionsCount?: boolean;
33
+ checkScopes?: boolean;
34
+ checkDuplicates?: boolean;
39
35
  };
40
36
 
41
37
  declare function test(message: string, fn: (t: Test) => void, options?: TestOptions): void;
@@ -52,11 +48,10 @@ declare namespace test {
52
48
  export default test;
53
49
 
54
50
  type CustomOperator = {
55
- [index: string]: (operator: Operator) => (...args: any[]) => OperationResult
51
+ [index: string]: (operator: Operator) => (...args: any[]) => OperationResult;
56
52
  };
57
53
 
58
54
  declare function extend(customOperator: CustomOperator): typeof test;
59
-
60
55
  export {
61
56
  test,
62
57
  Test,
@@ -64,4 +59,3 @@ export {
64
59
  Stub,
65
60
  extend,
66
61
  };
67
-
package/lib/supertape.js CHANGED
@@ -71,6 +71,7 @@ function _createEmitter({quiet, stream = stdout, format, getOperators, isStop, r
71
71
  harness.pipe(stream);
72
72
 
73
73
  const operators = await getOperators();
74
+
74
75
  const result = await runTests(tests, {
75
76
  formatter,
76
77
  operators,
@@ -237,7 +238,6 @@ const loop = once(({emitter, tests}) => {
237
238
  }
238
239
 
239
240
  previousCount = tests.length;
240
-
241
241
  // 5ms ought to be enough for anybody
242
242
  setTimeout(loop, 5);
243
243
  })();
@@ -264,4 +264,3 @@ function fakeEmitter() {
264
264
 
265
265
  return emitter;
266
266
  }
267
-
package/lib/validator.js CHANGED
@@ -4,7 +4,11 @@ const once = require('once');
4
4
  const StackTracey = require('stacktracey');
5
5
  const getDuplicatesMessage = ([, a]) => a;
6
6
 
7
- const getMessage = ({message, at, validations}) => [message, at, validations];
7
+ const getMessage = ({message, at, validations}) => [
8
+ message,
9
+ at,
10
+ validations,
11
+ ];
8
12
 
9
13
  const getMessagesList = (tests) => tests.map(getMessage);
10
14
  const compareMessage = (a) => ([b]) => a === b;
@@ -93,10 +97,16 @@ function checkAssertionsCount(msg, filtered, options) {
93
97
  return [];
94
98
 
95
99
  if (assertionsCount > 1)
96
- return [`Only one assertion per test allowed, looks like you have more`, at];
100
+ return [
101
+ `Only one assertion per test allowed, looks like you have more`,
102
+ at,
103
+ ];
97
104
 
98
105
  if (!assertionsCount)
99
- return [`Only one assertion per test allowed, looks like you have none`, at];
106
+ return [
107
+ `Only one assertion per test allowed, looks like you have none`,
108
+ at,
109
+ ];
100
110
 
101
111
  return [];
102
112
  }
@@ -105,13 +115,16 @@ function checkScopes(msg, filtered) {
105
115
  const [message, at] = filtered[0];
106
116
 
107
117
  if (!SCOPE_DEFINED.test(message))
108
- return [`Scope should be defined before first colon: 'scope: subject', received: '${message}'`, at];
118
+ return [
119
+ `Scope should be defined before first colon: 'scope: subject', received: '${message}'`,
120
+ at,
121
+ ];
109
122
 
110
123
  return [];
111
124
  }
112
125
 
113
126
  const isEnabled = (tests, name) => {
114
- for (const [,, validations] of tests) {
127
+ for (const [, , validations] of tests) {
115
128
  if (!validations[name]) {
116
129
  return false;
117
130
  }
@@ -133,6 +146,8 @@ function checkDuplicates(msg, filtered) {
133
146
  return [];
134
147
 
135
148
  processedList.add(first);
136
- return [`Duplicate ${first}`, second];
149
+ return [
150
+ `Duplicate ${first}`,
151
+ second,
152
+ ];
137
153
  }
138
-
package/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "name": "supertape",
3
- "version": "8.3.0",
3
+ "version": "8.4.0",
4
4
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
5
5
  "description": "📼 Supertape simplest high speed test runner with superpowers",
6
6
  "homepage": "http://github.com/coderaiser/supertape",
7
7
  "main": "./lib/supertape.js",
8
- "commitType": "colon",
9
8
  "exports": {
10
9
  ".": {
11
10
  "node": {
@@ -76,21 +75,21 @@
76
75
  "devDependencies": {
77
76
  "@babel/core": "^7.12.9",
78
77
  "@iocmd/wait": "^2.1.0",
79
- "c8": "^7.3.5",
80
- "check-dts": "^0.6.5",
78
+ "c8": "^8.0.0",
79
+ "check-dts": "^0.7.0",
81
80
  "eslint": "^8.0.0",
82
- "eslint-plugin-n": "^15.2.5",
83
- "eslint-plugin-putout": "^16.0.1",
81
+ "eslint-plugin-n": "^16.0.1",
82
+ "eslint-plugin-putout": "^18.0.0",
84
83
  "find-up": "^6.3.0",
85
84
  "madrun": "^9.0.0",
86
85
  "mock-require": "^3.0.2",
87
86
  "montag": "^1.0.0",
88
- "nodemon": "^2.0.2",
87
+ "nodemon": "^3.0.1",
89
88
  "pullout": "^4.0.0",
90
- "putout": "^28.0.0",
89
+ "putout": "^30.2.3",
91
90
  "runsome": "^1.0.0",
92
91
  "try-catch": "^3.0.0",
93
- "typescript": "^4.4.4"
92
+ "typescript": "^5.1.6"
94
93
  },
95
94
  "license": "MIT",
96
95
  "engines": {
package/supertape.json CHANGED
@@ -1,5 +1,3 @@
1
1
  {
2
- "operators": [
3
- "stub"
4
- ]
2
+ "operators": ["stub"]
5
3
  }