diff options
author | 2024-02-11 19:15:20 +0530 | |
---|---|---|
committer | 2024-02-13 06:59:44 +0530 | |
commit | 8fec21d6bccfa778c14c1714d6444312e36fc3f1 (patch) | |
tree | cab910ad5048eece2d229648f2c17000ac86a44d /tests/bootstrap.ts | |
parent | updates (diff) | |
download | ferdium-server-8fec21d6bccfa778c14c1714d6444312e36fc3f1.tar.gz ferdium-server-8fec21d6bccfa778c14c1714d6444312e36fc3f1.tar.zst ferdium-server-8fec21d6bccfa778c14c1714d6444312e36fc3f1.zip |
Diffstat (limited to 'tests/bootstrap.ts')
-rw-r--r-- | tests/bootstrap.ts | 42 |
1 files changed, 14 insertions, 28 deletions
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 @@ | |||
5 | * file. | 5 | * file. |
6 | */ | 6 | */ |
7 | 7 | ||
8 | import type { Config } from '@japa/runner'; | 8 | import { pluginAdonisJS } from '@japa/plugin-adonisjs'; |
9 | import TestUtils from '@ioc:Adonis/Core/TestUtils'; | 9 | |
10 | import { | 10 | import { assert } from '@japa/assert'; |
11 | assert, | 11 | import { apiClient } from '@japa/api-client'; |
12 | runFailedTests, | 12 | import app from '@adonisjs/core/services/app'; |
13 | specReporter, | 13 | import type { Config } from '@japa/runner/types'; |
14 | apiClient, | 14 | import testUtils from '@adonisjs/core/services/test_utils'; |
15 | } from '@japa/preset-adonis'; | 15 | |
16 | import { fakeCsrfField } from './utils.js'; | 16 | import { fakeCsrfField } from './utils.js'; |
17 | 17 | ||
18 | /* | 18 | /* |
@@ -26,26 +26,15 @@ import { fakeCsrfField } from './utils.js'; | |||
26 | | Feel free to remove existing plugins or add more. | 26 | | Feel free to remove existing plugins or add more. |
27 | | | 27 | | |
28 | */ | 28 | */ |
29 | |||
29 | export const plugins: Config['plugins'] = [ | 30 | export const plugins: Config['plugins'] = [ |
30 | assert(), | 31 | assert(), |
31 | runFailedTests(), | ||
32 | apiClient(), | 32 | apiClient(), |
33 | pluginAdonisJS(app), | ||
33 | ]; | 34 | ]; |
34 | 35 | ||
35 | /* | 36 | /* |
36 | |-------------------------------------------------------------------------- | 37 | |-------------------------------------------------------------------------- |
37 | | Japa Reporters | ||
38 | |-------------------------------------------------------------------------- | ||
39 | | | ||
40 | | Japa reporters displays/saves the progress of tests as they are executed. | ||
41 | | By default, we register the spec reporter to show a detailed report | ||
42 | | of tests on the terminal. | ||
43 | | | ||
44 | */ | ||
45 | export const reporters: Config['reporters'] = [specReporter()]; | ||
46 | |||
47 | /* | ||
48 | |-------------------------------------------------------------------------- | ||
49 | | Runner hooks | 38 | | Runner hooks |
50 | |-------------------------------------------------------------------------- | 39 | |-------------------------------------------------------------------------- |
51 | | | 40 | | |
@@ -57,11 +46,7 @@ export const reporters: Config['reporters'] = [specReporter()]; | |||
57 | | | 46 | | |
58 | */ | 47 | */ |
59 | export const runnerHooks: Required<Pick<Config, 'setup' | 'teardown'>> = { | 48 | export const runnerHooks: Required<Pick<Config, 'setup' | 'teardown'>> = { |
60 | setup: [ | 49 | setup: [() => testUtils.db().migrate(), () => fakeCsrfField()], |
61 | () => TestUtils.ace().loadCommands(), | ||
62 | () => TestUtils.db().migrate(), | ||
63 | () => fakeCsrfField(), | ||
64 | ], | ||
65 | teardown: [], | 50 | teardown: [], |
66 | }; | 51 | }; |
67 | 52 | ||
@@ -76,8 +61,9 @@ export const runnerHooks: Required<Pick<Config, 'setup' | 'teardown'>> = { | |||
76 | | You can use this method to configure suites. For example: Only start | 61 | | You can use this method to configure suites. For example: Only start |
77 | | the HTTP server when it is a functional suite. | 62 | | the HTTP server when it is a functional suite. |
78 | */ | 63 | */ |
64 | // eslint-disable-next-line consistent-return | ||
79 | export const configureSuite: Config['configureSuite'] = suite => { | 65 | export const configureSuite: Config['configureSuite'] = suite => { |
80 | if (suite.name === 'functional') { | 66 | if (['browser', 'functional', 'e2e'].includes(suite.name)) { |
81 | suite.setup(() => TestUtils.httpServer().start()); | 67 | return suite.setup(() => testUtils.httpServer().start()); |
82 | } | 68 | } |
83 | }; | 69 | }; |