From 8fec21d6bccfa778c14c1714d6444312e36fc3f1 Mon Sep 17 00:00:00 2001 From: MCMXC <16797721+mcmxcdev@users.noreply.github.com> Date: Sun, 11 Feb 2024 19:15:20 +0530 Subject: more updates --- tests/bootstrap.ts | 42 ++++++++++++++---------------------------- 1 file changed, 14 insertions(+), 28 deletions(-) (limited to 'tests/bootstrap.ts') diff --git a/tests/bootstrap.ts b/tests/bootstrap.ts index 521f718..d152db0 100644 --- a/tests/bootstrap.ts +++ b/tests/bootstrap.ts @@ -5,14 +5,14 @@ * file. */ -import type { Config } from '@japa/runner'; -import TestUtils from '@ioc:Adonis/Core/TestUtils'; -import { - assert, - runFailedTests, - specReporter, - apiClient, -} from '@japa/preset-adonis'; +import { pluginAdonisJS } from '@japa/plugin-adonisjs'; + +import { assert } from '@japa/assert'; +import { apiClient } from '@japa/api-client'; +import app from '@adonisjs/core/services/app'; +import type { Config } from '@japa/runner/types'; +import testUtils from '@adonisjs/core/services/test_utils'; + import { fakeCsrfField } from './utils.js'; /* @@ -26,24 +26,13 @@ import { fakeCsrfField } from './utils.js'; | Feel free to remove existing plugins or add more. | */ + export const plugins: Config['plugins'] = [ assert(), - runFailedTests(), apiClient(), + pluginAdonisJS(app), ]; -/* -|-------------------------------------------------------------------------- -| Japa Reporters -|-------------------------------------------------------------------------- -| -| Japa reporters displays/saves the progress of tests as they are executed. -| By default, we register the spec reporter to show a detailed report -| of tests on the terminal. -| -*/ -export const reporters: Config['reporters'] = [specReporter()]; - /* |-------------------------------------------------------------------------- | Runner hooks @@ -57,11 +46,7 @@ export const reporters: Config['reporters'] = [specReporter()]; | */ export const runnerHooks: Required> = { - setup: [ - () => TestUtils.ace().loadCommands(), - () => TestUtils.db().migrate(), - () => fakeCsrfField(), - ], + setup: [() => testUtils.db().migrate(), () => fakeCsrfField()], teardown: [], }; @@ -76,8 +61,9 @@ export const runnerHooks: Required> = { | You can use this method to configure suites. For example: Only start | the HTTP server when it is a functional suite. */ +// eslint-disable-next-line consistent-return export const configureSuite: Config['configureSuite'] = suite => { - if (suite.name === 'functional') { - suite.setup(() => TestUtils.httpServer().start()); + if (['browser', 'functional', 'e2e'].includes(suite.name)) { + return suite.setup(() => testUtils.httpServer().start()); } }; -- cgit v1.2.3-54-g00ecf