-
Notifications
You must be signed in to change notification settings - Fork 3
/
test.ts
45 lines (38 loc) · 1.27 KB
/
test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
|--------------------------------------------------------------------------
| Tests
|--------------------------------------------------------------------------
|
| The contents in this file boots the AdonisJS application and configures
| the Japa tests runner.
|
| For the most part you will never edit this file. The configuration
| for the tests can be controlled via ".adonisrc.json" and
| "tests/bootstrap.ts" files.
|
*/
process.env.NODE_ENV = 'testing'
import 'reflect-metadata'
import sourceMapSupport from 'source-map-support'
import { Ignitor } from '@adonisjs/core/build/standalone'
import { configure, processCliArgs, run, RunnerHooksHandler } from '@japa/runner'
sourceMapSupport.install({ handleUncaughtExceptions: false })
const kernel = new Ignitor(__dirname).kernel('test')
kernel
.boot()
.then(() => import('./tests/bootstrap'))
.then(({ runnerHooks, ...config }) => {
const app: RunnerHooksHandler[] = [() => kernel.start()]
configure({
...kernel.application.rcFile.tests,
...processCliArgs(process.argv.slice(2)),
...config,
...{
importer: (filePath) => import(filePath),
setup: app.concat(runnerHooks.setup),
teardown: runnerHooks.teardown,
},
cwd: kernel.application.appRoot,
})
run()
})