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 +11 -0
- package/lib/is-only-tests.js +3 -0
- package/lib/run-tests.js +4 -1
- package/lib/supertape.d.ts +35 -39
- package/lib/supertape.js +2 -0
- package/package.json +1 -1
package/ChangeLog
CHANGED
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;
|
package/lib/supertape.d.ts
CHANGED
|
@@ -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
|
-
|
|
12
|
-
type
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
|
51
|
-
[index: string]: (operator: Operator) => (...args: any[]) => OperationResult;
|
|
52
|
-
};
|
|
50
|
+
export type OperatorFactory<T extends OperatorFn = OperatorFn> = (operator: Operator) => T;
|
|
53
51
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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.
|
|
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",
|