@exodus/test 1.0.0-rc.106 → 1.0.0-rc.108
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/bin/find-binary.js +1 -0
- package/bin/index.js +4 -2
- package/package.json +4 -3
- package/src/benchmark.js +3 -2
- package/src/expect.cjs +0 -4
- package/src/replay.js +5 -3
package/bin/find-binary.js
CHANGED
package/bin/index.js
CHANGED
|
@@ -20,6 +20,7 @@ const DEFAULT_PATTERNS = [`**/?(*.)+(spec|test).?([cm])[jt]s?(x)`] // do not tru
|
|
|
20
20
|
const bundleOpts = { pure: true, bundle: true, esbuild: true, ts: 'auto' }
|
|
21
21
|
const bareboneOpts = { ...bundleOpts, barebone: true }
|
|
22
22
|
const hermesA = ['-w', '-Xmicrotask-queue'] // -Xes6-class fails with -O0 / -Og, --block-scoping fails in default, any of that is bad
|
|
23
|
+
const hermesS = [...hermesA, '-Xes6-block-scoping']
|
|
23
24
|
const denoA = ['run', '--allow-all'] // also will set DENO_COMPAT=1 env flag below
|
|
24
25
|
const denoT = ['test', '--allow-all']
|
|
25
26
|
const nodeTS = process.features.typescript ? 'auto' : 'flag'
|
|
@@ -42,6 +43,7 @@ const ENGINES = new Map(
|
|
|
42
43
|
'v8:bundle': { binary: 'd8', binaryArgs: ['--expose-gc'], ...bareboneOpts },
|
|
43
44
|
'jsc:bundle': { binary: 'jsc', target: 'safari13', ...bareboneOpts },
|
|
44
45
|
'hermes:bundle': { binary: 'hermes', binaryArgs: hermesA, target: 'es2018', ...bareboneOpts },
|
|
46
|
+
'shermes:bundle': { binary: 'shermes', binaryArgs: hermesS, target: 'es2018', ...bareboneOpts },
|
|
45
47
|
'spidermonkey:bundle': { binary: 'spidermonkey', ...bareboneOpts },
|
|
46
48
|
'engine262:bundle': { binary: 'engine262', ...bareboneOpts },
|
|
47
49
|
'quickjs:bundle': { binary: 'quickjs', binaryArgs: ['--std'], ...bareboneOpts },
|
|
@@ -62,7 +64,7 @@ const ENGINES = new Map(
|
|
|
62
64
|
'msedge:playwright': { binary: 'msedge', browsers: 'playwright', ...bundleOpts },
|
|
63
65
|
})
|
|
64
66
|
)
|
|
65
|
-
const barebonesOk = ['v8', 'd8', 'spidermonkey', 'quickjs', 'xs', 'hermes']
|
|
67
|
+
const barebonesOk = ['v8', 'd8', 'spidermonkey', 'quickjs', 'xs', 'hermes', 'shermes']
|
|
66
68
|
const barebonesUnhandled = ['jsc', 'escargot', 'boa', 'graaljs', 'jerry', 'engine262']
|
|
67
69
|
|
|
68
70
|
const getEnvFlag = (name) => {
|
|
@@ -282,7 +284,7 @@ Object.assign(options, engineOptions)
|
|
|
282
284
|
options.platform = options.binary // binary can be overriden by c8 or electron
|
|
283
285
|
const isBrowserLike = options.browsers || options.electron
|
|
284
286
|
setEnv('EXODUS_TEST_ENGINE', options.engine) // e.g. 'hermes:bundle', 'node:bundle', 'node:test', 'node:pure'
|
|
285
|
-
setEnv('EXODUS_TEST_PLATFORM', options.binary) // e.g. 'hermes', 'node'
|
|
287
|
+
setEnv('EXODUS_TEST_PLATFORM', options.binary === 'shermes' ? 'hermes' : options.binary) // e.g. 'hermes', 'node'
|
|
286
288
|
setEnv('EXODUS_TEST_TIMEOUT', options.testTimeout)
|
|
287
289
|
setEnv('EXODUS_TEST_DEVTOOLS', options.devtools ? '1' : '')
|
|
288
290
|
setEnv('EXODUS_TEST_IS_BROWSER', isBrowserLike ? '1' : '')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/test",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.108",
|
|
4
4
|
"author": "Exodus Movement, Inc.",
|
|
5
5
|
"description": "A test suite runner",
|
|
6
6
|
"homepage": "https://github.com/ExodusMovement/test",
|
|
@@ -122,6 +122,7 @@
|
|
|
122
122
|
"test:v8": "EXODUS_TEST_ENGINE=v8:bundle npm run test:_bundle --",
|
|
123
123
|
"test:jsc": "EXODUS_TEST_ENGINE=jsc:bundle npm run test:_bundle --",
|
|
124
124
|
"test:hermes": "EXODUS_TEST_ENGINE=hermes:bundle npm run test:_bundle --",
|
|
125
|
+
"test:shermes": "EXODUS_TEST_ENGINE=shermes:bundle npm run test:_bundle --",
|
|
125
126
|
"test:spidermonkey": "EXODUS_TEST_ENGINE=spidermonkey:bundle npm run test:_bundle --",
|
|
126
127
|
"test:engine262": "EXODUS_TEST_ENGINE=engine262:bundle npm run test:_bundle --",
|
|
127
128
|
"test:quickjs": "EXODUS_TEST_ENGINE=quickjs:bundle npm run test:_bundle --",
|
|
@@ -143,11 +144,10 @@
|
|
|
143
144
|
"optionalDependencies": {
|
|
144
145
|
"@chalker/queue": "^1.0.1",
|
|
145
146
|
"@exodus/replay": "^1.0.0-rc.9",
|
|
146
|
-
"@exodus/test-bundler": "1.0.0-rc.
|
|
147
|
+
"@exodus/test-bundler": "1.0.0-rc.9",
|
|
147
148
|
"c8": "^9.1.0",
|
|
148
149
|
"expect": "^30.2.0",
|
|
149
150
|
"fast-glob": "^3.2.11",
|
|
150
|
-
"jest-extended": "^4.0.2",
|
|
151
151
|
"playwright-core": "^1.52.0",
|
|
152
152
|
"pretty-format": "^30.2.0",
|
|
153
153
|
"puppeteer-core": "^24.14.0",
|
|
@@ -164,6 +164,7 @@
|
|
|
164
164
|
"eslint": "^8.44.0",
|
|
165
165
|
"esvu": "^1.2.16",
|
|
166
166
|
"jest": "^29.7.0",
|
|
167
|
+
"jest-extended": "^4.0.2",
|
|
167
168
|
"jest-matcher-utils": "^29.7.0",
|
|
168
169
|
"jest-serializer-ansi-escapes": "^3.0.0",
|
|
169
170
|
"jest-when": "^3.6.0",
|
package/src/benchmark.js
CHANGED
|
@@ -52,10 +52,11 @@ export async function benchmark(name, options, fn) {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
const mean = total / BigInt(count)
|
|
55
|
-
|
|
55
|
+
const rps = 1e9 / Number(mean)
|
|
56
|
+
let res = `${name} x ${fRps(rps)} ops/sec @ ${fTime(mean)}/op`
|
|
56
57
|
if (fTime(min) !== fTime(max)) res += ` (${fTime(min)}..${fTime(max)})`
|
|
57
58
|
console.log(res)
|
|
58
59
|
|
|
59
60
|
if (gc) for (let i = 0; i < 4; i++) gc()
|
|
60
|
-
return { total, count, mean, min, max }
|
|
61
|
+
return { rps, total, count, mean, min, max }
|
|
61
62
|
}
|
package/src/expect.cjs
CHANGED
|
@@ -25,10 +25,6 @@ function loadExpect(loadReason) {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
// console.log('expect load reason:', loadReason)
|
|
28
|
-
try {
|
|
29
|
-
expect.extend(require('jest-extended'))
|
|
30
|
-
} catch {}
|
|
31
|
-
|
|
32
28
|
for (const x of extend) expect.extend(...x)
|
|
33
29
|
for (const [key, value] of set) expect[key] = value
|
|
34
30
|
fixupAssertions()
|
package/src/replay.js
CHANGED
|
@@ -6,10 +6,12 @@ let readRecordingRaw, writeRecording
|
|
|
6
6
|
function loadReplayBundle() {
|
|
7
7
|
// TODO: also under process.features.require_module
|
|
8
8
|
if (process.env.EXODUS_TEST_ENVIRONMENT === 'bundle') {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
try {
|
|
10
|
+
replay = require('@exodus/replay') // synchronous
|
|
11
|
+
} catch {}
|
|
12
12
|
}
|
|
13
|
+
|
|
14
|
+
if (!replay) throw new Error('Failed to load @exodus/replay')
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
// Optimized out in 'bundle' env
|