supertape 12.6.4 → 12.8.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
+ 2026.03.09, v12.8.0
2
+
3
+ feature:
4
+ - 70e40c3 @supertape/operator-strip: add
5
+ - e658dfb supertape: improve types
6
+
7
+ 2026.03.05, v12.7.0
8
+
9
+ feature:
10
+ - 6e64b5a supertape: is-only-tests: add
11
+
1
12
  2026.03.05, v12.6.4
2
13
 
3
14
  fix:
@@ -0,0 +1,3 @@
1
+ import {fullstore} from 'fullstore';
2
+
3
+ export const isOnlyTests = fullstore();
package/lib/run-tests.js CHANGED
@@ -3,6 +3,7 @@ import wraptile from 'wraptile';
3
3
  import {tryToCatch} from 'try-to-catch';
4
4
  import _isDebug from './is-debug.js';
5
5
  import {createValidator} from './validator.js';
6
+ import {isOnlyTests} from './is-only-tests.js';
6
7
 
7
8
  const inc = wraptile((store) => store(store() + 1));
8
9
  const isOnly = ({only}) => only;
@@ -39,7 +40,8 @@ export default async (tests, overrides = {}) => {
39
40
 
40
41
  const onlyTests = tests.filter(isOnly);
41
42
 
42
- if (onlyTests.length)
43
+ if (onlyTests.length) {
44
+ isOnlyTests(true);
43
45
  return await runTests(onlyTests, {
44
46
  formatter,
45
47
  operators,
@@ -47,6 +49,7 @@ export default async (tests, overrides = {}) => {
47
49
  isStop,
48
50
  isDebug,
49
51
  });
52
+ }
50
53
 
51
54
  const notSkippedTests = tests.filter(notSkip);
52
55
  const skipped = tests.filter(isSkip).length;
@@ -1,6 +1,7 @@
1
1
  import {OperatorStub} from '@supertape/operator-stub';
2
2
 
3
3
  export {Stub, stub} from '@cloudcmd/stub';
4
+
4
5
  type OperationBaseResult = {
5
6
  is: boolean;
6
7
  expected: unknown;
@@ -8,53 +9,48 @@ type OperationBaseResult = {
8
9
  message: string;
9
10
  output: string;
10
11
  };
11
- type OperationResult = OperationBaseResult | Promise<OperationBaseResult>;
12
- type OperatorFn = (...args: any[]) => OperationResult;
13
- type Operator = {
14
- [index: string]: OperatorFn;
15
- };
16
- type Test = Operator & OperatorStub & {
17
- equal: (result: unknown, expected: unknown, message?: string) => OperationResult;
18
- notEqual: (result: unknown, expected: unknown, message?: string) => OperationResult;
19
- deepEqual: (result: unknown, expected: unknown, message?: string) => OperationResult;
20
- notDeepEqual: (result: unknown, expected: unknown, message?: string) => OperationResult;
21
- fail: (message: string) => OperationResult;
22
- pass: (message: string) => OperationResult;
23
- ok: (result: boolean | unknown, message?: string) => OperationResult;
24
- comment: (message: string) => OperationResult;
25
- notOk: (result: boolean | unknown, message?: string) => OperationResult;
26
- match: (result: string, pattern: string | RegExp, message?: string) => OperationResult;
27
- notMatch: (result: string, pattern: string | RegExp, message?: string) => OperationResult;
28
- end: () => void;
29
- };
30
- type TestOptions = {
12
+
13
+ export type OperationResult = OperationBaseResult | Promise<OperationBaseResult>;
14
+
15
+ export type OperatorFn = (...args: unknown[]) => OperationResult;
16
+
17
+ export interface Operator {}
18
+
19
+ export interface Test extends Operator, OperatorStub {
20
+ equal(result: unknown, expected: unknown, message?: string): OperationResult;
21
+ notEqual(result: unknown, expected: unknown, message?: string): OperationResult;
22
+ deepEqual(result: unknown, expected: unknown, message?: string): OperationResult;
23
+ notDeepEqual(result: unknown, expected: unknown, message?: string): OperationResult;
24
+ fail(message: string): OperationResult;
25
+ pass(message: string): OperationResult;
26
+ ok(result: boolean | unknown, message?: string): OperationResult;
27
+ comment(message: string): OperationResult;
28
+ notOk(result: boolean | unknown, message?: string): OperationResult;
29
+ match(result: string, pattern: string | RegExp, message?: string): OperationResult;
30
+ notMatch(result: string, pattern: string | RegExp, message?: string): OperationResult;
31
+ end(): void;
32
+ }
33
+
34
+ export type TestOptions = {
31
35
  checkAssertionsCount?: boolean;
32
36
  checkScopes?: boolean;
33
37
  checkDuplicates?: boolean;
34
38
  timeout?: number;
35
39
  };
36
40
 
37
- declare function test(message: string, fn: (t: Test) => void, options?: TestOptions): void;
38
- declare const skip: typeof test;
39
- declare const only: typeof test;
40
-
41
- declare namespace test {
42
- export {
43
- only,
44
- skip,
45
- };
41
+ export interface TestFunction {
42
+ (message: string, fn: (t: Test) => void, options?: TestOptions): void;
43
+ skip: TestFunction;
44
+ only: TestFunction;
46
45
  }
46
+ export let test: TestFunction;
47
47
 
48
48
  export default test;
49
49
 
50
- type CustomOperator = {
51
- [index: string]: (operator: Operator) => (...args: any[]) => OperationResult;
52
- };
50
+ export type OperatorFactory<T extends OperatorFn = OperatorFn> = (operator: Operator) => T;
53
51
 
54
- declare function extend(customOperator: CustomOperator): typeof test;
55
- export {
56
- test,
57
- Test,
58
- extend,
59
- OperationResult,
60
- };
52
+ export type CustomOperator = Record<string, OperatorFactory>;
53
+
54
+ export declare function extend(operators: CustomOperator): TestFunction;
55
+
56
+ export let isOnlyTests: () => boolean;
package/lib/supertape.js CHANGED
@@ -11,6 +11,8 @@ import {getAt, setValidations} from './validator.js';
11
11
  import {createEmitter as _createEmitter} from './emitter.js';
12
12
  import {createFormatter as _createFormatter} from './formatter/index.js';
13
13
 
14
+ export {isOnlyTests} from './is-only-tests.js';
15
+
14
16
  const createOnly = (test) => (message, fn, options) => {
15
17
  return test(message, fn, {
16
18
  ...options,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "supertape",
3
- "version": "12.6.4",
3
+ "version": "12.8.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",