@exodus/test 1.0.0-rc.54 → 1.0.0-rc.56

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/index.js CHANGED
@@ -34,6 +34,12 @@ const ENGINES = new Map(
34
34
  })
35
35
  )
36
36
 
37
+ const getEnvFlag = (name) => {
38
+ if (!Object.hasOwn(process.env, name)) return false
39
+ if ([undefined, '', '0', '1'].includes(process.env[name])) return process.env[name] === '1'
40
+ throw new Error(`Unexpected ${name} env value, expected '', '0', or '1'`)
41
+ }
42
+
37
43
  function parseOptions() {
38
44
  const options = {
39
45
  concurrency: undefined, // undefined means unset (can read from config), 0 means auto
@@ -42,14 +48,14 @@ function parseOptions() {
42
48
  flow: false,
43
49
  esbuild: false,
44
50
  babel: false,
45
- coverage: false,
51
+ coverage: getEnvFlag('EXODUS_TEST_COVERAGE'),
46
52
  coverageEngine: 'c8', // c8 or node
47
53
  watch: false,
48
54
  only: false,
49
55
  passWithNoTests: false,
50
56
  writeSnapshots: false,
51
57
  debug: { files: false },
52
- dropNetwork: ![undefined, '', '0'].includes(process.env.EXODUS_TEST_DROP_NETWORK),
58
+ dropNetwork: getEnvFlag('EXODUS_TEST_DROP_NETWORK'),
53
59
  ideaCompat: false,
54
60
  engine: process.env.EXODUS_TEST_ENGINE ?? 'node:test',
55
61
  entropySize: 5 * 1024,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/test",
3
- "version": "1.0.0-rc.54",
3
+ "version": "1.0.0-rc.56",
4
4
  "author": "Exodus Movement, Inc.",
5
5
  "description": "A test suite runner",
6
6
  "homepage": "https://github.com/ExodusMovement/test",
package/src/dark.cjs CHANGED
@@ -108,7 +108,8 @@ function getTestNamePath(t) {
108
108
  const execArgv = process.env.EXODUS_TEST_EXECARGV
109
109
  ? JSON.parse(process.env.EXODUS_TEST_EXECARGV)
110
110
  : process.execArgv
111
- const insideEsbuild = execArgv.some((x) => x.endsWith('node_modules/tsx/dist/loader.mjs'))
111
+ const esbuildLoaders = ['node_modules/tsx/dist/loader.mjs', '/loaders/esbuild.js']
112
+ const insideEsbuild = execArgv.some((x) => esbuildLoaders.some((y) => x.endsWith(y)))
112
113
 
113
114
  function makeEsbuildMockable() {
114
115
  if (!insideEsbuild) return
package/src/tape.js CHANGED
@@ -82,6 +82,7 @@ function tapeWrapAssert(t, callback) {
82
82
  count += calls.length
83
83
  if (plan === count) api.end()
84
84
  if (plan !== null) assert(plan >= count, `plan (${plan}) < count (${count})`)
85
+ return calls[0] // return the value in case if wrapping a single call
85
86
  }
86
87
 
87
88
  const plannedAssert = () => (plan !== null && t.assert) || assertLoose // t.assert is cached and affected by t.plan