track-cli 4.0.3 → 4.1.0-rc1
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/esm/_dnt.shims.d.ts +1 -1
- package/esm/_dnt.test_shims.d.ts +20 -0
- package/esm/_dnt.test_shims.js +77 -0
- package/esm/deps/deno.land/std@0.195.0/_util/diff.d.ts +26 -0
- package/esm/deps/deno.land/std@0.195.0/_util/diff.js +311 -0
- package/esm/deps/deno.land/std@0.195.0/assert/_constants.d.ts +1 -0
- package/esm/deps/deno.land/std@0.195.0/assert/_constants.js +2 -0
- package/esm/deps/deno.land/std@0.195.0/assert/_format.d.ts +1 -0
- package/esm/deps/deno.land/std@0.195.0/assert/_format.js +23 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert_almost_equals.d.ts +18 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert_almost_equals.js +32 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert_array_includes.d.ts +14 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert_array_includes.js +38 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert_equals.d.ts +17 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert_equals.js +45 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert_exists.d.ts +5 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert_exists.js +14 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert_false.d.ts +4 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert_false.js +7 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert_instance_of.d.ts +8 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert_instance_of.js +38 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert_is_error.d.ts +7 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert_is_error.js +26 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert_match.d.ts +5 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert_match.js +13 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert_not_equals.d.ts +14 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert_not_equals.js +37 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert_not_instance_of.d.ts +5 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert_not_instance_of.js +14 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert_not_match.d.ts +5 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert_not_match.js +14 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert_not_strict_equals.d.ts +11 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert_not_strict_equals.js +20 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert_object_match.d.ts +5 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert_object_match.js +78 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert_rejects.d.ts +64 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert_rejects.js +50 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert_strict_equals.d.ts +23 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert_strict_equals.js +60 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert_string_includes.d.ts +5 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert_string_includes.js +13 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert_throws.d.ts +54 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert_throws.js +44 -0
- package/esm/deps/deno.land/std@0.195.0/assert/equal.d.ts +6 -0
- package/esm/deps/deno.land/std@0.195.0/assert/equal.js +102 -0
- package/esm/deps/deno.land/std@0.195.0/assert/fail.d.ts +4 -0
- package/esm/deps/deno.land/std@0.195.0/assert/fail.js +9 -0
- package/esm/deps/deno.land/std@0.195.0/assert/mod.d.ts +32 -0
- package/esm/deps/deno.land/std@0.195.0/assert/mod.js +33 -0
- package/esm/deps/deno.land/std@0.195.0/assert/unimplemented.d.ts +2 -0
- package/esm/deps/deno.land/std@0.195.0/assert/unimplemented.js +7 -0
- package/esm/deps/deno.land/std@0.195.0/assert/unreachable.d.ts +2 -0
- package/esm/deps/deno.land/std@0.195.0/assert/unreachable.js +6 -0
- package/esm/deps/deno.land/std@0.195.0/testing/_test_suite.d.ts +70 -0
- package/esm/deps/deno.land/std@0.195.0/testing/_test_suite.js +321 -0
- package/esm/deps/deno.land/std@0.195.0/testing/asserts.d.ts +329 -0
- package/esm/deps/deno.land/std@0.195.0/testing/asserts.js +330 -0
- package/esm/deps/deno.land/std@0.195.0/testing/bdd.d.ts +440 -0
- package/esm/deps/deno.land/std@0.195.0/testing/bdd.js +215 -0
- package/esm/deps/deno.land/std@0.195.0/testing/mock.d.ts +110 -0
- package/esm/deps/deno.land/std@0.195.0/testing/mock.js +746 -0
- package/esm/src/action/clone.js +4 -3
- package/esm/src/action/frontend-template-switch.d.ts +1 -0
- package/esm/src/action/frontend-template-switch.js +56 -0
- package/esm/src/action/frontend-template.d.ts +2 -0
- package/esm/src/action/frontend-template.js +12 -0
- package/esm/src/main.js +9 -2
- package/esm/src/meta.d.ts +1 -1
- package/esm/src/meta.js +108 -25
- package/esm/src/orca/client.js +1 -1
- package/esm/src/shared/config.d.ts +1 -0
- package/esm/src/shared/file.d.ts +1 -0
- package/esm/src/shared/file.js +32 -0
- package/esm/src/shared/mod.d.ts +1 -1
- package/esm/src/shared/mod.js +10 -2
- package/esm/src/shared/types.d.ts +15 -0
- package/esm/src/shared/types.js +1 -0
- package/esm/src/track/client.d.ts +4 -1
- package/esm/src/track/test.d.ts +5 -2
- package/esm/src/track/test.js +18 -2
- package/esm/src/track/training.d.ts +4 -1
- package/esm/src/track/training.js +9 -0
- package/esm/test/shared/config_test.d.ts +1 -0
- package/esm/test/shared/config_test.js +57 -0
- package/esm/test/shared/file_test.d.ts +1 -0
- package/esm/test/shared/file_test.js +265 -0
- package/esm/test/shared/mod_test.d.ts +1 -0
- package/esm/test/shared/mod_test.js +353 -0
- package/package.json +2 -1
- package/test_runner.js +186 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/** An error related to spying on a function or instance method. */
|
|
2
|
+
export declare class MockError extends Error {
|
|
3
|
+
constructor(message: string);
|
|
4
|
+
}
|
|
5
|
+
/** Call information recorded by a spy. */
|
|
6
|
+
export interface SpyCall<Self = any, Args extends unknown[] = any[], Return = any> {
|
|
7
|
+
/** Arguments passed to a function when called. */
|
|
8
|
+
args: Args;
|
|
9
|
+
/** The value that was returned by a function. */
|
|
10
|
+
returned?: Return;
|
|
11
|
+
/** The error value that was thrown by a function. */
|
|
12
|
+
error?: Error;
|
|
13
|
+
/** The instance that a method was called on. */
|
|
14
|
+
self?: Self;
|
|
15
|
+
}
|
|
16
|
+
/** A function or instance method wrapper that records all calls made to it. */
|
|
17
|
+
export interface Spy<Self = any, Args extends unknown[] = any[], Return = any> {
|
|
18
|
+
(this: Self, ...args: Args): Return;
|
|
19
|
+
/** The function that is being spied on. */
|
|
20
|
+
original: (this: Self, ...args: Args) => Return;
|
|
21
|
+
/** Information about calls made to the function or instance method. */
|
|
22
|
+
calls: SpyCall<Self, Args, Return>[];
|
|
23
|
+
/** Whether or not the original instance method has been restored. */
|
|
24
|
+
restored: boolean;
|
|
25
|
+
/** If spying on an instance method, this restores the original instance method. */
|
|
26
|
+
restore(): void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Creates a session that tracks all mocks created before it's restored.
|
|
30
|
+
* If a callback is provided, it restores all mocks created within it.
|
|
31
|
+
*/
|
|
32
|
+
export declare function mockSession(): number;
|
|
33
|
+
export declare function mockSession<Self, Args extends unknown[], Return>(func: (this: Self, ...args: Args) => Return): (this: Self, ...args: Args) => Return;
|
|
34
|
+
/** Creates an async session that tracks all mocks created before the promise resolves. */
|
|
35
|
+
export declare function mockSessionAsync<Self, Args extends unknown[], Return>(func: (this: Self, ...args: Args) => Promise<Return>): (this: Self, ...args: Args) => Promise<Return>;
|
|
36
|
+
/**
|
|
37
|
+
* Restores all mocks registered in the current session that have not already been restored.
|
|
38
|
+
* If an id is provided, it will restore all mocks registered in the session associed with that id that have not already been restored.
|
|
39
|
+
*/
|
|
40
|
+
export declare function restore(id?: number): void;
|
|
41
|
+
/** Utility for extracting the arguments type from a property */
|
|
42
|
+
type GetParametersFromProp<Self, Prop extends keyof Self> = Self[Prop] extends (...args: infer Args) => unknown ? Args : unknown[];
|
|
43
|
+
/** Utility for extracting the return type from a property */
|
|
44
|
+
type GetReturnFromProp<Self, Prop extends keyof Self> = Self[Prop] extends (...args: any[]) => infer Return ? Return : unknown;
|
|
45
|
+
/** Wraps a function or instance method with a Spy. */
|
|
46
|
+
export declare function spy<Self = any, Args extends unknown[] = any[], Return = undefined>(): Spy<Self, Args, Return>;
|
|
47
|
+
export declare function spy<Self, Args extends unknown[], Return>(func: (this: Self, ...args: Args) => Return): Spy<Self, Args, Return>;
|
|
48
|
+
export declare function spy<Self, Prop extends keyof Self>(self: Self, property: Prop): Spy<Self, GetParametersFromProp<Self, Prop>, GetReturnFromProp<Self, Prop>>;
|
|
49
|
+
/** An instance method replacement that records all calls made to it. */
|
|
50
|
+
export interface Stub<Self = any, Args extends unknown[] = any[], Return = any> extends Spy<Self, Args, Return> {
|
|
51
|
+
/** The function that is used instead of the original. */
|
|
52
|
+
fake: (this: Self, ...args: Args) => Return;
|
|
53
|
+
}
|
|
54
|
+
/** Replaces an instance method with a Stub. */
|
|
55
|
+
export declare function stub<Self, Prop extends keyof Self>(self: Self, property: Prop): Stub<Self, GetParametersFromProp<Self, Prop>, GetReturnFromProp<Self, Prop>>;
|
|
56
|
+
export declare function stub<Self, Prop extends keyof Self>(self: Self, property: Prop, func: (this: Self, ...args: GetParametersFromProp<Self, Prop>) => GetReturnFromProp<Self, Prop>): Stub<Self, GetParametersFromProp<Self, Prop>, GetReturnFromProp<Self, Prop>>;
|
|
57
|
+
/**
|
|
58
|
+
* Asserts that a spy is called as much as expected and no more.
|
|
59
|
+
*/
|
|
60
|
+
export declare function assertSpyCalls<Self, Args extends unknown[], Return>(spy: Spy<Self, Args, Return>, expectedCalls: number): void;
|
|
61
|
+
/** Call information recorded by a spy. */
|
|
62
|
+
export interface ExpectedSpyCall<Self = any, Args extends unknown[] = any[], Return = any> {
|
|
63
|
+
/** Arguments passed to a function when called. */
|
|
64
|
+
args?: [...Args, ...unknown[]];
|
|
65
|
+
/** The instance that a method was called on. */
|
|
66
|
+
self?: Self;
|
|
67
|
+
/**
|
|
68
|
+
* The value that was returned by a function.
|
|
69
|
+
* If you expect a promise to reject, expect error instead.
|
|
70
|
+
*/
|
|
71
|
+
returned?: Return;
|
|
72
|
+
error?: {
|
|
73
|
+
/** The class for the error that was thrown by a function. */
|
|
74
|
+
Class?: new (...args: any[]) => Error;
|
|
75
|
+
/** Part of the message for the error that was thrown by a function. */
|
|
76
|
+
msgIncludes?: string;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Asserts that a spy is called as expected.
|
|
81
|
+
*/
|
|
82
|
+
export declare function assertSpyCall<Self, Args extends unknown[], Return>(spy: Spy<Self, Args, Return>, callIndex: number, expected?: ExpectedSpyCall<Self, Args, Return>): void;
|
|
83
|
+
/**
|
|
84
|
+
* Asserts that an async spy is called as expected.
|
|
85
|
+
*/
|
|
86
|
+
export declare function assertSpyCallAsync<Self, Args extends unknown[], Return>(spy: Spy<Self, Args, Promise<Return>>, callIndex: number, expected?: ExpectedSpyCall<Self, Args, Promise<Return> | Return>): Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* Asserts that a spy is called with a specific arg as expected.
|
|
89
|
+
*/
|
|
90
|
+
export declare function assertSpyCallArg<Self, Args extends unknown[], Return, ExpectedArg>(spy: Spy<Self, Args, Return>, callIndex: number, argIndex: number, expected: ExpectedArg): ExpectedArg;
|
|
91
|
+
/**
|
|
92
|
+
* Asserts that an spy is called with a specific range of args as expected.
|
|
93
|
+
* If a start and end index is not provided, the expected will be compared against all args.
|
|
94
|
+
* If a start is provided without an end index, the expected will be compared against all args from the start index to the end.
|
|
95
|
+
* The end index is not included in the range of args that are compared.
|
|
96
|
+
*/
|
|
97
|
+
export declare function assertSpyCallArgs<Self, Args extends unknown[], Return, ExpectedArgs extends unknown[]>(spy: Spy<Self, Args, Return>, callIndex: number, expected: ExpectedArgs): ExpectedArgs;
|
|
98
|
+
export declare function assertSpyCallArgs<Self, Args extends unknown[], Return, ExpectedArgs extends unknown[]>(spy: Spy<Self, Args, Return>, callIndex: number, argsStart: number, expected: ExpectedArgs): ExpectedArgs;
|
|
99
|
+
export declare function assertSpyCallArgs<Self, Args extends unknown[], Return, ExpectedArgs extends unknown[]>(spy: Spy<Self, Args, Return>, callIndex: number, argStart: number, argEnd: number, expected: ExpectedArgs): ExpectedArgs;
|
|
100
|
+
/** Creates a function that returns the instance the method was called on. */
|
|
101
|
+
export declare function returnsThis<Self = any, Args extends unknown[] = any[]>(): (this: Self, ...args: Args) => Self;
|
|
102
|
+
/** Creates a function that returns one of its arguments. */
|
|
103
|
+
export declare function returnsArg<Arg, Self = any>(idx: number): (this: Self, ...args: Arg[]) => Arg;
|
|
104
|
+
/** Creates a function that returns its arguments or a subset of them. If end is specified, it will return arguments up to but not including the end. */
|
|
105
|
+
export declare function returnsArgs<Args extends unknown[], Self = any>(start?: number, end?: number): (this: Self, ...args: Args) => Args;
|
|
106
|
+
/** Creates a function that returns the iterable values. Any iterable values that are errors will be thrown. */
|
|
107
|
+
export declare function returnsNext<Return, Self = any, Args extends unknown[] = any[]>(values: Iterable<Return | Error>): (this: Self, ...args: Args) => Return;
|
|
108
|
+
/** Creates a function that resolves the awaited iterable values. Any awaited iterable values that are errors will be thrown. */
|
|
109
|
+
export declare function resolvesNext<Return, Self = any, Args extends unknown[] = any[]>(iterable: Iterable<Return | Error | Promise<Return | Error>> | AsyncIterable<Return | Error | Promise<Return | Error>>): (this: Self, ...args: Args) => Promise<Return>;
|
|
110
|
+
export {};
|