|
7 | 7 | * file that was distributed with this source code.
|
8 | 8 | */
|
9 | 9 |
|
| 10 | +/// <reference path="../adonis-typings/index.ts" /> |
| 11 | + |
10 | 12 | import { join } from 'path'
|
11 | 13 | import * as test from 'japa'
|
12 | 14 | import { createServer } from 'http'
|
@@ -260,7 +262,7 @@ test.group('Ignitor', (group) => {
|
260 | 262 | assert.isTrue(server.hookCalled)
|
261 | 263 | })
|
262 | 264 |
|
263 |
| - test('start http server to accept incoming requests', async (assert) => { |
| 265 | + test('start http server to accept incoming requests', async (assert, done) => { |
264 | 266 | await fs.fsExtra.ensureDir(join(fs.basePath, 'config'))
|
265 | 267 | await fs.add('.adonisrc.json', JSON.stringify({
|
266 | 268 | autoloads: {
|
@@ -289,12 +291,17 @@ test.group('Ignitor', (group) => {
|
289 | 291 | ignitor.application.container.use('Adonis/Core/Route').get('/', () => 'handled')
|
290 | 292 |
|
291 | 293 | await ignitor.startHttpServer((handler) => createServer(handler))
|
292 |
| - const server = ignitor.application.container.use('Adonis/Core/Server') |
| 294 | + assert.isTrue(ignitor.application.isReady) |
293 | 295 |
|
| 296 | + const server = ignitor.application.container.use('Adonis/Core/Server') |
294 | 297 | const { text } = await supertest(server.instance).get('/').expect(200)
|
295 | 298 | server.instance.close()
|
296 | 299 |
|
297 |
| - assert.equal(text, 'handled') |
| 300 | + setTimeout(() => { |
| 301 | + assert.isFalse(ignitor.application.isReady) |
| 302 | + assert.equal(text, 'handled') |
| 303 | + done() |
| 304 | + }, 100) |
298 | 305 | })
|
299 | 306 |
|
300 | 307 | test('forward errors to app error handler', async (assert) => {
|
|
0 commit comments