@camperaid/watest 2.4.7 → 2.4.9
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/.prettierrc.js +1 -3
- package/.watestrc.js +7 -3
- package/bin/watest.js +3 -8
- package/core/base.js +83 -69
- package/core/core.js +25 -46
- package/core/format.js +96 -56
- package/core/process_args.js +1 -5
- package/core/series.js +62 -57
- package/core/settings.js +32 -32
- package/core/spawn.js +14 -21
- package/core/util.js +12 -19
- package/esling.config.js +0 -0
- package/eslint.config.js +27 -0
- package/index.js +11 -17
- package/interfaces/logger.js +1 -3
- package/interfaces/servicer.js +1 -3
- package/logging/filestream.js +3 -7
- package/logging/logging.js +5 -11
- package/logging/logpipe.js +21 -21
- package/package.json +12 -11
- package/tests/base/t_api.js +3 -6
- package/tests/base/t_contains.js +12 -12
- package/tests/base/t_core.js +11 -8
- package/tests/base/t_format.js +13 -14
- package/tests/base/t_is.js +9 -11
- package/tests/base/t_is_object.js +23 -25
- package/tests/base/t_is_primitive.js +12 -14
- package/tests/base/t_is_string.js +6 -8
- package/tests/base/t_ok.js +4 -6
- package/tests/base/t_stringify.js +6 -8
- package/tests/base/t_test_.js +3 -5
- package/tests/base/t_throws.js +82 -18
- package/tests/base/test.js +14 -21
- package/tests/e2e/samples/{loader/.watestrc.cjs → folder/.watestrc.js} +1 -1
- package/tests/e2e/samples/folder/package-lock.json +1019 -5940
- package/tests/e2e/samples/folder/package.json +3 -2
- package/tests/e2e/samples/folder/tests/meta.js +1 -1
- package/tests/e2e/samples/folder/tests/unit/t_test.js +3 -3
- package/tests/e2e/samples/{loader_mixed/.watestrc.cjs → loader/.watestrc.js} +1 -1
- package/tests/e2e/samples/loader/package-lock.json +1751 -28
- package/tests/e2e/samples/loader/package.json +2 -2
- package/tests/e2e/samples/loader/tests/meta.js +2 -2
- package/tests/e2e/samples/{folder/.watestrc.cjs → loader_mixed/.watestrc.js} +1 -1
- package/tests/e2e/samples/loader_mixed/package-lock.json +1751 -28
- package/tests/e2e/samples/loader_mixed/tests/ui/meta.js +2 -2
- package/tests/e2e/samples/loader_multiple/{.watestrc.cjs → .watestrc.js} +1 -1
- package/tests/e2e/samples/loader_multiple/package-lock.json +1751 -28
- package/tests/e2e/samples/loader_multiple/package.json +2 -2
- package/tests/e2e/samples/loader_multiple/tests/base/meta.js +2 -2
- package/tests/e2e/samples/loader_multiple/tests/core/meta.js +2 -2
- package/tests/e2e/samples/single/.watestrc.js +5 -0
- package/tests/e2e/samples/single/package-lock.json +1017 -5938
- package/tests/e2e/samples/single/package.json +5 -2
- package/tests/e2e/samples/wd_mixed/{.watestrc.cjs → .watestrc.js} +1 -1
- package/tests/e2e/samples/wd_mixed/package-lock.json +779 -4862
- package/tests/e2e/samples/wd_mixed/package.json +2 -2
- package/tests/e2e/samples/wd_single/{.watestrc.cjs → .watestrc.js} +1 -1
- package/tests/e2e/samples/wd_single/package-lock.json +779 -4862
- package/tests/e2e/samples/wd_single/package.json +2 -2
- package/tests/e2e/t_folder.js +4 -6
- package/tests/e2e/t_loader.js +4 -6
- package/tests/e2e/t_loader_mixed.js +4 -6
- package/tests/e2e/t_loader_multiple.js +4 -6
- package/tests/e2e/t_loader_multiple_patterns.js +4 -6
- package/tests/e2e/t_single.js +4 -6
- package/tests/e2e/t_wd_firefox.js +4 -6
- package/tests/e2e/t_wd_firefox_chrome.js +4 -6
- package/tests/e2e/t_wd_firefox_chrome_pattern.js +4 -6
- package/tests/e2e/t_wd_mixed_firefox.js +4 -6
- package/tests/e2e/t_wd_mixed_firefox_chrome.js +4 -6
- package/tests/e2e/test.js +15 -16
- package/tests/meta.js +1 -3
- package/tests/series/build/t_adjust_names.js +4 -6
- package/tests/series/build/t_adjust_names_webdriver.js +6 -10
- package/tests/series/build/t_expected_failures.js +4 -6
- package/tests/series/build/t_loader.js +4 -6
- package/tests/series/build/t_loader_mixed.js +4 -6
- package/tests/series/build/t_mixed.js +4 -6
- package/tests/series/build/t_nested.js +4 -6
- package/tests/series/build/t_patterns_loader.js +4 -6
- package/tests/series/build/t_patterns_webdriver.js +4 -6
- package/tests/series/build/t_webdriver.js +4 -6
- package/tests/series/build/t_webdriver_firefox_mixed.js +4 -6
- package/tests/series/build/t_webdriver_nested.js +4 -6
- package/tests/series/build/t_webdriver_services.js +4 -6
- package/tests/series/generic/t_failures_info.js +9 -12
- package/tests/series/loader/meta.mjs +2 -2
- package/tests/series/logging/t_failures.js +18 -20
- package/tests/series/logging/t_success.js +15 -17
- package/tests/series/logging/t_verify.js +17 -14
- package/tests/series/meta.js +1 -3
- package/tests/series/mock_series.js +7 -13
- package/tests/series/perform/t_failure.js +4 -6
- package/tests/series/perform/t_failure_notest.js +4 -6
- package/tests/series/perform/t_intermittent.js +5 -7
- package/tests/series/perform/t_intermittent_global.js +4 -6
- package/tests/series/perform/t_missing_perma.js +5 -7
- package/tests/series/perform/t_nested.js +4 -10
- package/tests/series/perform/t_perma.js +4 -6
- package/tests/series/perform/t_success.js +5 -11
- package/tests/series/run/t_debunk_failure.js +7 -6
- package/tests/series/run/t_debunk_success.js +7 -6
- package/tests/series/run/t_nested.js +7 -6
- package/tests/series/run/t_verify.js +7 -6
- package/tests/series/run/t_verify_webdriver.js +7 -6
- package/tests/series/test.js +29 -40
- package/tests/webdriver/meta.js +1 -3
- package/tests/webdriver/t_app_driver.js +3 -5
- package/tests/webdriver/t_app_driver_selectors.js +3 -5
- package/tests/webdriver/t_attribute.js +5 -7
- package/tests/webdriver/t_attribute_all.js +6 -8
- package/tests/webdriver/t_doubleclick.js +3 -5
- package/tests/webdriver/t_doubleclickat.js +3 -5
- package/tests/webdriver/t_execute.js +4 -6
- package/tests/webdriver/t_if_has_elements.js +6 -8
- package/tests/webdriver/t_if_no_elements.js +6 -8
- package/tests/webdriver/t_no_elements_or_not_visible.js +7 -9
- package/tests/webdriver/t_properties.js +11 -13
- package/tests/webdriver/t_script.js +8 -10
- package/tests/webdriver/t_select_all.js +6 -11
- package/tests/webdriver/t_selection.js +4 -6
- package/tests/webdriver/t_text.js +12 -14
- package/tests/webdriver/t_text_all.js +6 -8
- package/tests/webdriver/test.js +32 -41
- package/webdriver/app_driver.js +28 -19
- package/webdriver/control_driver.js +4 -8
- package/webdriver/driver.js +64 -63
- package/webdriver/driver_base.js +52 -62
- package/webdriver/session.js +6 -11
- package/webdriver/util.js +7 -8
- package/.eslintrc.js +0 -45
- package/index.mjs +0 -5
- package/tests/e2e/samples/folder/node_modules/.package-lock.json +0 -3871
- package/tests/e2e/samples/loader/node_modules/.package-lock.json +0 -36
- package/tests/e2e/samples/loader_mixed/node_modules/.package-lock.json +0 -36
- package/tests/e2e/samples/loader_multiple/node_modules/.package-lock.json +0 -36
- package/tests/e2e/samples/single/.watestrc.cjs +0 -5
- package/tests/e2e/samples/single/node_modules/.package-lock.json +0 -3871
- package/tests/e2e/samples/wd_mixed/node_modules/.package-lock.json +0 -3586
- package/tests/e2e/samples/wd_single/node_modules/.package-lock.json +0 -3586
package/tests/base/t_is.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import { is, is_output } from './test.js';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
module.exports.test = async () => {
|
|
3
|
+
export async function test() {
|
|
6
4
|
// is() sucess
|
|
7
5
|
await is_output(
|
|
8
6
|
() => is(3, 3, `Equal`),
|
|
9
7
|
[`Ok: Equal, got: 3`],
|
|
10
8
|
[],
|
|
11
|
-
`is() sucess
|
|
9
|
+
`is() sucess`,
|
|
12
10
|
);
|
|
13
11
|
|
|
14
12
|
// is() failure
|
|
@@ -16,7 +14,7 @@ module.exports.test = async () => {
|
|
|
16
14
|
() => is(3, 4, `Not equal`),
|
|
17
15
|
[],
|
|
18
16
|
[`Failed: Not equal, got: 3, expected: 4`],
|
|
19
|
-
`is() failure
|
|
17
|
+
`is() failure`,
|
|
20
18
|
);
|
|
21
19
|
|
|
22
20
|
// is() regexp sucess
|
|
@@ -24,7 +22,7 @@ module.exports.test = async () => {
|
|
|
24
22
|
() => is('34', /^\d+$/, `Equal`),
|
|
25
23
|
[`Ok: Equal '34' matches /^\\d+$/ regexp`],
|
|
26
24
|
[],
|
|
27
|
-
`is() regexp sucess
|
|
25
|
+
`is() regexp sucess`,
|
|
28
26
|
);
|
|
29
27
|
|
|
30
28
|
// is() regexp failure
|
|
@@ -32,7 +30,7 @@ module.exports.test = async () => {
|
|
|
32
30
|
() => is('34a', /^\d+$/, `Equal`),
|
|
33
31
|
[],
|
|
34
32
|
[`Failed: Equal '34a' doesn't match /^\\d+$/ regexp`],
|
|
35
|
-
`is() regexp failure
|
|
33
|
+
`is() regexp failure`,
|
|
36
34
|
);
|
|
37
35
|
|
|
38
36
|
// is() object sucess
|
|
@@ -40,7 +38,7 @@ module.exports.test = async () => {
|
|
|
40
38
|
() => is({ field: 'hey' }, { field: 'hey' }, `Objects equal`),
|
|
41
39
|
[`Ok: Objects equal, got: {field: 'hey'}`],
|
|
42
40
|
[],
|
|
43
|
-
`is() object sucess
|
|
41
|
+
`is() object sucess`,
|
|
44
42
|
);
|
|
45
43
|
|
|
46
44
|
// is() object failure
|
|
@@ -51,6 +49,6 @@ module.exports.test = async () => {
|
|
|
51
49
|
`Failed: Objects not equal: 'field' field value mismatch;\ngot:\nhey\nexpected:\npey\nunexpected character: 'h' at 0 pos, expected: 'p' at '' line`,
|
|
52
50
|
`Failed: Objects not equal`,
|
|
53
51
|
],
|
|
54
|
-
`is() object failure
|
|
52
|
+
`is() object failure`,
|
|
55
53
|
);
|
|
56
|
-
}
|
|
54
|
+
}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import { is_output, is_object } from './test.js';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
module.exports.test = async () => {
|
|
3
|
+
export async function test() {
|
|
6
4
|
// sucess
|
|
7
5
|
await is_output(
|
|
8
6
|
() => is_object({ field: 'hey' }, { field: 'hey' }, 'TstMsg'),
|
|
9
7
|
[`Ok: TstMsg, got: {field: 'hey'}\n`],
|
|
10
8
|
[],
|
|
11
|
-
`sucess
|
|
9
|
+
`sucess`,
|
|
12
10
|
);
|
|
13
11
|
|
|
14
12
|
// types: Set
|
|
@@ -16,7 +14,7 @@ module.exports.test = async () => {
|
|
|
16
14
|
() => is_object(new Set(['v1', 'v2']), ['v1', 'v2'], 'TstMsg'),
|
|
17
15
|
[`Ok: TstMsg, got: Set['v1', 'v2']`],
|
|
18
16
|
[],
|
|
19
|
-
`types: Set
|
|
17
|
+
`types: Set`,
|
|
20
18
|
);
|
|
21
19
|
|
|
22
20
|
// types: Map
|
|
@@ -24,7 +22,7 @@ module.exports.test = async () => {
|
|
|
24
22
|
() => is_object(new Map([['key', 'val']]), [['key', 'val']], 'TstMsg'),
|
|
25
23
|
[`Ok: TstMsg, got: Map{key: 'val'}`],
|
|
26
24
|
[],
|
|
27
|
-
`types: Map
|
|
25
|
+
`types: Map`,
|
|
28
26
|
);
|
|
29
27
|
|
|
30
28
|
// types: Date success
|
|
@@ -32,7 +30,7 @@ module.exports.test = async () => {
|
|
|
32
30
|
() => is_object(new Date('2022-01-01'), new Date('2022-01-01'), 'TstMsg'),
|
|
33
31
|
[`Ok: TstMsg, got: 2022-01-01T00:00:00.000Z`],
|
|
34
32
|
[],
|
|
35
|
-
`types: Date sucess
|
|
33
|
+
`types: Date sucess`,
|
|
36
34
|
);
|
|
37
35
|
|
|
38
36
|
// types: Date failure
|
|
@@ -43,7 +41,7 @@ module.exports.test = async () => {
|
|
|
43
41
|
`Failed: TstMsg: unexpected value: 2022-01-01T00:00:00.000Z, expected: 2023-02-02T00:00:00.000Z`,
|
|
44
42
|
`Failed: TstMsg`,
|
|
45
43
|
],
|
|
46
|
-
`types: Date failure
|
|
44
|
+
`types: Date failure`,
|
|
47
45
|
);
|
|
48
46
|
|
|
49
47
|
// function sucess
|
|
@@ -51,7 +49,7 @@ module.exports.test = async () => {
|
|
|
51
49
|
() => is_object({ field: 'hey' }, () => true, 'TstMsg'),
|
|
52
50
|
[`Ok: TstMsg, got: {field: 'hey'}`],
|
|
53
51
|
[],
|
|
54
|
-
`function sucess
|
|
52
|
+
`function sucess`,
|
|
55
53
|
);
|
|
56
54
|
|
|
57
55
|
// function failure
|
|
@@ -62,7 +60,7 @@ module.exports.test = async () => {
|
|
|
62
60
|
`Failed: TstMsg: unexpected value: {field: 'hey'}, expected: () => false`,
|
|
63
61
|
`Failed: TstMsg`,
|
|
64
62
|
],
|
|
65
|
-
`function failure
|
|
63
|
+
`function failure`,
|
|
66
64
|
);
|
|
67
65
|
|
|
68
66
|
// failure: type mismatch
|
|
@@ -73,7 +71,7 @@ module.exports.test = async () => {
|
|
|
73
71
|
`Failed: TstMsg: 'key' field type mismatch, got type: number, expected type: string, got value: 3, expected value: '3'`,
|
|
74
72
|
`Failed: TstMsg`,
|
|
75
73
|
],
|
|
76
|
-
`failure: type mismatch
|
|
74
|
+
`failure: type mismatch`,
|
|
77
75
|
);
|
|
78
76
|
|
|
79
77
|
// failure: class mismatch
|
|
@@ -84,7 +82,7 @@ module.exports.test = async () => {
|
|
|
84
82
|
`Failed: TstMsg: class mismatch, got: Array, expected: Map`,
|
|
85
83
|
`Failed: TstMsg`,
|
|
86
84
|
],
|
|
87
|
-
`failure: class mismatch, expected of a different class
|
|
85
|
+
`failure: class mismatch, expected of a different class`,
|
|
88
86
|
);
|
|
89
87
|
|
|
90
88
|
// failure: class mismatch
|
|
@@ -95,7 +93,7 @@ module.exports.test = async () => {
|
|
|
95
93
|
`Failed: TstMsg: class mismatch, got: Set, expected: Map`,
|
|
96
94
|
`Failed: TstMsg`,
|
|
97
95
|
],
|
|
98
|
-
`failure: class mismatch, |expected| and |got| belong to different classes
|
|
96
|
+
`failure: class mismatch, |expected| and |got| belong to different classes`,
|
|
99
97
|
);
|
|
100
98
|
|
|
101
99
|
// success: class mismatch but |expected| is a generic Object
|
|
@@ -109,7 +107,7 @@ module.exports.test = async () => {
|
|
|
109
107
|
() => is_object(new A(), { name: 'name' }, 'TstMsg'),
|
|
110
108
|
[`Ok: TstMsg, got: {name: 'name'}`],
|
|
111
109
|
[],
|
|
112
|
-
`success: class mismatch but |expected| is a generic Object
|
|
110
|
+
`success: class mismatch but |expected| is a generic Object`,
|
|
113
111
|
);
|
|
114
112
|
|
|
115
113
|
// failure: value mismatch
|
|
@@ -120,7 +118,7 @@ module.exports.test = async () => {
|
|
|
120
118
|
`Failed: TstMsg: class mismatch, got: Object, expected: null`,
|
|
121
119
|
`Failed: TstMsg`,
|
|
122
120
|
],
|
|
123
|
-
`failure: class mismatch (null) #2
|
|
121
|
+
`failure: class mismatch (null) #2`,
|
|
124
122
|
);
|
|
125
123
|
|
|
126
124
|
// failure: value mismatch
|
|
@@ -131,7 +129,7 @@ module.exports.test = async () => {
|
|
|
131
129
|
`Failed: TstMsg: 'field' field value mismatch;\ngot:\nhey\nexpected:\npey\nunexpected character: 'h' at 0 pos, expected: 'p' at '' line`,
|
|
132
130
|
`Failed: TstMsg`,
|
|
133
131
|
],
|
|
134
|
-
`failure: value mismatch (strings)
|
|
132
|
+
`failure: value mismatch (strings)`,
|
|
135
133
|
);
|
|
136
134
|
|
|
137
135
|
// failure: not enumerable property value mismatch
|
|
@@ -144,14 +142,14 @@ module.exports.test = async () => {
|
|
|
144
142
|
}
|
|
145
143
|
})(),
|
|
146
144
|
{ field: 'pey' },
|
|
147
|
-
'TstMsg'
|
|
145
|
+
'TstMsg',
|
|
148
146
|
),
|
|
149
147
|
[],
|
|
150
148
|
[
|
|
151
149
|
`Failed: TstMsg: 'field' field value mismatch;\ngot:\nhey\nexpected:\npey\nunexpected character: 'h' at 0 pos, expected: 'p' at '' line`,
|
|
152
150
|
`Failed: TstMsg`,
|
|
153
151
|
],
|
|
154
|
-
`failure: not enumerable property value mismatch
|
|
152
|
+
`failure: not enumerable property value mismatch`,
|
|
155
153
|
);
|
|
156
154
|
|
|
157
155
|
// failure: primitive
|
|
@@ -159,7 +157,7 @@ module.exports.test = async () => {
|
|
|
159
157
|
() => is_object(null, {}, 'TstMsg'),
|
|
160
158
|
[],
|
|
161
159
|
[`Failed: TstMsg, got: null, expected: [object Object]`],
|
|
162
|
-
`failure: value mismatch (null)
|
|
160
|
+
`failure: value mismatch (null)`,
|
|
163
161
|
);
|
|
164
162
|
|
|
165
163
|
// failure: field was not expected
|
|
@@ -175,7 +173,7 @@ module.exports.test = async () => {
|
|
|
175
173
|
{
|
|
176
174
|
f2: {},
|
|
177
175
|
},
|
|
178
|
-
'TstMsg'
|
|
176
|
+
'TstMsg',
|
|
179
177
|
),
|
|
180
178
|
[],
|
|
181
179
|
[
|
|
@@ -183,7 +181,7 @@ module.exports.test = async () => {
|
|
|
183
181
|
`Failed: TstMsg: 'f2->f21' field was not expected, got: 'f21'`,
|
|
184
182
|
`Failed: TstMsg`,
|
|
185
183
|
],
|
|
186
|
-
`failure: class mismatch
|
|
184
|
+
`failure: class mismatch`,
|
|
187
185
|
);
|
|
188
186
|
|
|
189
187
|
// failure: nested fields, array length mismatch
|
|
@@ -200,13 +198,13 @@ module.exports.test = async () => {
|
|
|
200
198
|
f2: [3],
|
|
201
199
|
},
|
|
202
200
|
},
|
|
203
|
-
'TstMsg'
|
|
201
|
+
'TstMsg',
|
|
204
202
|
),
|
|
205
203
|
[],
|
|
206
204
|
[
|
|
207
205
|
`Failed: TstMsg: 'f1->f2' field array length mismatch, got: 0, expected: 1.\nGot: []\nExpected: [3]`,
|
|
208
206
|
`Failed: TstMsg`,
|
|
209
207
|
],
|
|
210
|
-
`failure: nested fields array length mismatch
|
|
208
|
+
`failure: nested fields array length mismatch`,
|
|
211
209
|
);
|
|
212
|
-
}
|
|
210
|
+
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { is_output, is_primitive } from './test.js';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
module.exports.test = async () => {
|
|
3
|
+
export async function test() {
|
|
6
4
|
is_primitive(3, 3, `Equal`);
|
|
7
5
|
|
|
8
6
|
// number sucess
|
|
@@ -10,7 +8,7 @@ module.exports.test = async () => {
|
|
|
10
8
|
() => is_primitive(3, 3, `Equal`),
|
|
11
9
|
[`[32mOk:[0m Equal, got: 3`],
|
|
12
10
|
[],
|
|
13
|
-
`number sucess
|
|
11
|
+
`number sucess`,
|
|
14
12
|
);
|
|
15
13
|
|
|
16
14
|
// number failure
|
|
@@ -18,7 +16,7 @@ module.exports.test = async () => {
|
|
|
18
16
|
() => is_primitive(3, 4, `Not equal`),
|
|
19
17
|
[],
|
|
20
18
|
[`Failed: Not equal, got: 3, expected: 4`],
|
|
21
|
-
`number failure
|
|
19
|
+
`number failure`,
|
|
22
20
|
);
|
|
23
21
|
|
|
24
22
|
// string sucess
|
|
@@ -26,7 +24,7 @@ module.exports.test = async () => {
|
|
|
26
24
|
() => is_primitive('3', '3', `Equal`),
|
|
27
25
|
[`[32mOk:[0m Equal, got: 3`],
|
|
28
26
|
[],
|
|
29
|
-
`string sucess
|
|
27
|
+
`string sucess`,
|
|
30
28
|
);
|
|
31
29
|
|
|
32
30
|
// string failure
|
|
@@ -42,7 +40,7 @@ expected:
|
|
|
42
40
|
unexpected character: '3' at 0 pos, expected: '4' at '' line
|
|
43
41
|
`,
|
|
44
42
|
],
|
|
45
|
-
`string failure
|
|
43
|
+
`string failure`,
|
|
46
44
|
);
|
|
47
45
|
|
|
48
46
|
// regexp sucess
|
|
@@ -50,7 +48,7 @@ unexpected character: '3' at 0 pos, expected: '4' at '' line
|
|
|
50
48
|
() => is_primitive('34', /^\d+$/, `Equal`),
|
|
51
49
|
[`[32mOk:[0m Equal '34' matches /^\\d+$/ regexp`],
|
|
52
50
|
[],
|
|
53
|
-
`regexp sucess
|
|
51
|
+
`regexp sucess`,
|
|
54
52
|
);
|
|
55
53
|
|
|
56
54
|
// regexp failure
|
|
@@ -58,7 +56,7 @@ unexpected character: '3' at 0 pos, expected: '4' at '' line
|
|
|
58
56
|
() => is_primitive('34a', /^\d+$/, `Equal`),
|
|
59
57
|
[],
|
|
60
58
|
[`Failed: Equal '34a' doesn't match /^\\d+$/ regexp`],
|
|
61
|
-
`regexp failure
|
|
59
|
+
`regexp failure`,
|
|
62
60
|
);
|
|
63
61
|
|
|
64
62
|
// function sucess
|
|
@@ -66,7 +64,7 @@ unexpected character: '3' at 0 pos, expected: '4' at '' line
|
|
|
66
64
|
() => is_primitive('34', () => true, `Equal`),
|
|
67
65
|
[`[32mOk:[0m Equal, got: '34'`],
|
|
68
66
|
[],
|
|
69
|
-
`function sucess
|
|
67
|
+
`function sucess`,
|
|
70
68
|
);
|
|
71
69
|
|
|
72
70
|
// function failure
|
|
@@ -74,7 +72,7 @@ unexpected character: '3' at 0 pos, expected: '4' at '' line
|
|
|
74
72
|
() => is_primitive('34a', () => false, `Equal`),
|
|
75
73
|
[],
|
|
76
74
|
[`Failed: Equal, got: '34a', expected: () => false`],
|
|
77
|
-
`function failure
|
|
75
|
+
`function failure`,
|
|
78
76
|
);
|
|
79
77
|
|
|
80
78
|
// type mispatch failure
|
|
@@ -84,6 +82,6 @@ unexpected character: '3' at 0 pos, expected: '4' at '' line
|
|
|
84
82
|
[
|
|
85
83
|
`Failed: Not equal type mismatch, got type: number, expected type: string, got value: 3, expected value: '3'`,
|
|
86
84
|
],
|
|
87
|
-
`type mispatch failure failure
|
|
85
|
+
`type mispatch failure failure`,
|
|
88
86
|
);
|
|
89
|
-
}
|
|
87
|
+
}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import { is_string, is_output } from './test.js';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
module.exports.test = async () => {
|
|
3
|
+
export async function test() {
|
|
6
4
|
// success
|
|
7
5
|
await is_output(
|
|
8
6
|
() => is_string('Success', 'Success', `Strings equal`),
|
|
9
7
|
[`[32mOk:[0m Strings equal, got: Success\n`],
|
|
10
8
|
[],
|
|
11
|
-
`success
|
|
9
|
+
`success`,
|
|
12
10
|
);
|
|
13
11
|
|
|
14
12
|
// failure
|
|
@@ -16,13 +14,13 @@ module.exports.test = async () => {
|
|
|
16
14
|
() => is_string('Success', 'Fail', `Strings not equal`),
|
|
17
15
|
[],
|
|
18
16
|
[
|
|
19
|
-
|
|
17
|
+
`Failed: Strings not equal;
|
|
20
18
|
got:
|
|
21
19
|
Success
|
|
22
20
|
expected:
|
|
23
21
|
Fail
|
|
24
22
|
unexpected character: 'S' at 0 pos, expected: 'F' at '' line\n`,
|
|
25
23
|
],
|
|
26
|
-
`failure
|
|
24
|
+
`failure`,
|
|
27
25
|
);
|
|
28
|
-
}
|
|
26
|
+
}
|
package/tests/base/t_ok.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { ok, is_output } from './test.js';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
module.exports.test = async () => {
|
|
3
|
+
export async function test() {
|
|
6
4
|
// ok() sucess
|
|
7
5
|
await is_output(() => ok(true, `Ok`), [`Ok: Ok`], [], `ok() sucess`);
|
|
8
6
|
|
|
@@ -11,6 +9,6 @@ module.exports.test = async () => {
|
|
|
11
9
|
() => ok(false, `Not ok`),
|
|
12
10
|
[],
|
|
13
11
|
[`Failed: Not ok`],
|
|
14
|
-
`ok() failure
|
|
12
|
+
`ok() failure`,
|
|
15
13
|
);
|
|
16
|
-
}
|
|
14
|
+
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { is } from '../../index.js';
|
|
2
|
+
import { stringify } from '../../core/util.js';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
const { stringify } = require('../../core/util.js');
|
|
5
|
-
|
|
6
|
-
module.exports.test = () => {
|
|
4
|
+
export function test() {
|
|
7
5
|
is(stringify(null), `null`, 'null');
|
|
8
6
|
is(stringify(3), `3`, 'number');
|
|
9
7
|
is(stringify('hi'), `'hi'`, 'string');
|
|
@@ -16,7 +14,7 @@ module.exports.test = () => {
|
|
|
16
14
|
is(
|
|
17
15
|
stringify({ a: 3, b: { m: 'hi' } }),
|
|
18
16
|
`{a: 3, b: {m: 'hi'}}`,
|
|
19
|
-
'object->object'
|
|
17
|
+
'object->object',
|
|
20
18
|
);
|
|
21
19
|
is(stringify(new Set(['v1', 'v2'])), `Set['v1', 'v2']`, 'set');
|
|
22
20
|
is(stringify(new Map([['key', 'value']])), `Map{key: 'value'}`, 'map');
|
|
@@ -27,7 +25,7 @@ module.exports.test = () => {
|
|
|
27
25
|
is(
|
|
28
26
|
stringify(() => 3),
|
|
29
27
|
`() => 3`,
|
|
30
|
-
'function'
|
|
28
|
+
'function',
|
|
31
29
|
);
|
|
32
30
|
|
|
33
31
|
function testo() {
|
|
@@ -44,4 +42,4 @@ module.exports.test = () => {
|
|
|
44
42
|
const obj = {};
|
|
45
43
|
obj.self = obj;
|
|
46
44
|
is(stringify(obj), `{self: recursiveref}`, `recusive reference`);
|
|
47
|
-
}
|
|
45
|
+
}
|
package/tests/base/t_test_.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { ok, test_is, test_contains } from '../../core/base.js';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
module.exports.test = async () => {
|
|
3
|
+
export async function test() {
|
|
6
4
|
// test_is/contains
|
|
7
5
|
ok(test_is(3, 3), 'test_is');
|
|
8
6
|
ok(test_contains([0, 1], [1]), 'test_contains');
|
|
9
|
-
}
|
|
7
|
+
}
|
package/tests/base/t_throws.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { is_output, throws, no_throws } from './test.js';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
module.exports.test = async () => {
|
|
6
|
-
// throws: success
|
|
3
|
+
export async function test() {
|
|
4
|
+
// throws: success (sync)
|
|
7
5
|
await is_output(
|
|
8
6
|
() =>
|
|
9
7
|
throws(
|
|
@@ -11,14 +9,29 @@ module.exports.test = async () => {
|
|
|
11
9
|
throw new Error('Error#1');
|
|
12
10
|
},
|
|
13
11
|
`Error#1`,
|
|
14
|
-
`Throws error#1
|
|
12
|
+
`Throws error#1`,
|
|
15
13
|
),
|
|
16
14
|
[`Ok: Throws error#1, got: Error#1`],
|
|
17
15
|
[],
|
|
18
|
-
`throws
|
|
16
|
+
`throws success (sync)`,
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
// throws: success (async)
|
|
20
|
+
await is_output(
|
|
21
|
+
async () =>
|
|
22
|
+
await throws(
|
|
23
|
+
async () => {
|
|
24
|
+
throw new Error('Error#1');
|
|
25
|
+
},
|
|
26
|
+
`Error#1`,
|
|
27
|
+
`Throws error#1 async`,
|
|
28
|
+
),
|
|
29
|
+
[`Ok: Throws error#1 async, got: Error#1`],
|
|
30
|
+
[],
|
|
31
|
+
`throws success (async)`,
|
|
19
32
|
);
|
|
20
33
|
|
|
21
|
-
// throws: fail, unexpected exception
|
|
34
|
+
// throws: fail, unexpected exception (sync)
|
|
22
35
|
await is_output(
|
|
23
36
|
() =>
|
|
24
37
|
throws(
|
|
@@ -26,7 +39,7 @@ module.exports.test = async () => {
|
|
|
26
39
|
throw new Error('Error#2');
|
|
27
40
|
},
|
|
28
41
|
`Error#1`,
|
|
29
|
-
`Wanted error#1
|
|
42
|
+
`Wanted error#1`,
|
|
30
43
|
),
|
|
31
44
|
[],
|
|
32
45
|
[
|
|
@@ -38,28 +51,65 @@ Error#1
|
|
|
38
51
|
unexpected character: '2' at 6 pos, expected: '1' at '' line
|
|
39
52
|
`,
|
|
40
53
|
],
|
|
41
|
-
`throws fail, unexpected exception
|
|
54
|
+
`throws fail, unexpected exception (sync)`,
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
// throws: fail, unexpected exception (async)
|
|
58
|
+
await is_output(
|
|
59
|
+
async () =>
|
|
60
|
+
await throws(
|
|
61
|
+
async () => {
|
|
62
|
+
throw new Error('Error#2');
|
|
63
|
+
},
|
|
64
|
+
`Error#1`,
|
|
65
|
+
`Wanted error#1 async`,
|
|
66
|
+
),
|
|
67
|
+
[],
|
|
68
|
+
[
|
|
69
|
+
`Failed: Wanted error#1 async;
|
|
70
|
+
got:
|
|
71
|
+
Error#2
|
|
72
|
+
expected:
|
|
73
|
+
Error#1
|
|
74
|
+
unexpected character: '2' at 6 pos, expected: '1' at '' line
|
|
75
|
+
`,
|
|
76
|
+
],
|
|
77
|
+
`throws fail, unexpected exception (async)`,
|
|
42
78
|
);
|
|
43
79
|
|
|
44
|
-
// throws: fail, no exception
|
|
80
|
+
// throws: fail, no exception (sync)
|
|
45
81
|
await is_output(
|
|
46
82
|
() => throws(() => {}, `Error#1`, `Wanted error#1`),
|
|
47
83
|
[],
|
|
48
84
|
[`Failed: Wanted error#1: no 'Error#1' exception`],
|
|
49
|
-
`throws fail, no exception
|
|
85
|
+
`throws fail, no exception (sync)`,
|
|
50
86
|
);
|
|
51
87
|
|
|
52
|
-
//
|
|
88
|
+
// throws: fail, no exception (async)
|
|
89
|
+
await is_output(
|
|
90
|
+
async () => await throws(async () => {}, `Error#1`, `Wanted error#1 async`),
|
|
91
|
+
[],
|
|
92
|
+
[`Failed: Wanted error#1 async: no 'Error#1' exception`],
|
|
93
|
+
`throws fail, no exception (async)`,
|
|
94
|
+
);
|
|
53
95
|
|
|
54
|
-
// no_throws: success
|
|
96
|
+
// no_throws: success (sync)
|
|
55
97
|
await is_output(
|
|
56
98
|
() => no_throws(() => {}, `No exceptions`),
|
|
57
99
|
[`Ok: No exceptions`],
|
|
58
100
|
[],
|
|
59
|
-
`
|
|
101
|
+
`no_throws success (sync)`,
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
// no_throws: success (async)
|
|
105
|
+
await is_output(
|
|
106
|
+
async () => await no_throws(async () => {}, `No exceptions async`),
|
|
107
|
+
[`Ok: No exceptions async`],
|
|
108
|
+
[],
|
|
109
|
+
`no_throws success (async)`,
|
|
60
110
|
);
|
|
61
111
|
|
|
62
|
-
// no_throws: fail
|
|
112
|
+
// no_throws: fail (sync)
|
|
63
113
|
await is_output(
|
|
64
114
|
() =>
|
|
65
115
|
no_throws(() => {
|
|
@@ -70,6 +120,20 @@ unexpected character: '2' at 6 pos, expected: '1' at '' line
|
|
|
70
120
|
v => v.startsWith('Error: Error#1'),
|
|
71
121
|
`Failed: No exceptions, got: Error#1 exception`,
|
|
72
122
|
],
|
|
73
|
-
`no_throws fail
|
|
123
|
+
`no_throws fail (sync)`,
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
// no_throws: fail (async)
|
|
127
|
+
await is_output(
|
|
128
|
+
async () =>
|
|
129
|
+
await no_throws(async () => {
|
|
130
|
+
throw new Error('Error#1');
|
|
131
|
+
}, `No exceptions async`),
|
|
132
|
+
[],
|
|
133
|
+
[
|
|
134
|
+
v => v.startsWith('Error: Error#1'),
|
|
135
|
+
`Failed: No exceptions async, got: Error#1 exception`,
|
|
136
|
+
],
|
|
137
|
+
`no_throws fail (async)`,
|
|
74
138
|
);
|
|
75
|
-
}
|
|
139
|
+
}
|
package/tests/base/test.js
CHANGED
|
@@ -1,31 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
import { testflow } from '../../core/core.js';
|
|
2
|
+
import { is_output as is_output_base } from '../../core/base.js';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const scripts = [
|
|
7
|
-
'../../core/base.js',
|
|
8
|
-
'../../core/core.js',
|
|
9
|
-
'../../core/format.js',
|
|
10
|
-
];
|
|
11
|
-
for (let script of scripts) {
|
|
12
|
-
let script_exports = require(script);
|
|
13
|
-
for (let e in script_exports) {
|
|
14
|
-
module.exports[e] = script_exports[e];
|
|
15
|
-
}
|
|
16
|
-
}
|
|
4
|
+
export * from '../../core/base.js';
|
|
5
|
+
export * from '../../core/core.js';
|
|
6
|
+
export * from '../../core/format.js';
|
|
17
7
|
|
|
18
8
|
function is_output(func, out, err, msg) {
|
|
19
|
-
return
|
|
20
|
-
() => {
|
|
9
|
+
return is_output_base(
|
|
10
|
+
async () => {
|
|
21
11
|
testflow.lock();
|
|
22
|
-
|
|
23
|
-
|
|
12
|
+
try {
|
|
13
|
+
await func();
|
|
14
|
+
} finally {
|
|
15
|
+
testflow.unlock();
|
|
16
|
+
}
|
|
24
17
|
},
|
|
25
18
|
out,
|
|
26
19
|
err,
|
|
27
|
-
msg
|
|
20
|
+
msg,
|
|
28
21
|
);
|
|
29
22
|
}
|
|
30
23
|
|
|
31
|
-
|
|
24
|
+
export { is_output };
|