46 lines
1.1 KiB
TypeScript
Executable File
46 lines
1.1 KiB
TypeScript
Executable File
// apps/backend/tests/bootstrap.ts
|
|
import { assert } from '@japa/assert'
|
|
import { apiClient } from '@japa/api-client'
|
|
import { pluginAdonisJS } from '@japa/plugin-adonisjs'
|
|
import { specReporter } from '@japa/spec-reporter'
|
|
import type { Config } from '@japa/runner/types'
|
|
|
|
import app from '@adonisjs/core/services/app'
|
|
import testUtils from '@adonisjs/core/services/test_utils'
|
|
|
|
/**
|
|
* Japa plugins
|
|
*/
|
|
export const plugins: Config['plugins'] = [assert(), apiClient(), pluginAdonisJS(app)]
|
|
|
|
/**
|
|
* Reporters
|
|
*/
|
|
export const reporters: Config['reporters'] = {
|
|
activated: ['spec'],
|
|
list: [
|
|
{
|
|
name: 'spec',
|
|
handler: specReporter(),
|
|
},
|
|
],
|
|
}
|
|
|
|
/**
|
|
* Global setup/teardown (for ALL suites)
|
|
*/
|
|
export const runnerHooks: Required<Pick<Config, 'setup' | 'teardown'>> = {
|
|
setup: [],
|
|
teardown: [],
|
|
}
|
|
|
|
/**
|
|
* Per-suite configuration (start HTTP server for HTTP tests)
|
|
*/
|
|
export const configureSuite: Config['configureSuite'] = (suite) => {
|
|
// adjust names to your suites if needed
|
|
if (['functional', 'e2e', 'browser'].includes(suite.name)) {
|
|
suite.setup(() => testUtils.httpServer().start())
|
|
}
|
|
}
|