-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathhelper.js
More file actions
35 lines (27 loc) · 846 Bytes
/
Copy pathhelper.js
File metadata and controls
35 lines (27 loc) · 846 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
'use strict'
// This file contains code that we reuse
// between our tests.
const { build: buildApplication } = require('fastify-cli/helper')
const path = require('path')
const AppPath = path.join(__dirname, '..', 'app.js')
// Fill in this config with all the configurations
// needed for testing the application
function config () {
return {}
}
// automatically build and tear down our instance
async function build (t) {
// you can set all the options supported by the fastify CLI command
const argv = [AppPath]
// fastify-plugin ensures that all decorators
// are exposed for testing purposes, this is
// different from the production setup
const app = await buildApplication(argv, config())
// tear down our app after we are done
t.teardown(app.close.bind(app))
return app
}
module.exports = {
config,
build
}