velocious 1.0.667 → 1.0.669

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.
Files changed (112) hide show
  1. package/README.md +34 -9
  2. package/build/configuration.js +23 -1
  3. package/build/environment-handlers/node/cli/commands/test/timing-manifest/merge.js +2 -48
  4. package/build/environment-handlers/node/cli/commands/test.js +17 -69
  5. package/build/frontend-models/websocket-channel.js +18 -0
  6. package/build/http-server/client/websocket-session.js +41 -4
  7. package/build/http-server/websocket-channel.js +14 -0
  8. package/build/http-server/websocket-event-log-store.js +85 -12
  9. package/build/http-server/websocket-events-host.js +14 -6
  10. package/build/src/configuration.d.ts +18 -1
  11. package/build/src/configuration.d.ts.map +1 -1
  12. package/build/src/configuration.js +22 -2
  13. package/build/src/environment-handlers/node/cli/commands/test/timing-manifest/merge.d.ts.map +1 -1
  14. package/build/src/environment-handlers/node/cli/commands/test/timing-manifest/merge.js +3 -47
  15. package/build/src/environment-handlers/node/cli/commands/test.d.ts +2 -28
  16. package/build/src/environment-handlers/node/cli/commands/test.d.ts.map +1 -1
  17. package/build/src/environment-handlers/node/cli/commands/test.js +10 -61
  18. package/build/src/frontend-models/websocket-channel.d.ts +9 -0
  19. package/build/src/frontend-models/websocket-channel.d.ts.map +1 -1
  20. package/build/src/frontend-models/websocket-channel.js +16 -1
  21. package/build/src/http-server/client/websocket-session.d.ts +25 -2
  22. package/build/src/http-server/client/websocket-session.d.ts.map +1 -1
  23. package/build/src/http-server/client/websocket-session.js +40 -5
  24. package/build/src/http-server/websocket-channel.d.ts +11 -0
  25. package/build/src/http-server/websocket-channel.d.ts.map +1 -1
  26. package/build/src/http-server/websocket-channel.js +14 -1
  27. package/build/src/http-server/websocket-event-log-store.d.ts +60 -41
  28. package/build/src/http-server/websocket-event-log-store.d.ts.map +1 -1
  29. package/build/src/http-server/websocket-event-log-store.js +79 -12
  30. package/build/src/http-server/websocket-events-host.d.ts +10 -3
  31. package/build/src/http-server/websocket-events-host.d.ts.map +1 -1
  32. package/build/src/http-server/websocket-events-host.js +14 -7
  33. package/build/src/testing/expect-utils.d.ts +1 -51
  34. package/build/src/testing/expect-utils.d.ts.map +1 -1
  35. package/build/src/testing/expect-utils.js +2 -205
  36. package/build/src/testing/expect.d.ts +1 -171
  37. package/build/src/testing/expect.d.ts.map +1 -1
  38. package/build/src/testing/expect.js +2 -667
  39. package/build/src/testing/test-files-finder.d.ts +13 -116
  40. package/build/src/testing/test-files-finder.d.ts.map +1 -1
  41. package/build/src/testing/test-files-finder.js +26 -296
  42. package/build/src/testing/test-filter-parser.d.ts +32 -22
  43. package/build/src/testing/test-filter-parser.d.ts.map +1 -1
  44. package/build/src/testing/test-filter-parser.js +25 -217
  45. package/build/src/testing/test-profile-activity.d.ts +1 -6
  46. package/build/src/testing/test-profile-activity.d.ts.map +1 -1
  47. package/build/src/testing/test-profile-activity.js +2 -12
  48. package/build/src/testing/test-profile-output.d.ts +1 -40
  49. package/build/src/testing/test-profile-output.d.ts.map +1 -1
  50. package/build/src/testing/test-profile-output.js +2 -217
  51. package/build/src/testing/test-profiler.d.ts +15 -659
  52. package/build/src/testing/test-profiler.d.ts.map +1 -1
  53. package/build/src/testing/test-profiler.js +35 -833
  54. package/build/src/testing/test-runner.d.ts +10 -1
  55. package/build/src/testing/test-runner.d.ts.map +1 -1
  56. package/build/src/testing/test-runner.js +26 -4
  57. package/build/src/testing/test-suite-splitter.d.ts +1 -128
  58. package/build/src/testing/test-suite-splitter.d.ts.map +1 -1
  59. package/build/src/testing/test-suite-splitter.js +2 -259
  60. package/build/src/testing/test.d.ts +1 -13
  61. package/build/src/testing/test.d.ts.map +1 -1
  62. package/build/src/testing/test.js +2 -14
  63. package/build/src/testing/timing-manifest.d.ts +5 -93
  64. package/build/src/testing/timing-manifest.d.ts.map +1 -1
  65. package/build/src/testing/timing-manifest.js +4 -283
  66. package/build/src/testing/velocious-attempt-executor.d.ts.map +1 -1
  67. package/build/src/testing/velocious-attempt-executor.js +8 -2
  68. package/build/testing/expect-utils.js +1 -242
  69. package/build/testing/expect.js +1 -760
  70. package/build/testing/test-files-finder.js +29 -345
  71. package/build/testing/test-filter-parser.js +29 -248
  72. package/build/testing/test-profile-activity.js +1 -12
  73. package/build/testing/test-profile-output.js +8 -253
  74. package/build/testing/test-profiler.js +38 -895
  75. package/build/testing/test-runner.js +33 -9
  76. package/build/testing/test-suite-splitter.js +1 -301
  77. package/build/testing/test.js +3 -14
  78. package/build/testing/timing-manifest.js +10 -344
  79. package/build/testing/velocious-attempt-executor.js +7 -1
  80. package/package.json +3 -4
  81. package/scripts/test-browser.js +29 -6
  82. package/scripts/verify-docker-dev-environment.js +13 -1
  83. package/src/configuration.js +23 -1
  84. package/src/environment-handlers/node/cli/commands/test/timing-manifest/merge.js +2 -48
  85. package/src/environment-handlers/node/cli/commands/test.js +17 -69
  86. package/src/frontend-models/websocket-channel.js +18 -0
  87. package/src/http-server/client/websocket-session.js +41 -4
  88. package/src/http-server/websocket-channel.js +14 -0
  89. package/src/http-server/websocket-event-log-store.js +85 -12
  90. package/src/http-server/websocket-events-host.js +14 -6
  91. package/src/testing/expect-utils.js +1 -242
  92. package/src/testing/expect.js +1 -760
  93. package/src/testing/test-files-finder.js +29 -345
  94. package/src/testing/test-filter-parser.js +29 -248
  95. package/src/testing/test-profile-activity.js +1 -12
  96. package/src/testing/test-profile-output.js +8 -253
  97. package/src/testing/test-profiler.js +38 -895
  98. package/src/testing/test-runner.js +33 -9
  99. package/src/testing/test-suite-splitter.js +1 -301
  100. package/src/testing/test.js +3 -14
  101. package/src/testing/timing-manifest.js +10 -344
  102. package/src/testing/velocious-attempt-executor.js +7 -1
  103. package/build/src/testing/base-expect.d.ts +0 -15
  104. package/build/src/testing/base-expect.d.ts.map +0 -1
  105. package/build/src/testing/base-expect.js +0 -16
  106. package/build/src/testing/expect-to-change.d.ts +0 -32
  107. package/build/src/testing/expect-to-change.d.ts.map +0 -1
  108. package/build/src/testing/expect-to-change.js +0 -46
  109. package/build/testing/base-expect.js +0 -17
  110. package/build/testing/expect-to-change.js +0 -55
  111. package/src/testing/base-expect.js +0 -17
  112. package/src/testing/expect-to-change.js +0 -55
@@ -1,246 +1,5 @@
1
1
  // @ts-check
2
2
 
3
- import {anythingDifferent} from "set-state-compare/build/diff-utils.js"
4
-
5
- /**
6
- * Runs object containing.
7
- * @param {ReturnType<typeof JSON.parse>} value - Value.
8
- * @returns {{__velociousMatcher: string, value: ReturnType<typeof JSON.parse>}} - Matcher wrapper.
9
- */
10
- function objectContaining(value) {
11
- if (value === null || typeof value !== "object") {
12
- throw new Error(`Expected object but got ${typeof value}`)
13
- }
14
-
15
- return {
16
- __velociousMatcher: "objectContaining",
17
- value
18
- }
19
- }
20
-
21
- /**
22
- * Runs array containing.
23
- * @param {ReturnType<typeof JSON.parse>} value - Value.
24
- * @returns {{__velociousMatcher: string, value: ReturnType<typeof JSON.parse>}} - Matcher wrapper.
25
- */
26
- function arrayContaining(value) {
27
- if (!Array.isArray(value)) {
28
- throw new Error(`Expected array but got ${typeof value}`)
29
- }
30
-
31
- return {
32
- __velociousMatcher: "arrayContaining",
33
- value
34
- }
35
- }
36
-
37
- /**
38
- * Runs is object like.
39
- * @param {ReturnType<typeof JSON.parse>} value - Value.
40
- * @returns {boolean} - Whether object-like.
41
- */
42
- function isObjectLike(value) {
43
- return value !== null && typeof value === "object"
44
- }
45
-
46
- /**
47
- * Runs is array containing.
48
- * @param {ReturnType<typeof JSON.parse>} value - Value.
49
- * @returns {boolean} - Whether arrayContaining matcher.
50
- */
51
- function isArrayContaining(value) {
52
- return !!value && typeof value === "object" && (/** @type {ReturnType<typeof JSON.parse>} */ (value)).__velociousMatcher === "arrayContaining"
53
- }
54
-
55
- /**
56
- * Runs is object containing.
57
- * @param {ReturnType<typeof JSON.parse>} value - Value.
58
- * @returns {boolean} - Whether objectContaining matcher.
59
- */
60
- function isObjectContaining(value) {
61
- return !!value && typeof value === "object" && (/** @type {ReturnType<typeof JSON.parse>} */ (value)).__velociousMatcher === "objectContaining"
62
- }
63
-
64
- /**
65
- * Runs is plain object.
66
- * @param {ReturnType<typeof JSON.parse>} value - Value.
67
- * @returns {boolean} - Whether plain object.
68
- */
69
- function isPlainObject(value) {
70
- if (!value || typeof value !== "object") return false
71
-
72
- const prototype = Object.getPrototypeOf(value)
73
-
74
- return prototype === Object.prototype || prototype === null
75
- }
76
-
77
- /**
78
- * Runs values equal.
79
- * @param {ReturnType<typeof JSON.parse>} actual - Actual value.
80
- * @param {ReturnType<typeof JSON.parse>} expected - Expected value.
81
- * @returns {boolean} - Whether values are equal.
82
- */
83
- function valuesEqual(actual, expected) {
84
- if (actual instanceof Date && expected instanceof Date) {
85
- return actual.getTime() === expected.getTime()
86
- }
87
-
88
- if (actual instanceof RegExp && expected instanceof RegExp) {
89
- return actual.source === expected.source && actual.flags === expected.flags
90
- }
91
-
92
- return Object.is(actual, expected)
93
- }
94
-
95
- /**
96
- * Runs collect match differences.
97
- * @param {ReturnType<typeof JSON.parse>} actual - Actual value.
98
- * @param {ReturnType<typeof JSON.parse>} expected - Expected value.
99
- * @param {string} path - Path.
100
- * @param {Record<string, Array<ReturnType<typeof JSON.parse>>>} differences - Differences.
101
- * @returns {void} - No return value.
102
- */
103
- function collectMatchDifferences(actual, expected, path, differences) {
104
- if (isObjectContaining(expected)) {
105
- collectMatchDifferences(actual, /** @type {ReturnType<typeof JSON.parse>} */ (expected).value, path, differences)
106
- return
107
- }
108
-
109
- if (isArrayContaining(expected)) {
110
- const {matches} = matchArrayContaining(actual, /** @type {Array<ReturnType<typeof JSON.parse>>} */ (/** @type {ReturnType<typeof JSON.parse>} */ (expected).value))
111
-
112
- if (!matches) {
113
- differences[path || "$"] = [expected, actual]
114
- }
115
-
116
- return
117
- }
118
-
119
- if (Array.isArray(expected)) {
120
- if (!Array.isArray(actual)) {
121
- differences[path || "$"] = [expected, actual]
122
- return
123
- }
124
-
125
- for (let i = 0; i < expected.length; i++) {
126
- const nextPath = `${path}[${i}]`
127
- collectMatchDifferences(actual[i], expected[i], nextPath, differences)
128
- }
129
-
130
- return
131
- }
132
-
133
- if (isPlainObject(expected)) {
134
- if (!isObjectLike(actual)) {
135
- differences[path || "$"] = [expected, actual]
136
- return
137
- }
138
-
139
- const expectedObject = /** @type {Record<string, ReturnType<typeof JSON.parse>>} */ (expected)
140
- const actualObject = /** @type {Record<string, ReturnType<typeof JSON.parse>>} */ (actual)
141
-
142
- for (const key of Object.keys(expectedObject)) {
143
- const nextPath = path ? `${path}.${key}` : key
144
-
145
- if (!Object.prototype.hasOwnProperty.call(actualObject, key)) {
146
- differences[nextPath] = [expectedObject[key], undefined]
147
- continue
148
- }
149
-
150
- collectMatchDifferences(actualObject[key], expectedObject[key], nextPath, differences)
151
- }
152
-
153
- return
154
- }
155
-
156
- if (!valuesEqual(actual, expected)) {
157
- differences[path || "$"] = [expected, actual]
158
- }
159
- }
160
-
161
- /**
162
- * Runs match object.
163
- * @param {ReturnType<typeof JSON.parse>} actual - Actual value.
164
- * @param {Record<string, ReturnType<typeof JSON.parse>> | Array<ReturnType<typeof JSON.parse>>} expected - Expected value.
165
- * @returns {{matches: boolean, differences: Record<string, Array<ReturnType<typeof JSON.parse>>>}} - Match result.
166
- */
167
- function matchObject(actual, expected) {
168
- /**
169
- * Differences.
170
- * @type {Record<string, Array<ReturnType<typeof JSON.parse>>>} */
171
- const differences = {}
172
-
173
- collectMatchDifferences(actual, expected, "", differences)
174
-
175
- return {
176
- matches: Object.keys(differences).length === 0,
177
- differences
178
- }
179
- }
180
-
181
- /**
182
- * Runs match array containing.
183
- * @param {ReturnType<typeof JSON.parse>} actual - Actual value.
184
- * @param {Array<ReturnType<typeof JSON.parse>>} expected - Expected values.
185
- * @returns {{matches: boolean, differences: Record<string, Array<ReturnType<typeof JSON.parse>>>}} - Match result.
186
- */
187
- function matchArrayContaining(actual, expected) {
188
- /**
189
- * Differences.
190
- * @type {Record<string, Array<ReturnType<typeof JSON.parse>>>} */
191
- const differences = {}
192
-
193
- if (!Array.isArray(actual)) {
194
- differences["$"] = [expected, actual]
195
- return {matches: false, differences}
196
- }
197
-
198
- const usedIndexes = new Set()
199
-
200
- for (const expectedItem of expected) {
201
- let matchedIndex = -1
202
-
203
- for (let i = 0; i < actual.length; i++) {
204
- if (usedIndexes.has(i)) continue
205
-
206
- if (isObjectContaining(expectedItem)) {
207
- const {matches} = matchObject(actual[i], /** @type {ReturnType<typeof JSON.parse>} */ (expectedItem).value)
208
- if (matches) {
209
- matchedIndex = i
210
- break
211
- }
212
- continue
213
- }
214
-
215
- if (isArrayContaining(expectedItem)) {
216
- const {matches} = matchArrayContaining(actual[i], /** @type {ReturnType<typeof JSON.parse>} */ (expectedItem).value)
217
- if (matches) {
218
- matchedIndex = i
219
- break
220
- }
221
- continue
222
- }
223
-
224
- if (!anythingDifferent(actual[i], expectedItem)) {
225
- matchedIndex = i
226
- break
227
- }
228
- }
229
-
230
- if (matchedIndex >= 0) {
231
- usedIndexes.add(matchedIndex)
232
- } else {
233
- differences["$"] = [expected, actual]
234
- break
235
- }
236
- }
237
-
238
- return {
239
- matches: Object.keys(differences).length === 0,
240
- differences
241
- }
242
- }
243
-
244
3
  export {
245
4
  arrayContaining,
246
5
  isArrayContaining,
@@ -248,4 +7,4 @@ export {
248
7
  matchArrayContaining,
249
8
  matchObject,
250
9
  objectContaining
251
- }
10
+ } from "@velocious/testing"