Skip to content

Commit

Permalink
refactor: generate test build function configured with skipOverride (#…
Browse files Browse the repository at this point in the history
…784)

* refactor: generate test build function configured with skipOverride

* fix: config function should be sync
  • Loading branch information
jean-michelet authored Dec 23, 2024
1 parent b392d6f commit bdfd5ed
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
4 changes: 3 additions & 1 deletion templates/app-esm/test/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ const AppPath = path.join(__dirname, '..', 'app.js')
// Fill in this config with all the configurations
// needed for testing the application
function config () {
return {}
return {
skipOverride: true // Register our application with fastify-plugin
}
}

// automatically build and tear down our instance
Expand Down
8 changes: 5 additions & 3 deletions templates/app-ts-esm/test/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ const AppPath = path.join(__dirname, '..', 'src', 'app.ts')

// Fill in this config with all the configurations
// needed for testing the application
async function config () {
return {}
function config () {
return {
skipOverride: true // Register our application with fastify-plugin
}
}

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

// Tear down our app after we are done
t.after(() => void app.close())
Expand Down
8 changes: 5 additions & 3 deletions templates/app-ts/test/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ const AppPath = path.join(__dirname, '..', 'src', 'app.ts')

// Fill in this config with all the configurations
// needed for testing the application
async function config () {
return {}
function config () {
return {
skipOverride: true // Register our application with fastify-plugin
}
}

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

// Tear down our app after we are done
t.after(() => void app.close())
Expand Down
4 changes: 3 additions & 1 deletion templates/app/test/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ const AppPath = path.join(__dirname, '..', 'app.js')
// Fill in this config with all the configurations
// needed for testing the application
function config () {
return {}
return {
skipOverride: true // Register our application with fastify-plugin
}
}

// automatically build and tear down our instance
Expand Down

0 comments on commit bdfd5ed

Please sign in to comment.