Skip to content

Latest commit

 

History

History
49 lines (36 loc) · 1.29 KB

README.md

File metadata and controls

49 lines (36 loc) · 1.29 KB

@ianwalter/test-server

Easily create a minimal Koa or Express server for testing

npm page CI

About

Inspired by create-test-server.

Installation

yarn add @ianwalter/test-server --dev

Usage

const { test } = require('@ianwalter/bff')
const { createKoaServer } = require('@ianwalter/test-server')
const { requester } = require('@ianwalter/requester')

test('requester', ({ expect }) => {
  const server = await createKoaServer()
  server.use(ctx => (ctx.body = 'Hello World!'))
  const response = await requester.get(server.url)
  expect(response.body).toBe('Hello World!')
  await server.close()
})

License

Apache 2.0 with Commons Clause - See LICENSE

 

Created by Ian Walter