test-server

WebJar for test-server

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

test-server
Последняя версия

Последняя версия

0.0.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

test-server
WebJar for test-server
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/Raynos/test-server

Скачать test-server

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/test-server/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>test-server</artifactId>
    <version>0.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/test-server/
implementation 'org.webjars.npm:test-server:0.0.1'
// https://jarcasting.com/artifacts/org.webjars.npm/test-server/
implementation ("org.webjars.npm:test-server:0.0.1")
'org.webjars.npm:test-server:jar:0.0.1'
<dependency org="org.webjars.npm" name="test-server" rev="0.0.1">
  <artifact name="test-server" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='test-server', version='0.0.1')
)
libraryDependencies += "org.webjars.npm" % "test-server" % "0.0.1"
[org.webjars.npm/test-server "0.0.1"]

Зависимости

compile (3)

Идентификатор библиотеки Тип Версия
org.webjars.npm : request jar [2.9.203,2.10)
org.webjars.npm : xtend jar [1.0.3,1.1)
org.webjars.npm : ap jar [0.1.0,0.2)

Модули Проекта

Данный проект не имеет модулей.

test-server build status

Easy testing of a HTTP server

Example

testServer will create a HTTP server for you on a port. It will use the first function you pass as the request handler and fire the second function when the server is done listening.

The second version is passed a version of mikeal's request that turns "/foo" into "http://localhost:PORT/foo". It's also passed a done function to call when you are done testing and want to kill the HTTP server

var testServer = require("test-server")
    , assert = require("assert")

testServer(function (req, res) {
    res.end("beep")
}, function (request, done) {
    request("/", function (err, res, body) {
        assert.equal(body, "beep")
        done()
    })
})

testServer(requestHandler[, options], callback)

The options are

{
    port: Number
    , timeout: Number
    , protocol: "http" || "https"
    , host: someString
}
  • port is the port the server will listen on and defaults to 3002
  • timeout is the number of milliseconds before the server auto-shutsdown. This defaults to 5000 and is useful to timeout your tests
  • protocol is the protocol for calls, the default is http
  • host is the domain host to call. It defaults to localhost

Installation

npm install test-server

Tests

make test

Contributors

  • Raynos

MIT Licenced

Версии библиотеки

Версия
0.0.1