@exodus/test 1.0.0-rc.8 → 1.0.0-rc.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/bin/jest.js CHANGED
@@ -1,10 +1,13 @@
1
1
  import * as globals from '../src/jest.js'
2
- import { resolveModule } from '../src/jest.mock.js'
3
- import { mock } from 'node:test'
2
+ // import { resolveModule } from '../src/jest.mock.js'
3
+ // import { mock } from 'node:test'
4
4
 
5
5
  Object.assign(globalThis, globals)
6
6
 
7
+ // @jest/globals import auto-mocking is disabled until https://github.com/nodejs/node/issues/53807 is resolved
8
+ /*
7
9
  try {
8
10
  const resolved = resolveModule('@jest/globals')
9
11
  if (mock.module) mock.module(resolved, { defaultExport: globals, namedExports: globals })
10
12
  } catch {}
13
+ */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/test",
3
- "version": "1.0.0-rc.8",
3
+ "version": "1.0.0-rc.9",
4
4
  "author": "Exodus Movement, Inc.",
5
5
  "description": "A test suite runner",
6
6
  "homepage": "https://github.com/ExodusMovement/test",
package/src/jest.js CHANGED
@@ -8,6 +8,8 @@ import './jest.snapshot.js'
8
8
  import { getCallerLocation, installLocationInNextTest } from './dark.cjs'
9
9
  import { expect } from 'expect'
10
10
 
11
+ let defaultTimeout = 5000
12
+
11
13
  const makeEach = (impl) => (list) => (template, fn) => {
12
14
  for (const args of list) {
13
15
  let name = template
@@ -31,11 +33,12 @@ const makeEach = (impl) => (list) => (template, fn) => {
31
33
  const forceExit = process.execArgv.map((x) => x.replaceAll('_', '-')).includes('--test-force-exit')
32
34
 
33
35
  const describe = (...args) => nodeDescribe(...args)
34
- const test = (name, fn) => {
36
+ const test = (name, fn, testTimeout) => {
37
+ const timeout = testTimeout ?? defaultTimeout
35
38
  installLocationInNextTest(getCallerLocation())
36
39
  if (fn.length > 0) return nodeTest(name, (t, c) => fn(c))
37
40
  if (!forceExit) return nodeTest(name, fn)
38
- return nodeTest(name, async (t) => {
41
+ return nodeTest(name, { timeout }, async (t) => {
39
42
  const res = fn()
40
43
  assert(
41
44
  types.isPromise(res),
@@ -67,6 +70,11 @@ const jest = {
67
70
  obj[name] = fn
68
71
  return fn
69
72
  },
73
+ setTimeout: (x) => {
74
+ assert.equal(typeof x, 'number')
75
+ defaultTimeout = x
76
+ return this
77
+ },
70
78
  mock: jestmock,
71
79
  requireMock,
72
80
  requireActual,