-
Notifications
You must be signed in to change notification settings - Fork 268
Expand file tree
/
Copy pathclient.node.test.ts
More file actions
35 lines (29 loc) · 921 Bytes
/
client.node.test.ts
File metadata and controls
35 lines (29 loc) · 921 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/**
* This module:
* - Starts a development server
* - Runs tests against them using a ducktaped simple test/assertion thing
* - Prints the test results to the console
*
* Could we use a testing library? Yes.
* Would that add a whole lot of value? No.
*/
import {getServer} from '../server.js'
import {registerTests} from '../tests.js'
import {nodeReporter} from '../waffletest/reporters/nodeReporter.js'
import {createRunner} from '../waffletest/runner.js'
const NODE_TEST_PORT = 3944
// Run the tests in node.js
;(async function run() {
const server = await getServer(NODE_TEST_PORT)
const runner = registerTests({
environment: 'node',
runner: createRunner(nodeReporter),
fetch: globalThis.fetch,
port: NODE_TEST_PORT,
})
const result = await runner.runTests()
// Teardown
await server.close()
// eslint-disable-next-line no-process-exit
process.exit(result.failures)
})()