vest 5.0.0-dev-9c596e → 5.0.0-dev-ec989a
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/dist/cjs/classnames.development.js +1 -2
- package/dist/cjs/classnames.production.js +1 -1
- package/dist/cjs/enforce/compose.development.js +1 -5
- package/dist/cjs/enforce/compose.production.js +1 -1
- package/dist/cjs/enforce/compounds.development.js +3 -6
- package/dist/cjs/enforce/compounds.production.js +1 -1
- package/dist/cjs/enforce/schema.development.js +3 -6
- package/dist/cjs/enforce/schema.production.js +1 -1
- package/dist/cjs/parser.development.js +1 -4
- package/dist/cjs/parser.production.js +1 -1
- package/dist/cjs/promisify.development.js +1 -2
- package/dist/cjs/promisify.production.js +1 -1
- package/dist/cjs/vest.development.js +596 -764
- package/dist/cjs/vest.production.js +1 -1
- package/dist/es/classnames.development.js +1 -2
- package/dist/es/classnames.production.js +1 -1
- package/dist/es/parser.development.js +1 -2
- package/dist/es/parser.production.js +1 -1
- package/dist/es/promisify.development.js +1 -2
- package/dist/es/promisify.production.js +1 -1
- package/dist/es/vest.development.js +591 -757
- package/dist/es/vest.production.js +1 -1
- package/dist/umd/classnames.development.js +1 -2
- package/dist/umd/classnames.production.js +1 -1
- package/dist/umd/enforce/compose.development.js +1 -7
- package/dist/umd/enforce/compose.production.js +1 -1
- package/dist/umd/enforce/compounds.development.js +3 -6
- package/dist/umd/enforce/compounds.production.js +1 -1
- package/dist/umd/enforce/schema.development.js +3 -6
- package/dist/umd/enforce/schema.production.js +1 -1
- package/dist/umd/parser.development.js +1 -4
- package/dist/umd/parser.production.js +1 -1
- package/dist/umd/promisify.development.js +1 -2
- package/dist/umd/promisify.production.js +1 -1
- package/dist/umd/vest.development.js +599 -768
- package/dist/umd/vest.production.js +1 -1
- package/package.json +137 -136
- package/testUtils/TVestMock.ts +1 -1
- package/testUtils/asVestTest.ts +9 -0
- package/types/classnames.d.ts +82 -4
- package/types/classnames.d.ts.map +1 -1
- package/types/parser.d.ts +82 -4
- package/types/parser.d.ts.map +1 -1
- package/types/promisify.d.ts +82 -4
- package/types/promisify.d.ts.map +1 -1
- package/types/vest.d.ts +150 -138
- package/types/vest.d.ts.map +1 -1
package/types/parser.d.ts
CHANGED
|
@@ -1,10 +1,92 @@
|
|
|
1
|
+
import { Isolate, IsolateKey } from "vest-runtime";
|
|
2
|
+
import { CB } from "vest-utils";
|
|
1
3
|
declare enum Severity {
|
|
2
4
|
WARNINGS = "warnings",
|
|
3
5
|
ERRORS = "errors"
|
|
4
6
|
}
|
|
7
|
+
declare enum TestSeverity {
|
|
8
|
+
Error = "error",
|
|
9
|
+
Warning = "warning"
|
|
10
|
+
}
|
|
11
|
+
// @vx-allow use-use
|
|
12
|
+
declare function IsolateTestReconciler(currentNode: Isolate, historyNode: Isolate | null): Isolate;
|
|
13
|
+
declare enum TestStatus {
|
|
14
|
+
UNTESTED = "UNTESTED",
|
|
15
|
+
SKIPPED = "SKIPPED",
|
|
16
|
+
FAILED = "FAILED",
|
|
17
|
+
WARNING = "WARNING",
|
|
18
|
+
PASSING = "PASSING",
|
|
19
|
+
PENDING = "PENDING",
|
|
20
|
+
CANCELED = "CANCELED",
|
|
21
|
+
OMITTED = "OMITTED"
|
|
22
|
+
}
|
|
23
|
+
type TestFn = () => TestResult;
|
|
24
|
+
type AsyncTest = Promise<string | void | false>;
|
|
25
|
+
type TestResult = AsyncTest | boolean | void;
|
|
5
26
|
type WithFieldName<F extends TFieldName = TFieldName> = {
|
|
6
27
|
fieldName: F;
|
|
7
28
|
};
|
|
29
|
+
type IsolateTestInput = {
|
|
30
|
+
message?: string;
|
|
31
|
+
groupName?: string;
|
|
32
|
+
fieldName: TFieldName;
|
|
33
|
+
testFn: TestFn;
|
|
34
|
+
key?: IsolateKey;
|
|
35
|
+
};
|
|
36
|
+
declare class IsolateTest<F extends TFieldName = TFieldName, G extends TGroupName = TGroupName> extends Isolate {
|
|
37
|
+
children: null;
|
|
38
|
+
fieldName: F;
|
|
39
|
+
testFn: TestFn;
|
|
40
|
+
groupName?: G;
|
|
41
|
+
message?: string;
|
|
42
|
+
asyncTest?: AsyncTest;
|
|
43
|
+
id: string;
|
|
44
|
+
severity: TestSeverity;
|
|
45
|
+
private stateMachine;
|
|
46
|
+
static reconciler: typeof IsolateTestReconciler;
|
|
47
|
+
constructor({ fieldName, testFn, message, groupName, key }: IsolateTestInput);
|
|
48
|
+
static create<Callback extends CB = CB>(callback: Callback, data: IsolateTestInput): IsolateTest;
|
|
49
|
+
static cast<F extends TFieldName = TFieldName, G extends TGroupName = TGroupName>(isolate: Isolate): IsolateTest<F, G>;
|
|
50
|
+
get status(): TestStatus;
|
|
51
|
+
setStatus(status: TestStatus, payload?: any): void;
|
|
52
|
+
run(): TestResult;
|
|
53
|
+
// Selectors
|
|
54
|
+
warns(): boolean;
|
|
55
|
+
isPending(): boolean;
|
|
56
|
+
isOmitted(): boolean;
|
|
57
|
+
isUntested(): boolean;
|
|
58
|
+
isFailing(): boolean;
|
|
59
|
+
isCanceled(): boolean;
|
|
60
|
+
isSkipped(): boolean;
|
|
61
|
+
isPassing(): boolean;
|
|
62
|
+
isWarning(): boolean;
|
|
63
|
+
hasFailures(): boolean;
|
|
64
|
+
isNonActionable(): boolean;
|
|
65
|
+
isTested(): boolean;
|
|
66
|
+
awaitsResolution(): boolean;
|
|
67
|
+
statusEquals(status: TestStatus): boolean;
|
|
68
|
+
// State modifiers
|
|
69
|
+
setPending(): void;
|
|
70
|
+
fail(): void;
|
|
71
|
+
pass(): void;
|
|
72
|
+
warn(): void;
|
|
73
|
+
skip(force?: boolean): void;
|
|
74
|
+
cancel(): void;
|
|
75
|
+
reset(): void;
|
|
76
|
+
omit(): void;
|
|
77
|
+
valueOf(): boolean;
|
|
78
|
+
isAsyncTest(): boolean;
|
|
79
|
+
static is(value: any): value is IsolateTest;
|
|
80
|
+
static isX(value: any): asserts value is IsolateTest;
|
|
81
|
+
}
|
|
82
|
+
declare class SummaryFailure<F extends TFieldName, G extends TGroupName> implements WithFieldName<F> {
|
|
83
|
+
fieldName: F;
|
|
84
|
+
message: string | undefined;
|
|
85
|
+
groupName: G | undefined;
|
|
86
|
+
constructor(fieldName: F, message: string | undefined, groupName: G | undefined);
|
|
87
|
+
static fromTestObject<F extends TFieldName, G extends TGroupName>(testObject: IsolateTest<F, G>): SummaryFailure<F, G>;
|
|
88
|
+
toString(): string;
|
|
89
|
+
}
|
|
8
90
|
interface Done<F extends TFieldName, G extends TGroupName> {
|
|
9
91
|
(...args: [
|
|
10
92
|
cb: (res: SuiteResult<F, G>) => void
|
|
@@ -53,10 +135,6 @@ type SingleTestSummary = SummaryBase & {
|
|
|
53
135
|
warnings: string[];
|
|
54
136
|
valid: boolean;
|
|
55
137
|
};
|
|
56
|
-
type SummaryFailure<F extends TFieldName, G extends TGroupName> = WithFieldName<F> & {
|
|
57
|
-
groupName: G | undefined;
|
|
58
|
-
message: string | undefined;
|
|
59
|
-
};
|
|
60
138
|
type FailureMessages = Record<string, string[]>;
|
|
61
139
|
type SuiteResult<F extends TFieldName, G extends TGroupName> = SuiteSummary<F, G> & SuiteSelectors<F, G> & {
|
|
62
140
|
suiteName: SuiteName;
|
package/types/parser.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../src/exports/parser.ts","../src/errors/ErrorStrings.ts","../src/suiteResult/Severity.ts","../src/core/test/TestTypes.ts","../src/core/
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../src/exports/parser.ts","../src/errors/ErrorStrings.ts","../src/suiteResult/Severity.ts","../src/core/test/TestTypes.ts","../src/core/test/helpers/matchingFieldName.ts","../src/core/isolate/IsolateTest/isSameProfileTest.ts","../src/core/isolate/IsolateTest/cancelOverriddenPendingTest.ts","../src/hooks/optional/OptionalTypes.ts","../src/core/isolate/IsolateSuite/IsolateSuite.ts","../src/hooks/optional/optional.ts","../src/core/isolate/IsolateTest/TestWalker.ts","../src/core/test/helpers/matchingGroupName.ts","../src/core/test/helpers/nonMatchingSeverityProfile.ts","../src/suiteResult/selectors/hasFailuresByTestObjects.ts","../src/hooks/mode.ts","../src/core/context/SuiteContext.ts","../src/core/Runtime.ts","../src/suiteResult/selectors/shouldAddValidProperty.ts","../src/suiteResult/selectors/produceSuiteSummary.ts","../src/suiteResult/selectors/collectFailures.ts","../src/suiteResult/selectors/suiteSelectors.ts","../src/suiteResult/suiteResult.ts","../src/isolates/skipWhen.ts","../src/hooks/exclusive.ts","../src/isolates/omitWhen.ts","../src/core/test/testLevelFlowControl/verifyTestRun.ts","../src/core/isolate/IsolateTest/IsolateTestReconciler.ts","../src/core/isolate/IsolateTest/IsolateTestStateMachine.ts","../src/core/test/helpers/shouldUseErrorMessage.ts","../src/core/isolate/IsolateTest/IsolateTest.ts","../src/suiteResult/SummaryFailure.ts","../src/suiteResult/done/deferDoneCallback.ts","../src/suiteResult/done/shouldSkipDoneRegistration.ts","../src/suiteResult/suiteRunResult.ts","../src/suiteResult/SuiteResultTypes.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,iBAAgB,KAAK,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,UAAU,EAC9D,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,GAC1B,gBAAgB,CAAC,CAAC,CAAC,CA4CrB;AAED,UAAU,gBAAgB,CAAC,CAAC,SAAS,UAAU;IAC7C,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC;IAC9B,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC;IAC/B,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC;IAChC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC;IACjC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC;CACjC"}
|
package/types/promisify.d.ts
CHANGED
|
@@ -1,10 +1,92 @@
|
|
|
1
|
+
import { Isolate, IsolateKey } from "vest-runtime";
|
|
2
|
+
import { CB } from "vest-utils";
|
|
1
3
|
declare enum Severity {
|
|
2
4
|
WARNINGS = "warnings",
|
|
3
5
|
ERRORS = "errors"
|
|
4
6
|
}
|
|
7
|
+
declare enum TestSeverity {
|
|
8
|
+
Error = "error",
|
|
9
|
+
Warning = "warning"
|
|
10
|
+
}
|
|
11
|
+
// @vx-allow use-use
|
|
12
|
+
declare function IsolateTestReconciler(currentNode: Isolate, historyNode: Isolate | null): Isolate;
|
|
13
|
+
declare enum TestStatus {
|
|
14
|
+
UNTESTED = "UNTESTED",
|
|
15
|
+
SKIPPED = "SKIPPED",
|
|
16
|
+
FAILED = "FAILED",
|
|
17
|
+
WARNING = "WARNING",
|
|
18
|
+
PASSING = "PASSING",
|
|
19
|
+
PENDING = "PENDING",
|
|
20
|
+
CANCELED = "CANCELED",
|
|
21
|
+
OMITTED = "OMITTED"
|
|
22
|
+
}
|
|
23
|
+
type TestFn = () => TestResult;
|
|
24
|
+
type AsyncTest = Promise<string | void | false>;
|
|
25
|
+
type TestResult = AsyncTest | boolean | void;
|
|
5
26
|
type WithFieldName<F extends TFieldName = TFieldName> = {
|
|
6
27
|
fieldName: F;
|
|
7
28
|
};
|
|
29
|
+
type IsolateTestInput = {
|
|
30
|
+
message?: string;
|
|
31
|
+
groupName?: string;
|
|
32
|
+
fieldName: TFieldName;
|
|
33
|
+
testFn: TestFn;
|
|
34
|
+
key?: IsolateKey;
|
|
35
|
+
};
|
|
36
|
+
declare class IsolateTest<F extends TFieldName = TFieldName, G extends TGroupName = TGroupName> extends Isolate {
|
|
37
|
+
children: null;
|
|
38
|
+
fieldName: F;
|
|
39
|
+
testFn: TestFn;
|
|
40
|
+
groupName?: G;
|
|
41
|
+
message?: string;
|
|
42
|
+
asyncTest?: AsyncTest;
|
|
43
|
+
id: string;
|
|
44
|
+
severity: TestSeverity;
|
|
45
|
+
private stateMachine;
|
|
46
|
+
static reconciler: typeof IsolateTestReconciler;
|
|
47
|
+
constructor({ fieldName, testFn, message, groupName, key }: IsolateTestInput);
|
|
48
|
+
static create<Callback extends CB = CB>(callback: Callback, data: IsolateTestInput): IsolateTest;
|
|
49
|
+
static cast<F extends TFieldName = TFieldName, G extends TGroupName = TGroupName>(isolate: Isolate): IsolateTest<F, G>;
|
|
50
|
+
get status(): TestStatus;
|
|
51
|
+
setStatus(status: TestStatus, payload?: any): void;
|
|
52
|
+
run(): TestResult;
|
|
53
|
+
// Selectors
|
|
54
|
+
warns(): boolean;
|
|
55
|
+
isPending(): boolean;
|
|
56
|
+
isOmitted(): boolean;
|
|
57
|
+
isUntested(): boolean;
|
|
58
|
+
isFailing(): boolean;
|
|
59
|
+
isCanceled(): boolean;
|
|
60
|
+
isSkipped(): boolean;
|
|
61
|
+
isPassing(): boolean;
|
|
62
|
+
isWarning(): boolean;
|
|
63
|
+
hasFailures(): boolean;
|
|
64
|
+
isNonActionable(): boolean;
|
|
65
|
+
isTested(): boolean;
|
|
66
|
+
awaitsResolution(): boolean;
|
|
67
|
+
statusEquals(status: TestStatus): boolean;
|
|
68
|
+
// State modifiers
|
|
69
|
+
setPending(): void;
|
|
70
|
+
fail(): void;
|
|
71
|
+
pass(): void;
|
|
72
|
+
warn(): void;
|
|
73
|
+
skip(force?: boolean): void;
|
|
74
|
+
cancel(): void;
|
|
75
|
+
reset(): void;
|
|
76
|
+
omit(): void;
|
|
77
|
+
valueOf(): boolean;
|
|
78
|
+
isAsyncTest(): boolean;
|
|
79
|
+
static is(value: any): value is IsolateTest;
|
|
80
|
+
static isX(value: any): asserts value is IsolateTest;
|
|
81
|
+
}
|
|
82
|
+
declare class SummaryFailure<F extends TFieldName, G extends TGroupName> implements WithFieldName<F> {
|
|
83
|
+
fieldName: F;
|
|
84
|
+
message: string | undefined;
|
|
85
|
+
groupName: G | undefined;
|
|
86
|
+
constructor(fieldName: F, message: string | undefined, groupName: G | undefined);
|
|
87
|
+
static fromTestObject<F extends TFieldName, G extends TGroupName>(testObject: IsolateTest<F, G>): SummaryFailure<F, G>;
|
|
88
|
+
toString(): string;
|
|
89
|
+
}
|
|
8
90
|
interface Done<F extends TFieldName, G extends TGroupName> {
|
|
9
91
|
(...args: [
|
|
10
92
|
cb: (res: SuiteResult<F, G>) => void
|
|
@@ -53,10 +135,6 @@ type SingleTestSummary = SummaryBase & {
|
|
|
53
135
|
warnings: string[];
|
|
54
136
|
valid: boolean;
|
|
55
137
|
};
|
|
56
|
-
type SummaryFailure<F extends TFieldName, G extends TGroupName> = WithFieldName<F> & {
|
|
57
|
-
groupName: G | undefined;
|
|
58
|
-
message: string | undefined;
|
|
59
|
-
};
|
|
60
138
|
type FailureMessages = Record<string, string[]>;
|
|
61
139
|
type SuiteResult<F extends TFieldName, G extends TGroupName> = SuiteSummary<F, G> & SuiteSelectors<F, G> & {
|
|
62
140
|
suiteName: SuiteName;
|
package/types/promisify.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promisify.d.ts","sourceRoot":"","sources":["../src/exports/promisify.ts","../src/errors/ErrorStrings.ts","../src/suiteResult/Severity.ts","../src/core/test/TestTypes.ts","../src/core/
|
|
1
|
+
{"version":3,"file":"promisify.d.ts","sourceRoot":"","sources":["../src/exports/promisify.ts","../src/errors/ErrorStrings.ts","../src/suiteResult/Severity.ts","../src/core/test/TestTypes.ts","../src/core/test/helpers/matchingFieldName.ts","../src/core/isolate/IsolateTest/isSameProfileTest.ts","../src/core/isolate/IsolateTest/cancelOverriddenPendingTest.ts","../src/hooks/optional/OptionalTypes.ts","../src/core/isolate/IsolateSuite/IsolateSuite.ts","../src/hooks/optional/optional.ts","../src/core/isolate/IsolateTest/TestWalker.ts","../src/core/test/helpers/matchingGroupName.ts","../src/core/test/helpers/nonMatchingSeverityProfile.ts","../src/suiteResult/selectors/hasFailuresByTestObjects.ts","../src/hooks/mode.ts","../src/core/context/SuiteContext.ts","../src/core/Runtime.ts","../src/suiteResult/selectors/shouldAddValidProperty.ts","../src/suiteResult/selectors/produceSuiteSummary.ts","../src/suiteResult/selectors/collectFailures.ts","../src/suiteResult/selectors/suiteSelectors.ts","../src/suiteResult/suiteResult.ts","../src/isolates/skipWhen.ts","../src/hooks/exclusive.ts","../src/isolates/omitWhen.ts","../src/core/test/testLevelFlowControl/verifyTestRun.ts","../src/core/isolate/IsolateTest/IsolateTestReconciler.ts","../src/core/isolate/IsolateTest/IsolateTestStateMachine.ts","../src/core/test/helpers/shouldUseErrorMessage.ts","../src/core/isolate/IsolateTest/IsolateTest.ts","../src/suiteResult/SummaryFailure.ts","../src/suiteResult/done/deferDoneCallback.ts","../src/suiteResult/done/shouldSkipDoneRegistration.ts","../src/suiteResult/suiteRunResult.ts","../src/suiteResult/SuiteResultTypes.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,iBAAS,SAAS,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,UAAU,EAC3D,WAAW,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,aAEpC,GAAG,EAAE,KAAG,QAAQ,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC,CAKpD"}
|
package/types/vest.d.ts
CHANGED
|
@@ -1,15 +1,93 @@
|
|
|
1
1
|
import { enforce } from 'n4s';
|
|
2
|
+
import { Isolate, IsolateKey } from "vest-runtime";
|
|
2
3
|
import { CB } from "vest-utils";
|
|
3
4
|
declare enum Severity {
|
|
4
5
|
WARNINGS = "warnings",
|
|
5
6
|
ERRORS = "errors"
|
|
6
7
|
}
|
|
8
|
+
declare enum TestSeverity {
|
|
9
|
+
Error = "error",
|
|
10
|
+
Warning = "warning"
|
|
11
|
+
}
|
|
12
|
+
// @vx-allow use-use
|
|
13
|
+
declare function IsolateTestReconciler(currentNode: Isolate, historyNode: Isolate | null): Isolate;
|
|
14
|
+
declare enum TestStatus {
|
|
15
|
+
UNTESTED = "UNTESTED",
|
|
16
|
+
SKIPPED = "SKIPPED",
|
|
17
|
+
FAILED = "FAILED",
|
|
18
|
+
WARNING = "WARNING",
|
|
19
|
+
PASSING = "PASSING",
|
|
20
|
+
PENDING = "PENDING",
|
|
21
|
+
CANCELED = "CANCELED",
|
|
22
|
+
OMITTED = "OMITTED"
|
|
23
|
+
}
|
|
7
24
|
type TestFn = () => TestResult;
|
|
8
25
|
type AsyncTest = Promise<string | void | false>;
|
|
9
26
|
type TestResult = AsyncTest | boolean | void;
|
|
10
27
|
type WithFieldName<F extends TFieldName = TFieldName> = {
|
|
11
28
|
fieldName: F;
|
|
12
29
|
};
|
|
30
|
+
type IsolateTestInput = {
|
|
31
|
+
message?: string;
|
|
32
|
+
groupName?: string;
|
|
33
|
+
fieldName: TFieldName;
|
|
34
|
+
testFn: TestFn;
|
|
35
|
+
key?: IsolateKey;
|
|
36
|
+
};
|
|
37
|
+
declare class IsolateTest<F extends TFieldName = TFieldName, G extends TGroupName = TGroupName> extends Isolate {
|
|
38
|
+
children: null;
|
|
39
|
+
fieldName: F;
|
|
40
|
+
testFn: TestFn;
|
|
41
|
+
groupName?: G;
|
|
42
|
+
message?: string;
|
|
43
|
+
asyncTest?: AsyncTest;
|
|
44
|
+
id: string;
|
|
45
|
+
severity: TestSeverity;
|
|
46
|
+
private stateMachine;
|
|
47
|
+
static reconciler: typeof IsolateTestReconciler;
|
|
48
|
+
constructor({ fieldName, testFn, message, groupName, key }: IsolateTestInput);
|
|
49
|
+
static create<Callback extends CB = CB>(callback: Callback, data: IsolateTestInput): IsolateTest;
|
|
50
|
+
static cast<F extends TFieldName = TFieldName, G extends TGroupName = TGroupName>(isolate: Isolate): IsolateTest<F, G>;
|
|
51
|
+
get status(): TestStatus;
|
|
52
|
+
setStatus(status: TestStatus, payload?: any): void;
|
|
53
|
+
run(): TestResult;
|
|
54
|
+
// Selectors
|
|
55
|
+
warns(): boolean;
|
|
56
|
+
isPending(): boolean;
|
|
57
|
+
isOmitted(): boolean;
|
|
58
|
+
isUntested(): boolean;
|
|
59
|
+
isFailing(): boolean;
|
|
60
|
+
isCanceled(): boolean;
|
|
61
|
+
isSkipped(): boolean;
|
|
62
|
+
isPassing(): boolean;
|
|
63
|
+
isWarning(): boolean;
|
|
64
|
+
hasFailures(): boolean;
|
|
65
|
+
isNonActionable(): boolean;
|
|
66
|
+
isTested(): boolean;
|
|
67
|
+
awaitsResolution(): boolean;
|
|
68
|
+
statusEquals(status: TestStatus): boolean;
|
|
69
|
+
// State modifiers
|
|
70
|
+
setPending(): void;
|
|
71
|
+
fail(): void;
|
|
72
|
+
pass(): void;
|
|
73
|
+
warn(): void;
|
|
74
|
+
skip(force?: boolean): void;
|
|
75
|
+
cancel(): void;
|
|
76
|
+
reset(): void;
|
|
77
|
+
omit(): void;
|
|
78
|
+
valueOf(): boolean;
|
|
79
|
+
isAsyncTest(): boolean;
|
|
80
|
+
static is(value: any): value is IsolateTest;
|
|
81
|
+
static isX(value: any): asserts value is IsolateTest;
|
|
82
|
+
}
|
|
83
|
+
declare class SummaryFailure<F extends TFieldName, G extends TGroupName> implements WithFieldName<F> {
|
|
84
|
+
fieldName: F;
|
|
85
|
+
message: string | undefined;
|
|
86
|
+
groupName: G | undefined;
|
|
87
|
+
constructor(fieldName: F, message: string | undefined, groupName: G | undefined);
|
|
88
|
+
static fromTestObject<F extends TFieldName, G extends TGroupName>(testObject: IsolateTest<F, G>): SummaryFailure<F, G>;
|
|
89
|
+
toString(): string;
|
|
90
|
+
}
|
|
13
91
|
interface Done<F extends TFieldName, G extends TGroupName> {
|
|
14
92
|
(...args: [
|
|
15
93
|
cb: (res: SuiteResult<F, G>) => void
|
|
@@ -60,10 +138,6 @@ type SingleTestSummary = SummaryBase & {
|
|
|
60
138
|
warnings: string[];
|
|
61
139
|
valid: boolean;
|
|
62
140
|
};
|
|
63
|
-
type SummaryFailure<F extends TFieldName, G extends TGroupName> = WithFieldName<F> & {
|
|
64
|
-
groupName: G | undefined;
|
|
65
|
-
message: string | undefined;
|
|
66
|
-
};
|
|
67
141
|
type FailureMessages = Record<string, string[]>;
|
|
68
142
|
type SuiteResult<F extends TFieldName, G extends TGroupName> = SuiteSummary<F, G> & SuiteSelectors<F, G> & {
|
|
69
143
|
suiteName: SuiteName;
|
|
@@ -78,120 +152,6 @@ type OptionalsInput<F extends TFieldName> = F | F[] | OptionalsObject<F>;
|
|
|
78
152
|
type OptionalsObject<F extends TFieldName> = Record<F, (() => boolean) | boolean>;
|
|
79
153
|
// @vx-allow use-use
|
|
80
154
|
declare function optional<F extends TFieldName>(optionals: OptionalsInput<F>): void;
|
|
81
|
-
declare class Reconciler {
|
|
82
|
-
static reconciler(currentNode: Isolate, historicNode: Isolate | null): Isolate;
|
|
83
|
-
static reconcile<Callback extends CB = CB>(node: Isolate, callback: Callback): [
|
|
84
|
-
Isolate,
|
|
85
|
-
ReturnType<Callback>
|
|
86
|
-
];
|
|
87
|
-
static removeAllNextNodesInIsolate(): void;
|
|
88
|
-
static handleCollision(newNode: Isolate, prevNode: Isolate): Isolate;
|
|
89
|
-
static nodeReorderDetected(newNode: Isolate, prevNode: Isolate): boolean;
|
|
90
|
-
static onNodeReorder(newNode: Isolate, prevNode: Isolate): Isolate;
|
|
91
|
-
static handleIsolateNodeWithKey(node: Isolate): Isolate;
|
|
92
|
-
}
|
|
93
|
-
type IsolateKey = null | string;
|
|
94
|
-
declare class Isolate<_D = any> {
|
|
95
|
-
children: Isolate[] | null;
|
|
96
|
-
keys: Record<string, Isolate>;
|
|
97
|
-
parent: Isolate | null;
|
|
98
|
-
output?: any;
|
|
99
|
-
key: IsolateKey;
|
|
100
|
-
allowReorder: boolean;
|
|
101
|
-
static reconciler: typeof Reconciler;
|
|
102
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
|
|
103
|
-
constructor(_data?: _D);
|
|
104
|
-
setParent(parent: Isolate | null): this;
|
|
105
|
-
saveOutput(output: any): this;
|
|
106
|
-
setKey(key: string | null): this;
|
|
107
|
-
usesKey(): boolean;
|
|
108
|
-
addChild(child: Isolate): void;
|
|
109
|
-
removeChild(node: Isolate): void;
|
|
110
|
-
slice(at: number): void;
|
|
111
|
-
at(at: number): Isolate | null;
|
|
112
|
-
cursor(): number;
|
|
113
|
-
shouldAllowReorder(): boolean;
|
|
114
|
-
get rootNode(): Isolate;
|
|
115
|
-
static create<Callback extends CB = CB>(callback: Callback, data?: any): Isolate;
|
|
116
|
-
private static createImplementation;
|
|
117
|
-
static setNode(node: Isolate): void;
|
|
118
|
-
static is(node: any): boolean;
|
|
119
|
-
}
|
|
120
|
-
declare class IsolateTestReconciler extends Reconciler {
|
|
121
|
-
static reconciler(currentNode: Isolate, historyNode: Isolate | null): Isolate;
|
|
122
|
-
static nodeReorderDetected(newNode: IsolateTest, prevNode?: Isolate): boolean;
|
|
123
|
-
static handleCollision(newNode: IsolateTest, prevNode?: Isolate): IsolateTest;
|
|
124
|
-
static onNodeReorder(newNode: IsolateTest, prevNode?: Isolate): IsolateTest;
|
|
125
|
-
static pickNode(historyNode: IsolateTest, currentNode: IsolateTest): Isolate;
|
|
126
|
-
static handleNoHistoryNode(testNode: IsolateTest): IsolateTest;
|
|
127
|
-
}
|
|
128
|
-
declare enum TestStatus {
|
|
129
|
-
UNTESTED = "UNTESTED",
|
|
130
|
-
SKIPPED = "SKIPPED",
|
|
131
|
-
FAILED = "FAILED",
|
|
132
|
-
WARNING = "WARNING",
|
|
133
|
-
PASSING = "PASSING",
|
|
134
|
-
PENDING = "PENDING",
|
|
135
|
-
CANCELED = "CANCELED",
|
|
136
|
-
OMITTED = "OMITTED"
|
|
137
|
-
}
|
|
138
|
-
type IsolateTestInput = {
|
|
139
|
-
message?: string;
|
|
140
|
-
groupName?: string;
|
|
141
|
-
fieldName: TFieldName;
|
|
142
|
-
testFn: TestFn;
|
|
143
|
-
key?: IsolateKey;
|
|
144
|
-
};
|
|
145
|
-
declare class IsolateTest<F extends TFieldName = TFieldName, G extends TGroupName = TGroupName> extends Isolate {
|
|
146
|
-
children: null;
|
|
147
|
-
fieldName: F;
|
|
148
|
-
testFn: TestFn;
|
|
149
|
-
groupName?: G;
|
|
150
|
-
message?: string;
|
|
151
|
-
asyncTest?: AsyncTest;
|
|
152
|
-
id: string;
|
|
153
|
-
severity: TestSeverity;
|
|
154
|
-
private stateMachine;
|
|
155
|
-
static reconciler: typeof IsolateTestReconciler;
|
|
156
|
-
constructor({ fieldName, testFn, message, groupName, key }: IsolateTestInput);
|
|
157
|
-
static create<Callback extends CB = CB>(callback: Callback, data: IsolateTestInput): IsolateTest;
|
|
158
|
-
static cast<F extends TFieldName = TFieldName, G extends TGroupName = TGroupName>(isolate: Isolate): IsolateTest<F, G>;
|
|
159
|
-
get status(): TestStatus;
|
|
160
|
-
setStatus(status: TestStatus, payload?: any): void;
|
|
161
|
-
run(): TestResult;
|
|
162
|
-
// Selectors
|
|
163
|
-
warns(): boolean;
|
|
164
|
-
isPending(): boolean;
|
|
165
|
-
isOmitted(): boolean;
|
|
166
|
-
isUntested(): boolean;
|
|
167
|
-
isFailing(): boolean;
|
|
168
|
-
isCanceled(): boolean;
|
|
169
|
-
isSkipped(): boolean;
|
|
170
|
-
isPassing(): boolean;
|
|
171
|
-
isWarning(): boolean;
|
|
172
|
-
hasFailures(): boolean;
|
|
173
|
-
isNonActionable(): boolean;
|
|
174
|
-
isTested(): boolean;
|
|
175
|
-
awaitsResolution(): boolean;
|
|
176
|
-
statusEquals(status: TestStatus): boolean;
|
|
177
|
-
// State modifiers
|
|
178
|
-
setPending(): void;
|
|
179
|
-
fail(): void;
|
|
180
|
-
pass(): void;
|
|
181
|
-
warn(): void;
|
|
182
|
-
skip(force?: boolean): void;
|
|
183
|
-
cancel(): void;
|
|
184
|
-
reset(): void;
|
|
185
|
-
omit(): void;
|
|
186
|
-
valueOf(): boolean;
|
|
187
|
-
isAsyncTest(): boolean;
|
|
188
|
-
static is(value: any): value is IsolateTest;
|
|
189
|
-
static isX(value: any): asserts value is IsolateTest;
|
|
190
|
-
}
|
|
191
|
-
declare enum TestSeverity {
|
|
192
|
-
Error = "error",
|
|
193
|
-
Warning = "warning"
|
|
194
|
-
}
|
|
195
155
|
type FieldExclusion<F extends TFieldName> = F | F[] | undefined;
|
|
196
156
|
type GroupExclusion<G extends TGroupName> = G | G[] | undefined;
|
|
197
157
|
/**
|
|
@@ -263,15 +223,15 @@ type TTypedMethods<F extends TFieldName, G extends TGroupName> = {
|
|
|
263
223
|
};
|
|
264
224
|
group: (groupName: G, callback: () => void) => Isolate;
|
|
265
225
|
};
|
|
266
|
-
type Suite<
|
|
226
|
+
type Suite<F extends TFieldName, G extends TGroupName, T extends CB = CB> = ((...args: Parameters<T>) => SuiteRunResult<F, G>) & SuiteMethods<F, G>;
|
|
267
227
|
type SuiteMethods<F extends TFieldName, G extends TGroupName> = {
|
|
268
228
|
get: () => SuiteResult<F, G>;
|
|
269
229
|
reset: () => void;
|
|
270
230
|
remove: (fieldName: F) => void;
|
|
271
231
|
resetField: (fieldName: F) => void;
|
|
272
|
-
} & TTypedMethods<F, G>;
|
|
273
|
-
declare function createSuite<
|
|
274
|
-
declare function createSuite<
|
|
232
|
+
} & TTypedMethods<F, G> & SuiteSelectors<F, G>;
|
|
233
|
+
declare function createSuite<F extends TFieldName = string, G extends TGroupName = string, T extends CB = CB>(suiteName: SuiteName, suiteCallback: T): Suite<F, G, T>;
|
|
234
|
+
declare function createSuite<F extends TFieldName = string, G extends TGroupName = string, T extends CB = CB>(suiteCallback: T): Suite<F, G, T>;
|
|
275
235
|
/**
|
|
276
236
|
* Iterates over an array of items, allowing to run tests individually per item.
|
|
277
237
|
*
|
|
@@ -287,32 +247,52 @@ declare function createSuite<T extends CB, F extends TFieldName = string, G exte
|
|
|
287
247
|
*/
|
|
288
248
|
declare function each<T>(list: T[], callback: (arg: T, index: number) => void): void;
|
|
289
249
|
declare function group<G extends TGroupName>(groupName: G, callback: () => void): Isolate;
|
|
250
|
+
/**
|
|
251
|
+
* Conditionally includes a field for testing, based on specified criteria.
|
|
252
|
+
*
|
|
253
|
+
* @param {string} fieldName - The name of the field to include for testing.
|
|
254
|
+
*
|
|
255
|
+
* @example
|
|
256
|
+
* include('confirm').when('password');
|
|
257
|
+
* // Includes the "confirm" field for testing when the "password" field is included
|
|
258
|
+
*
|
|
259
|
+
* include('confirm').when(someValue);
|
|
260
|
+
* // Includes the "confirm" field for testing when the value of `someValue` is true
|
|
261
|
+
*
|
|
262
|
+
* include('confirm').when(() => someValue);
|
|
263
|
+
* // Includes the "confirm" field for testing when the callback function returns true
|
|
264
|
+
*
|
|
265
|
+
* include('username').when(result => result.hasErrors('username'));
|
|
266
|
+
* // Includes the "username" field for testing when there are errors associated with it in the current suite result
|
|
267
|
+
*/
|
|
290
268
|
// @vx-allow use-use
|
|
291
269
|
declare function include<F extends TFieldName, G extends TGroupName>(fieldName: F): {
|
|
292
270
|
when: (condition: F | TFieldName | boolean | ((draft: SuiteResult<F, G>) => boolean)) => void;
|
|
293
271
|
};
|
|
294
272
|
declare enum Modes {
|
|
273
|
+
EAGER = "EAGER",
|
|
295
274
|
ALL = "ALL",
|
|
296
|
-
|
|
275
|
+
ONE = "ONE"
|
|
297
276
|
}
|
|
298
277
|
/**
|
|
299
|
-
* Sets the
|
|
300
|
-
*
|
|
278
|
+
* Sets the current execution mode for the current suite.
|
|
279
|
+
*
|
|
280
|
+
* Supported modes:
|
|
281
|
+
* - `EAGER` - (default) Runs all tests, but stops on first failure for each given field.
|
|
282
|
+
* - `ALL` - Runs all tests, regardless of failures.
|
|
283
|
+
* - `ONE` - Stops suite execution on first failure of any field.
|
|
301
284
|
*
|
|
302
285
|
* @example
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
* const suite = create((data) => {
|
|
306
|
-
* eager();
|
|
286
|
+
* ```js
|
|
287
|
+
* import {Modes, create} from 'vest';
|
|
307
288
|
*
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
* });
|
|
289
|
+
* const suite = create('suite_name', () => {
|
|
290
|
+
* vest.mode(Modes.ALL);
|
|
311
291
|
*
|
|
312
|
-
*
|
|
313
|
-
* enforce(data.username).longerThan(2);
|
|
314
|
-
* });
|
|
292
|
+
* // ...
|
|
315
293
|
* });
|
|
294
|
+
* ```
|
|
295
|
+
* @param 'ALL' | 'EAGER' | 'ONE' mode - The mode to set.
|
|
316
296
|
*/
|
|
317
297
|
// @vx-allow use-use
|
|
318
298
|
declare function mode(mode: Modes): void;
|
|
@@ -338,10 +318,42 @@ declare function omitWhen<F extends TFieldName, G extends TGroupName>(conditiona
|
|
|
338
318
|
*/
|
|
339
319
|
// @vx-allow use-use
|
|
340
320
|
declare function skipWhen<F extends TFieldName, G extends TGroupName>(condition: boolean | ((draft: SuiteResult<F, G>) => boolean), callback: CB): void;
|
|
341
|
-
declare function staticSuite<T extends CB, F extends TFieldName = string, G extends TGroupName = string>(suiteCallback: T): StaticSuite<T, F, G>;
|
|
342
|
-
type StaticSuite<T extends CB, F extends TFieldName = string, G extends TGroupName = string> = ((...args: Parameters<T>) => SuiteRunResult<F, G>) & TTypedMethods<F, G>;
|
|
343
321
|
/**
|
|
344
|
-
*
|
|
322
|
+
* Creates a static suite for server-side validation.
|
|
323
|
+
*
|
|
324
|
+
* @param {Function} validationFn - The validation function that defines the suite's tests.
|
|
325
|
+
* @returns {Function} - A function that runs the validations defined in the suite.
|
|
326
|
+
*
|
|
327
|
+
* @example
|
|
328
|
+
* import { staticSuite, test, enforce } from 'vest';
|
|
329
|
+
*
|
|
330
|
+
* const suite = staticSuite(data => {
|
|
331
|
+
* test('username', 'username is required', () => {
|
|
332
|
+
* enforce(data.username).isNotEmpty();
|
|
333
|
+
* });
|
|
334
|
+
* });
|
|
335
|
+
*
|
|
336
|
+
* suite(data);
|
|
337
|
+
*/
|
|
338
|
+
declare function staticSuite<F extends TFieldName = string, G extends TGroupName = string, T extends CB = CB>(suiteCallback: T): StaticSuite<F, G, T>;
|
|
339
|
+
type StaticSuite<F extends TFieldName = string, G extends TGroupName = string, T extends CB = CB> = ((...args: Parameters<T>) => SuiteRunResult<F, G>) & TTypedMethods<F, G>;
|
|
340
|
+
/**
|
|
341
|
+
* Sets the severity level of a test to `warn`, allowing it to fail without marking the suite as invalid.
|
|
342
|
+
* Use this function within the body of a test to create warn-only tests.
|
|
343
|
+
*
|
|
344
|
+
* @returns {void}
|
|
345
|
+
*
|
|
346
|
+
* @example
|
|
347
|
+
* test('password', 'Your password strength is: WEAK', () => {
|
|
348
|
+
* warn();
|
|
349
|
+
*
|
|
350
|
+
* enforce(data.password).matches(/0-9/);
|
|
351
|
+
* });
|
|
352
|
+
*
|
|
353
|
+
* @limitations
|
|
354
|
+
* - The `warn` function should only be used within the body of a `test` function.
|
|
355
|
+
* - When using `warn()` in an async test, it should be called in the synchronous portion of the test, not after an `await` call or in the Promise body.
|
|
356
|
+
* - It is recommended to call `warn()` at the top of the test function.
|
|
345
357
|
*/
|
|
346
358
|
// @vx-allow use-use
|
|
347
359
|
declare function warn(): void;
|
package/types/vest.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vest.d.ts","sourceRoot":"","sources":["../src/vest.ts","../src/
|
|
1
|
+
{"version":3,"file":"vest.d.ts","sourceRoot":"","sources":["../src/vest.ts","../src/suiteResult/Severity.ts","../src/errors/ErrorStrings.ts","../src/core/test/TestTypes.ts","../src/core/test/helpers/matchingFieldName.ts","../src/core/isolate/IsolateTest/isSameProfileTest.ts","../src/core/isolate/IsolateTest/cancelOverriddenPendingTest.ts","../src/core/isolate/IsolateTest/TestWalker.ts","../src/core/test/helpers/matchingGroupName.ts","../src/core/test/helpers/nonMatchingSeverityProfile.ts","../src/suiteResult/selectors/hasFailuresByTestObjects.ts","../src/hooks/mode.ts","../src/core/context/SuiteContext.ts","../src/core/Runtime.ts","../src/suiteResult/selectors/shouldAddValidProperty.ts","../src/suiteResult/selectors/produceSuiteSummary.ts","../src/suiteResult/selectors/collectFailures.ts","../src/suiteResult/selectors/suiteSelectors.ts","../src/suiteResult/suiteResult.ts","../src/isolates/skipWhen.ts","../src/hooks/exclusive.ts","../src/isolates/omitWhen.ts","../src/core/test/testLevelFlowControl/verifyTestRun.ts","../src/core/isolate/IsolateTest/IsolateTestReconciler.ts","../src/core/isolate/IsolateTest/IsolateTestStateMachine.ts","../src/core/test/helpers/shouldUseErrorMessage.ts","../src/core/isolate/IsolateTest/IsolateTest.ts","../src/suiteResult/SummaryFailure.ts","../src/suiteResult/done/deferDoneCallback.ts","../src/suiteResult/done/shouldSkipDoneRegistration.ts","../src/suiteResult/suiteRunResult.ts","../src/suiteResult/SuiteResultTypes.ts","../src/hooks/optional/OptionalTypes.ts","../src/core/isolate/IsolateSuite/IsolateSuite.ts","../src/hooks/optional/optional.ts","../src/hooks/include.ts","../src/core/VestBus/BusEvents.ts","../src/core/test/testLevelFlowControl/runTest.ts","../src/core/test/test.memo.ts","../src/core/test/test.ts","../src/suite/getTypedMethods.ts","../src/suite/SuiteTypes.ts","../src/hooks/optional/omitOptionalFields.ts","../src/suite/runCallbacks.ts","../src/core/VestBus/VestBus.ts","../src/suite/validateParams/validateSuiteParams.ts","../src/suite/createSuite.ts","../src/core/isolate/IsolateEach/IsolateEach.ts","../src/isolates/each.ts","../src/isolates/group.ts","../src/suite/staticSuite.ts","../src/hooks/warn.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,KAAK,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwB9B,OAAO,wJAiBN,CAAC;AAEF,YAAY,iEAAiE,CAAC"}
|