Browse Source

upgrade deps.. test

master
Lloyd Brookes 8 years ago
parent
commit
008d9dbfa5
  1. 6
      lib/local-web-server.js
  2. 24
      package.json
  3. 9
      test/test.js

6
lib/local-web-server.js

@ -2,9 +2,9 @@ const Lws = require('lws')
const path = require('path') const path = require('path')
class LocalWebServer extends Lws { class LocalWebServer extends Lws {
constructor (options) { create (options) {
options = Object.assign({ options = Object.assign({
moduleDir: path.resolve(__dirname, `../../node_modules`), moduleDir: path.resolve(__dirname, `../node_modules`),
modulePrefix: 'lws-', modulePrefix: 'lws-',
stack: [ stack: [
'lws-log', 'lws-log',
@ -22,7 +22,7 @@ class LocalWebServer extends Lws {
'lws-index' 'lws-index'
] ]
}, options) }, options)
super(options) return super.create(options)
} }
} }

24
package.json

@ -32,20 +32,20 @@
"repository": "https://github.com/lwsjs/local-web-server", "repository": "https://github.com/lwsjs/local-web-server",
"author": "Lloyd Brookes <75pound@gmail.com>", "author": "Lloyd Brookes <75pound@gmail.com>",
"dependencies": { "dependencies": {
"lws": "^1.0.0-pre.7", "lws": "^1.0.0-pre2.2",
"lws-blacklist": "^0.2.0", "lws-blacklist": "^0.2.1",
"lws-body-parser": "^0.2.0", "lws-body-parser": "^0.2.1",
"lws-compress": "^0.2.0", "lws-compress": "^0.2.1",
"lws-conditional-get": "^0.2.0", "lws-conditional-get": "^0.3.2",
"lws-cors": "^0.2.0", "lws-cors": "^0.3.1",
"lws-index": "^0.2.0", "lws-index": "^0.3.0",
"lws-json": "^0.2.0", "lws-json": "^0.3.2",
"lws-log": "^0.2.2", "lws-log": "^0.3.0",
"lws-mime": "^0.2.0", "lws-mime": "^0.2.1",
"lws-mock-response": "^0.2.0", "lws-mock-response": "^0.2.0",
"lws-rewrite": "^0.2.3", "lws-rewrite": "^0.3.1",
"lws-spa": "^0.2.0", "lws-spa": "^0.2.0",
"lws-static": "^0.2.0" "lws-static": "^0.3.1"
}, },
"devDependencies": { "devDependencies": {
"test-runner": "^0.4.0" "test-runner": "^0.4.0"

9
test/test.js

@ -8,13 +8,12 @@ const runner = new TestRunner()
runner.test('basic', async function () { runner.test('basic', async function () {
const port = 9000 + this.index const port = 9000 + this.index
const localWebServer = new LocalWebServer({ const localWebServer = new LocalWebServer()
const server = localWebServer.create({
port: port, port: port,
directory: 'test/fixture', directory: 'test/fixture'
logFormat: 'none'
}) })
localWebServer.launch()
const response = await request(`http://localhost:${port}/one.txt`) const response = await request(`http://localhost:${port}/one.txt`)
localWebServer.server.close() server.close()
a.strictEqual(response.data.toString(), 'one\n') a.strictEqual(response.data.toString(), 'one\n')
}) })
|||||||
100:0
Loading…
Cancel
Save