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,329 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/asserts` instead.
|
|
3
|
+
*
|
|
4
|
+
* A library of assertion functions.
|
|
5
|
+
* If the assertion is false an `AssertionError` will be thrown which will
|
|
6
|
+
* result in pretty-printed diff of failing assertion.
|
|
7
|
+
*
|
|
8
|
+
* This module is browser compatible, but do not rely on good formatting of
|
|
9
|
+
* values for AssertionError messages in browsers.
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
12
|
+
*/
|
|
13
|
+
export {
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/assert.ts` instead.
|
|
16
|
+
*
|
|
17
|
+
* Make an assertion, error will be thrown if `expr` does not have truthy value.
|
|
18
|
+
*/
|
|
19
|
+
assert,
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_almost_equals.ts` instead.
|
|
22
|
+
*
|
|
23
|
+
* Make an assertion that `actual` and `expected` are almost equal numbers through
|
|
24
|
+
* a given tolerance. It can be used to take into account IEEE-754 double-precision
|
|
25
|
+
* floating-point representation limitations.
|
|
26
|
+
* If the values are not almost equal then throw.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* import { assertAlmostEquals, assertThrows } from "https://deno.land/std@$STD_VERSION/testing/asserts.ts";
|
|
31
|
+
*
|
|
32
|
+
* assertAlmostEquals(0.1, 0.2);
|
|
33
|
+
*
|
|
34
|
+
* // Using a custom tolerance value
|
|
35
|
+
* assertAlmostEquals(0.1 + 0.2, 0.3, 1e-16);
|
|
36
|
+
* assertThrows(() => assertAlmostEquals(0.1 + 0.2, 0.3, 1e-17));
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
assertAlmostEquals,
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_array_includes.ts` instead.
|
|
42
|
+
*
|
|
43
|
+
* Make an assertion that `actual` includes the `expected` values.
|
|
44
|
+
* If not then an error will be thrown.
|
|
45
|
+
*
|
|
46
|
+
* Type parameter can be specified to ensure values under comparison have the same type.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* import { assertArrayIncludes } from "https://deno.land/std@$STD_VERSION/testing/asserts.ts";
|
|
51
|
+
*
|
|
52
|
+
* assertArrayIncludes<number>([1, 2], [2])
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
assertArrayIncludes,
|
|
56
|
+
/**
|
|
57
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_equals.ts` instead.
|
|
58
|
+
*
|
|
59
|
+
* Make an assertion that `actual` and `expected` are equal, deeply. If not
|
|
60
|
+
* deeply equal, then throw.
|
|
61
|
+
*
|
|
62
|
+
* Type parameter can be specified to ensure values under comparison have the same type.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* import { assertEquals } from "https://deno.land/std@$STD_VERSION/testing/asserts.ts";
|
|
67
|
+
*
|
|
68
|
+
* Deno.test("example", function (): void {
|
|
69
|
+
* assertEquals("world", "world");
|
|
70
|
+
* assertEquals({ hello: "world" }, { hello: "world" });
|
|
71
|
+
* });
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
assertEquals,
|
|
75
|
+
/**
|
|
76
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_exists.ts` instead.
|
|
77
|
+
*
|
|
78
|
+
* Make an assertion that actual is not null or undefined.
|
|
79
|
+
* If not then throw.
|
|
80
|
+
*/
|
|
81
|
+
assertExists,
|
|
82
|
+
/**
|
|
83
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_false.ts` instead.
|
|
84
|
+
*
|
|
85
|
+
* Make an assertion, error will be thrown if `expr` have truthy value.
|
|
86
|
+
*/
|
|
87
|
+
assertFalse,
|
|
88
|
+
/**
|
|
89
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_instance_of.ts` instead.
|
|
90
|
+
*
|
|
91
|
+
* Make an assertion that `obj` is an instance of `type`.
|
|
92
|
+
* If not then throw.
|
|
93
|
+
*/
|
|
94
|
+
assertInstanceOf,
|
|
95
|
+
/** @deprecated (will be removed after 1.0.0) Import from `std/assert/assertion_error.ts` instead. */
|
|
96
|
+
AssertionError,
|
|
97
|
+
/**
|
|
98
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_is_error.ts` instead.
|
|
99
|
+
*
|
|
100
|
+
* Make an assertion that `error` is an `Error`.
|
|
101
|
+
* If not then an error will be thrown.
|
|
102
|
+
* An error class and a string that should be included in the
|
|
103
|
+
* error message can also be asserted.
|
|
104
|
+
*/
|
|
105
|
+
assertIsError,
|
|
106
|
+
/**
|
|
107
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_match.ts` instead.
|
|
108
|
+
*
|
|
109
|
+
* Make an assertion that `actual` match RegExp `expected`. If not
|
|
110
|
+
* then throw.
|
|
111
|
+
*/
|
|
112
|
+
assertMatch,
|
|
113
|
+
/**
|
|
114
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_not_equals.ts` instead.
|
|
115
|
+
*
|
|
116
|
+
* Make an assertion that `actual` and `expected` are not equal, deeply.
|
|
117
|
+
* If not then throw.
|
|
118
|
+
*
|
|
119
|
+
* Type parameter can be specified to ensure values under comparison have the same type.
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```ts
|
|
123
|
+
* import { assertNotEquals } from "https://deno.land/std@$STD_VERSION/testing/asserts.ts";
|
|
124
|
+
*
|
|
125
|
+
* assertNotEquals<number>(1, 2)
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
assertNotEquals,
|
|
129
|
+
/**
|
|
130
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_not_instance_of.ts` instead.
|
|
131
|
+
*
|
|
132
|
+
* Make an assertion that `obj` is not an instance of `type`.
|
|
133
|
+
* If so, then throw.
|
|
134
|
+
*/
|
|
135
|
+
assertNotInstanceOf,
|
|
136
|
+
/**
|
|
137
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_not_match.ts` instead.
|
|
138
|
+
*
|
|
139
|
+
* Make an assertion that `actual` object is a subset of `expected` object, deeply.
|
|
140
|
+
* If not, then throw.
|
|
141
|
+
*/
|
|
142
|
+
assertNotMatch,
|
|
143
|
+
/**
|
|
144
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_not_strict_equals.ts` instead.
|
|
145
|
+
*
|
|
146
|
+
* Make an assertion that `actual` and `expected` are not strictly equal.
|
|
147
|
+
* If the values are strictly equal then throw.
|
|
148
|
+
*
|
|
149
|
+
* ```ts
|
|
150
|
+
* import { assertNotStrictEquals } from "https://deno.land/std@$STD_VERSION/testing/asserts.ts";
|
|
151
|
+
*
|
|
152
|
+
* assertNotStrictEquals(1, 1)
|
|
153
|
+
* ```
|
|
154
|
+
*/
|
|
155
|
+
assertNotStrictEquals,
|
|
156
|
+
/**
|
|
157
|
+
* Make an assertion that `actual` object is a subset of `expected` object, deeply.
|
|
158
|
+
* If not, then throw.
|
|
159
|
+
*/
|
|
160
|
+
assertObjectMatch,
|
|
161
|
+
/**
|
|
162
|
+
* Executes a function which returns a promise, expecting it to reject.
|
|
163
|
+
* If it does not, then it throws. An error class and a string that should be
|
|
164
|
+
* included in the error message can also be asserted.
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```ts
|
|
168
|
+
* import { assertRejects } from "https://deno.land/std@$STD_VERSION/testing/asserts.ts";
|
|
169
|
+
*
|
|
170
|
+
* Deno.test("doesThrow", async function () {
|
|
171
|
+
* await assertRejects(async () => {
|
|
172
|
+
* throw new TypeError("hello world!");
|
|
173
|
+
* }, TypeError);
|
|
174
|
+
* await assertRejects(
|
|
175
|
+
* async () => {
|
|
176
|
+
* throw new TypeError("hello world!");
|
|
177
|
+
* },
|
|
178
|
+
* TypeError,
|
|
179
|
+
* "hello",
|
|
180
|
+
* );
|
|
181
|
+
* });
|
|
182
|
+
*
|
|
183
|
+
* // This test will not pass.
|
|
184
|
+
* Deno.test("fails", async function () {
|
|
185
|
+
* await assertRejects(
|
|
186
|
+
* async () => {
|
|
187
|
+
* console.log("Hello world");
|
|
188
|
+
* },
|
|
189
|
+
* );
|
|
190
|
+
* });
|
|
191
|
+
* ```
|
|
192
|
+
*
|
|
193
|
+
* * @example
|
|
194
|
+
* ```ts
|
|
195
|
+
* import { assertRejects } from "https://deno.land/std@$STD_VERSION/testing/asserts.ts";
|
|
196
|
+
*
|
|
197
|
+
* Deno.test("doesThrow", async function () {
|
|
198
|
+
* await assertRejects(
|
|
199
|
+
* async () => {
|
|
200
|
+
* throw new TypeError("hello world!");
|
|
201
|
+
* },
|
|
202
|
+
* );
|
|
203
|
+
* await assertRejects(
|
|
204
|
+
* async () => {
|
|
205
|
+
* return Promise.reject(new Error());
|
|
206
|
+
* },
|
|
207
|
+
* );
|
|
208
|
+
* });
|
|
209
|
+
*
|
|
210
|
+
* // This test will not pass.
|
|
211
|
+
* Deno.test("fails", async function () {
|
|
212
|
+
* await assertRejects(
|
|
213
|
+
* async () => {
|
|
214
|
+
* console.log("Hello world");
|
|
215
|
+
* },
|
|
216
|
+
* );
|
|
217
|
+
* });
|
|
218
|
+
* ```
|
|
219
|
+
*/
|
|
220
|
+
assertRejects,
|
|
221
|
+
/**
|
|
222
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_strict_equals.ts` instead.
|
|
223
|
+
*
|
|
224
|
+
* Make an assertion that `actual` and `expected` are strictly equal. If
|
|
225
|
+
* not then throw.
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* ```ts
|
|
229
|
+
* import { assertStrictEquals } from "https://deno.land/std@$STD_VERSION/testing/asserts.ts";
|
|
230
|
+
*
|
|
231
|
+
* Deno.test("isStrictlyEqual", function (): void {
|
|
232
|
+
* const a = {};
|
|
233
|
+
* const b = a;
|
|
234
|
+
* assertStrictEquals(a, b);
|
|
235
|
+
* });
|
|
236
|
+
*
|
|
237
|
+
* // This test fails
|
|
238
|
+
* Deno.test("isNotStrictlyEqual", function (): void {
|
|
239
|
+
* const a = {};
|
|
240
|
+
* const b = {};
|
|
241
|
+
* assertStrictEquals(a, b);
|
|
242
|
+
* });
|
|
243
|
+
* ```
|
|
244
|
+
*/
|
|
245
|
+
assertStrictEquals,
|
|
246
|
+
/**
|
|
247
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_string_includes.ts` instead.
|
|
248
|
+
*
|
|
249
|
+
* Make an assertion that actual includes expected. If not
|
|
250
|
+
* then throw.
|
|
251
|
+
*/
|
|
252
|
+
assertStringIncludes,
|
|
253
|
+
/**
|
|
254
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_throws.ts` instead.
|
|
255
|
+
*
|
|
256
|
+
* Executes a function, expecting it to throw. If it does not, then it
|
|
257
|
+
* throws. An error class and a string that should be included in the
|
|
258
|
+
* error message can also be asserted.
|
|
259
|
+
*
|
|
260
|
+
* @example
|
|
261
|
+
* ```ts
|
|
262
|
+
* import { assertThrows } from "https://deno.land/std@$STD_VERSION/testing/asserts.ts";
|
|
263
|
+
*
|
|
264
|
+
* Deno.test("doesThrow", function (): void {
|
|
265
|
+
* assertThrows((): void => {
|
|
266
|
+
* throw new TypeError("hello world!");
|
|
267
|
+
* }, TypeError);
|
|
268
|
+
* assertThrows(
|
|
269
|
+
* (): void => {
|
|
270
|
+
* throw new TypeError("hello world!");
|
|
271
|
+
* },
|
|
272
|
+
* TypeError,
|
|
273
|
+
* "hello",
|
|
274
|
+
* );
|
|
275
|
+
* });
|
|
276
|
+
*
|
|
277
|
+
* // This test will not pass.
|
|
278
|
+
* Deno.test("fails", function (): void {
|
|
279
|
+
* assertThrows((): void => {
|
|
280
|
+
* console.log("Hello world");
|
|
281
|
+
* });
|
|
282
|
+
* });
|
|
283
|
+
* ```
|
|
284
|
+
*
|
|
285
|
+
* @example
|
|
286
|
+
* ```ts
|
|
287
|
+
* import { assertThrows } from "https://deno.land/std@$STD_VERSION/testing/asserts.ts";
|
|
288
|
+
*
|
|
289
|
+
* Deno.test("doesThrow", function (): void {
|
|
290
|
+
* assertThrows((): void => {
|
|
291
|
+
* throw new TypeError("hello world!");
|
|
292
|
+
* });
|
|
293
|
+
* });
|
|
294
|
+
*
|
|
295
|
+
* // This test will not pass.
|
|
296
|
+
* Deno.test("fails", function (): void {
|
|
297
|
+
* assertThrows((): void => {
|
|
298
|
+
* console.log("Hello world");
|
|
299
|
+
* });
|
|
300
|
+
* });
|
|
301
|
+
* ```
|
|
302
|
+
*/
|
|
303
|
+
assertThrows,
|
|
304
|
+
/**
|
|
305
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/equal.ts` instead.
|
|
306
|
+
*
|
|
307
|
+
* Deep equality comparison used in assertions
|
|
308
|
+
* @param c actual value
|
|
309
|
+
* @param d expected value
|
|
310
|
+
*/
|
|
311
|
+
equal,
|
|
312
|
+
/**
|
|
313
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/fail.ts` instead.
|
|
314
|
+
*
|
|
315
|
+
* Forcefully throws a failed assertion
|
|
316
|
+
*/
|
|
317
|
+
fail,
|
|
318
|
+
/**
|
|
319
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/unimplemented.ts` instead.
|
|
320
|
+
*
|
|
321
|
+
* Use this to stub out methods that will throw when invoked.
|
|
322
|
+
*/
|
|
323
|
+
unimplemented,
|
|
324
|
+
/**
|
|
325
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/unreachable.ts` instead.
|
|
326
|
+
*
|
|
327
|
+
* Use this to assert unreachable code.
|
|
328
|
+
*/
|
|
329
|
+
unreachable, } from "../assert/mod.js";
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/asserts` instead.
|
|
4
|
+
*
|
|
5
|
+
* A library of assertion functions.
|
|
6
|
+
* If the assertion is false an `AssertionError` will be thrown which will
|
|
7
|
+
* result in pretty-printed diff of failing assertion.
|
|
8
|
+
*
|
|
9
|
+
* This module is browser compatible, but do not rely on good formatting of
|
|
10
|
+
* values for AssertionError messages in browsers.
|
|
11
|
+
*
|
|
12
|
+
* @module
|
|
13
|
+
*/
|
|
14
|
+
export {
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/assert.ts` instead.
|
|
17
|
+
*
|
|
18
|
+
* Make an assertion, error will be thrown if `expr` does not have truthy value.
|
|
19
|
+
*/
|
|
20
|
+
assert,
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_almost_equals.ts` instead.
|
|
23
|
+
*
|
|
24
|
+
* Make an assertion that `actual` and `expected` are almost equal numbers through
|
|
25
|
+
* a given tolerance. It can be used to take into account IEEE-754 double-precision
|
|
26
|
+
* floating-point representation limitations.
|
|
27
|
+
* If the values are not almost equal then throw.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* import { assertAlmostEquals, assertThrows } from "https://deno.land/std@$STD_VERSION/testing/asserts.ts";
|
|
32
|
+
*
|
|
33
|
+
* assertAlmostEquals(0.1, 0.2);
|
|
34
|
+
*
|
|
35
|
+
* // Using a custom tolerance value
|
|
36
|
+
* assertAlmostEquals(0.1 + 0.2, 0.3, 1e-16);
|
|
37
|
+
* assertThrows(() => assertAlmostEquals(0.1 + 0.2, 0.3, 1e-17));
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
assertAlmostEquals,
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_array_includes.ts` instead.
|
|
43
|
+
*
|
|
44
|
+
* Make an assertion that `actual` includes the `expected` values.
|
|
45
|
+
* If not then an error will be thrown.
|
|
46
|
+
*
|
|
47
|
+
* Type parameter can be specified to ensure values under comparison have the same type.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* import { assertArrayIncludes } from "https://deno.land/std@$STD_VERSION/testing/asserts.ts";
|
|
52
|
+
*
|
|
53
|
+
* assertArrayIncludes<number>([1, 2], [2])
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
assertArrayIncludes,
|
|
57
|
+
/**
|
|
58
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_equals.ts` instead.
|
|
59
|
+
*
|
|
60
|
+
* Make an assertion that `actual` and `expected` are equal, deeply. If not
|
|
61
|
+
* deeply equal, then throw.
|
|
62
|
+
*
|
|
63
|
+
* Type parameter can be specified to ensure values under comparison have the same type.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* import { assertEquals } from "https://deno.land/std@$STD_VERSION/testing/asserts.ts";
|
|
68
|
+
*
|
|
69
|
+
* Deno.test("example", function (): void {
|
|
70
|
+
* assertEquals("world", "world");
|
|
71
|
+
* assertEquals({ hello: "world" }, { hello: "world" });
|
|
72
|
+
* });
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
assertEquals,
|
|
76
|
+
/**
|
|
77
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_exists.ts` instead.
|
|
78
|
+
*
|
|
79
|
+
* Make an assertion that actual is not null or undefined.
|
|
80
|
+
* If not then throw.
|
|
81
|
+
*/
|
|
82
|
+
assertExists,
|
|
83
|
+
/**
|
|
84
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_false.ts` instead.
|
|
85
|
+
*
|
|
86
|
+
* Make an assertion, error will be thrown if `expr` have truthy value.
|
|
87
|
+
*/
|
|
88
|
+
assertFalse,
|
|
89
|
+
/**
|
|
90
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_instance_of.ts` instead.
|
|
91
|
+
*
|
|
92
|
+
* Make an assertion that `obj` is an instance of `type`.
|
|
93
|
+
* If not then throw.
|
|
94
|
+
*/
|
|
95
|
+
assertInstanceOf,
|
|
96
|
+
/** @deprecated (will be removed after 1.0.0) Import from `std/assert/assertion_error.ts` instead. */
|
|
97
|
+
AssertionError,
|
|
98
|
+
/**
|
|
99
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_is_error.ts` instead.
|
|
100
|
+
*
|
|
101
|
+
* Make an assertion that `error` is an `Error`.
|
|
102
|
+
* If not then an error will be thrown.
|
|
103
|
+
* An error class and a string that should be included in the
|
|
104
|
+
* error message can also be asserted.
|
|
105
|
+
*/
|
|
106
|
+
assertIsError,
|
|
107
|
+
/**
|
|
108
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_match.ts` instead.
|
|
109
|
+
*
|
|
110
|
+
* Make an assertion that `actual` match RegExp `expected`. If not
|
|
111
|
+
* then throw.
|
|
112
|
+
*/
|
|
113
|
+
assertMatch,
|
|
114
|
+
/**
|
|
115
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_not_equals.ts` instead.
|
|
116
|
+
*
|
|
117
|
+
* Make an assertion that `actual` and `expected` are not equal, deeply.
|
|
118
|
+
* If not then throw.
|
|
119
|
+
*
|
|
120
|
+
* Type parameter can be specified to ensure values under comparison have the same type.
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* ```ts
|
|
124
|
+
* import { assertNotEquals } from "https://deno.land/std@$STD_VERSION/testing/asserts.ts";
|
|
125
|
+
*
|
|
126
|
+
* assertNotEquals<number>(1, 2)
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
assertNotEquals,
|
|
130
|
+
/**
|
|
131
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_not_instance_of.ts` instead.
|
|
132
|
+
*
|
|
133
|
+
* Make an assertion that `obj` is not an instance of `type`.
|
|
134
|
+
* If so, then throw.
|
|
135
|
+
*/
|
|
136
|
+
assertNotInstanceOf,
|
|
137
|
+
/**
|
|
138
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_not_match.ts` instead.
|
|
139
|
+
*
|
|
140
|
+
* Make an assertion that `actual` object is a subset of `expected` object, deeply.
|
|
141
|
+
* If not, then throw.
|
|
142
|
+
*/
|
|
143
|
+
assertNotMatch,
|
|
144
|
+
/**
|
|
145
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_not_strict_equals.ts` instead.
|
|
146
|
+
*
|
|
147
|
+
* Make an assertion that `actual` and `expected` are not strictly equal.
|
|
148
|
+
* If the values are strictly equal then throw.
|
|
149
|
+
*
|
|
150
|
+
* ```ts
|
|
151
|
+
* import { assertNotStrictEquals } from "https://deno.land/std@$STD_VERSION/testing/asserts.ts";
|
|
152
|
+
*
|
|
153
|
+
* assertNotStrictEquals(1, 1)
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
156
|
+
assertNotStrictEquals,
|
|
157
|
+
/**
|
|
158
|
+
* Make an assertion that `actual` object is a subset of `expected` object, deeply.
|
|
159
|
+
* If not, then throw.
|
|
160
|
+
*/
|
|
161
|
+
assertObjectMatch,
|
|
162
|
+
/**
|
|
163
|
+
* Executes a function which returns a promise, expecting it to reject.
|
|
164
|
+
* If it does not, then it throws. An error class and a string that should be
|
|
165
|
+
* included in the error message can also be asserted.
|
|
166
|
+
*
|
|
167
|
+
* @example
|
|
168
|
+
* ```ts
|
|
169
|
+
* import { assertRejects } from "https://deno.land/std@$STD_VERSION/testing/asserts.ts";
|
|
170
|
+
*
|
|
171
|
+
* Deno.test("doesThrow", async function () {
|
|
172
|
+
* await assertRejects(async () => {
|
|
173
|
+
* throw new TypeError("hello world!");
|
|
174
|
+
* }, TypeError);
|
|
175
|
+
* await assertRejects(
|
|
176
|
+
* async () => {
|
|
177
|
+
* throw new TypeError("hello world!");
|
|
178
|
+
* },
|
|
179
|
+
* TypeError,
|
|
180
|
+
* "hello",
|
|
181
|
+
* );
|
|
182
|
+
* });
|
|
183
|
+
*
|
|
184
|
+
* // This test will not pass.
|
|
185
|
+
* Deno.test("fails", async function () {
|
|
186
|
+
* await assertRejects(
|
|
187
|
+
* async () => {
|
|
188
|
+
* console.log("Hello world");
|
|
189
|
+
* },
|
|
190
|
+
* );
|
|
191
|
+
* });
|
|
192
|
+
* ```
|
|
193
|
+
*
|
|
194
|
+
* * @example
|
|
195
|
+
* ```ts
|
|
196
|
+
* import { assertRejects } from "https://deno.land/std@$STD_VERSION/testing/asserts.ts";
|
|
197
|
+
*
|
|
198
|
+
* Deno.test("doesThrow", async function () {
|
|
199
|
+
* await assertRejects(
|
|
200
|
+
* async () => {
|
|
201
|
+
* throw new TypeError("hello world!");
|
|
202
|
+
* },
|
|
203
|
+
* );
|
|
204
|
+
* await assertRejects(
|
|
205
|
+
* async () => {
|
|
206
|
+
* return Promise.reject(new Error());
|
|
207
|
+
* },
|
|
208
|
+
* );
|
|
209
|
+
* });
|
|
210
|
+
*
|
|
211
|
+
* // This test will not pass.
|
|
212
|
+
* Deno.test("fails", async function () {
|
|
213
|
+
* await assertRejects(
|
|
214
|
+
* async () => {
|
|
215
|
+
* console.log("Hello world");
|
|
216
|
+
* },
|
|
217
|
+
* );
|
|
218
|
+
* });
|
|
219
|
+
* ```
|
|
220
|
+
*/
|
|
221
|
+
assertRejects,
|
|
222
|
+
/**
|
|
223
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_strict_equals.ts` instead.
|
|
224
|
+
*
|
|
225
|
+
* Make an assertion that `actual` and `expected` are strictly equal. If
|
|
226
|
+
* not then throw.
|
|
227
|
+
*
|
|
228
|
+
* @example
|
|
229
|
+
* ```ts
|
|
230
|
+
* import { assertStrictEquals } from "https://deno.land/std@$STD_VERSION/testing/asserts.ts";
|
|
231
|
+
*
|
|
232
|
+
* Deno.test("isStrictlyEqual", function (): void {
|
|
233
|
+
* const a = {};
|
|
234
|
+
* const b = a;
|
|
235
|
+
* assertStrictEquals(a, b);
|
|
236
|
+
* });
|
|
237
|
+
*
|
|
238
|
+
* // This test fails
|
|
239
|
+
* Deno.test("isNotStrictlyEqual", function (): void {
|
|
240
|
+
* const a = {};
|
|
241
|
+
* const b = {};
|
|
242
|
+
* assertStrictEquals(a, b);
|
|
243
|
+
* });
|
|
244
|
+
* ```
|
|
245
|
+
*/
|
|
246
|
+
assertStrictEquals,
|
|
247
|
+
/**
|
|
248
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_string_includes.ts` instead.
|
|
249
|
+
*
|
|
250
|
+
* Make an assertion that actual includes expected. If not
|
|
251
|
+
* then throw.
|
|
252
|
+
*/
|
|
253
|
+
assertStringIncludes,
|
|
254
|
+
/**
|
|
255
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_throws.ts` instead.
|
|
256
|
+
*
|
|
257
|
+
* Executes a function, expecting it to throw. If it does not, then it
|
|
258
|
+
* throws. An error class and a string that should be included in the
|
|
259
|
+
* error message can also be asserted.
|
|
260
|
+
*
|
|
261
|
+
* @example
|
|
262
|
+
* ```ts
|
|
263
|
+
* import { assertThrows } from "https://deno.land/std@$STD_VERSION/testing/asserts.ts";
|
|
264
|
+
*
|
|
265
|
+
* Deno.test("doesThrow", function (): void {
|
|
266
|
+
* assertThrows((): void => {
|
|
267
|
+
* throw new TypeError("hello world!");
|
|
268
|
+
* }, TypeError);
|
|
269
|
+
* assertThrows(
|
|
270
|
+
* (): void => {
|
|
271
|
+
* throw new TypeError("hello world!");
|
|
272
|
+
* },
|
|
273
|
+
* TypeError,
|
|
274
|
+
* "hello",
|
|
275
|
+
* );
|
|
276
|
+
* });
|
|
277
|
+
*
|
|
278
|
+
* // This test will not pass.
|
|
279
|
+
* Deno.test("fails", function (): void {
|
|
280
|
+
* assertThrows((): void => {
|
|
281
|
+
* console.log("Hello world");
|
|
282
|
+
* });
|
|
283
|
+
* });
|
|
284
|
+
* ```
|
|
285
|
+
*
|
|
286
|
+
* @example
|
|
287
|
+
* ```ts
|
|
288
|
+
* import { assertThrows } from "https://deno.land/std@$STD_VERSION/testing/asserts.ts";
|
|
289
|
+
*
|
|
290
|
+
* Deno.test("doesThrow", function (): void {
|
|
291
|
+
* assertThrows((): void => {
|
|
292
|
+
* throw new TypeError("hello world!");
|
|
293
|
+
* });
|
|
294
|
+
* });
|
|
295
|
+
*
|
|
296
|
+
* // This test will not pass.
|
|
297
|
+
* Deno.test("fails", function (): void {
|
|
298
|
+
* assertThrows((): void => {
|
|
299
|
+
* console.log("Hello world");
|
|
300
|
+
* });
|
|
301
|
+
* });
|
|
302
|
+
* ```
|
|
303
|
+
*/
|
|
304
|
+
assertThrows,
|
|
305
|
+
/**
|
|
306
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/equal.ts` instead.
|
|
307
|
+
*
|
|
308
|
+
* Deep equality comparison used in assertions
|
|
309
|
+
* @param c actual value
|
|
310
|
+
* @param d expected value
|
|
311
|
+
*/
|
|
312
|
+
equal,
|
|
313
|
+
/**
|
|
314
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/fail.ts` instead.
|
|
315
|
+
*
|
|
316
|
+
* Forcefully throws a failed assertion
|
|
317
|
+
*/
|
|
318
|
+
fail,
|
|
319
|
+
/**
|
|
320
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/unimplemented.ts` instead.
|
|
321
|
+
*
|
|
322
|
+
* Use this to stub out methods that will throw when invoked.
|
|
323
|
+
*/
|
|
324
|
+
unimplemented,
|
|
325
|
+
/**
|
|
326
|
+
* @deprecated (will be removed after 1.0.0) Import from `std/assert/unreachable.ts` instead.
|
|
327
|
+
*
|
|
328
|
+
* Use this to assert unreachable code.
|
|
329
|
+
*/
|
|
330
|
+
unreachable, } from "../assert/mod.js";
|