}
}
}
-
-await suite('TEST RUNNER CHECK', async () => {
- await new Promise(r => setTimeout(r, 0))
-
- console.assert(failures.length === 0)
- console.assert(passes.length === 0)
-
- //@ts-expect-error
- await test('promise should pass', new Promise(resolve => resolve(null)))
- console.assert(failures.some(call => /.*promise should pass.*/.test(call[0])) === false, `good promise errored`)
- console.assert(passes.some(call => /.*promise should pass.*/.test(call)) === true, `good promise not logged`)
-
- //@ts-expect-error
- await test('promise should fail', new Promise((resolve, reject) => reject('FAILURE EXPECTED HERE')))
- console.assert(failures.some(call => /.*promise should fail.*/.test(call)) === true, `bad promise not errored`)
- console.assert(passes.some(call => /.*promise should fail.*/.test(call)) === false, 'bad promise logged')
-
- await test('async should pass', async () => {})
- console.assert(failures.some(call => /.*async should pass.*/.test(call)) === false, 'good async errored')
- console.assert(passes.some(call => /.*async should pass.*/.test(call)) === true, 'good async not logged')
-
- await test('async should fail', async () => { throw new Error('FAILURE EXPECTED HERE') })
- console.assert(failures.some(call => /.*async should fail.*/.test(call)) === true, 'bad async not errored')
- console.assert(passes.some(call => /.*async should fail.*/.test(call)) === false, 'bad async logged')
-
- await test('function should pass', () => {})
- console.assert(failures.some(call => /.*function should pass.*/.test(call)) === false, 'good function errored')
- console.assert(passes.some(call => /.*function should pass.*/.test(call)) === true, 'good function not logged')
-
- //@ts-expect-error
- await test('function should fail', 'FAILURE EXPECTED HERE')
- console.assert(failures.some(call => /.*function should fail.*/.test(call)) === true, 'bad function not errored')
- console.assert(passes.some(call => /.*function should fail.*/.test(call)) === false, 'bad function logged')
-
- failures.splice(0)
- passes.splice(0)
-})
-console.log(`%cTEST RUNNER CHECK DONE`, 'font-weight:bold')
// SPDX-License-Identifier: GPL-3.0-or-later
import { failures, passes } from './GLOBALS.mjs'
+import './test.runner-check.mjs'
import './test.blake2b.mjs'
import './test.blocks.mjs'
--- /dev/null
+// SPDX-FileCopyrightText: 2025 Chris Duncan <chris@zoso.dev>
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+import { failures, passes, suite, test } from './GLOBALS.mjs'
+
+await suite('TEST RUNNER CHECK', async () => {
+ await new Promise(r => setTimeout(r, 0))
+
+ console.assert(failures.length === 0)
+ console.assert(passes.length === 0)
+
+ //@ts-expect-error
+ await test('promise should pass', new Promise(resolve => resolve(null)))
+ console.assert(failures.some(call => /.*promise should pass.*/.test(call[0])) === false, `good promise errored`)
+ console.assert(passes.some(call => /.*promise should pass.*/.test(call)) === true, `good promise not logged`)
+
+ //@ts-expect-error
+ await test('promise should fail', new Promise((resolve, reject) => reject('FAILURE EXPECTED HERE')))
+ console.assert(failures.some(call => /.*promise should fail.*/.test(call)) === true, `bad promise not errored`)
+ console.assert(passes.some(call => /.*promise should fail.*/.test(call)) === false, 'bad promise logged')
+
+ await test('async should pass', async () => {})
+ console.assert(failures.some(call => /.*async should pass.*/.test(call)) === false, 'good async errored')
+ console.assert(passes.some(call => /.*async should pass.*/.test(call)) === true, 'good async not logged')
+
+ await test('async should fail', async () => { throw new Error('FAILURE EXPECTED HERE') })
+ console.assert(failures.some(call => /.*async should fail.*/.test(call)) === true, 'bad async not errored')
+ console.assert(passes.some(call => /.*async should fail.*/.test(call)) === false, 'bad async logged')
+
+ await test('function should pass', () => {})
+ console.assert(failures.some(call => /.*function should pass.*/.test(call)) === false, 'good function errored')
+ console.assert(passes.some(call => /.*function should pass.*/.test(call)) === true, 'good function not logged')
+
+ //@ts-expect-error
+ await test('function should fail', 'FAILURE EXPECTED HERE')
+ console.assert(failures.some(call => /.*function should fail.*/.test(call)) === true, 'bad function not errored')
+ console.assert(passes.some(call => /.*function should fail.*/.test(call)) === false, 'bad function logged')
+
+ failures.splice(0)
+ passes.splice(0)
+})
+console.log(`%cTEST RUNNER CHECK DONE`, 'font-weight:bold')