Skip to content

Commit bdfd5ed

Browse files
refactor: generate test build function configured with skipOverride (#784)
* refactor: generate test build function configured with skipOverride * fix: config function should be sync
1 parent b392d6f commit bdfd5ed

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

templates/app-esm/test/helper.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ const AppPath = path.join(__dirname, '..', 'app.js')
1212
// Fill in this config with all the configurations
1313
// needed for testing the application
1414
function config () {
15-
return {}
15+
return {
16+
skipOverride: true // Register our application with fastify-plugin
17+
}
1618
}
1719

1820
// automatically build and tear down our instance

templates/app-ts-esm/test/helper.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ const AppPath = path.join(__dirname, '..', 'src', 'app.ts')
1414

1515
// Fill in this config with all the configurations
1616
// needed for testing the application
17-
async function config () {
18-
return {}
17+
function config () {
18+
return {
19+
skipOverride: true // Register our application with fastify-plugin
20+
}
1921
}
2022

2123
// Automatically build and tear down our instance
@@ -26,7 +28,7 @@ async function build (t: TestContext) {
2628
// fastify-plugin ensures that all decorators
2729
// are exposed for testing purposes, this is
2830
// different from the production setup
29-
const app = await helper.build(argv, await config())
31+
const app = await helper.build(argv, config())
3032

3133
// Tear down our app after we are done
3234
t.after(() => void app.close())

templates/app-ts/test/helper.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ const AppPath = path.join(__dirname, '..', 'src', 'app.ts')
1111

1212
// Fill in this config with all the configurations
1313
// needed for testing the application
14-
async function config () {
15-
return {}
14+
function config () {
15+
return {
16+
skipOverride: true // Register our application with fastify-plugin
17+
}
1618
}
1719

1820
// Automatically build and tear down our instance
@@ -23,7 +25,7 @@ async function build (t: TestContext) {
2325
// fastify-plugin ensures that all decorators
2426
// are exposed for testing purposes, this is
2527
// different from the production setup
26-
const app = await helper.build(argv, await config())
28+
const app = await helper.build(argv, config())
2729

2830
// Tear down our app after we are done
2931
t.after(() => void app.close())

templates/app/test/helper.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ const AppPath = path.join(__dirname, '..', 'app.js')
1010
// Fill in this config with all the configurations
1111
// needed for testing the application
1212
function config () {
13-
return {}
13+
return {
14+
skipOverride: true // Register our application with fastify-plugin
15+
}
1416
}
1517

1618
// automatically build and tear down our instance

0 commit comments

Comments
 (0)