Lloyd Brookes
6 years ago
9 changed files with 497 additions and 739 deletions
-
3.travis.yml
-
3LICENSE
-
11README.md
-
4bin/cli.js
-
1lib/default-stack.js
-
1146package-lock.json
-
25package.json
-
20test/cli.js
-
13test/test.js
@ -1,6 +1,5 @@ |
|||||
language: node_js |
language: node_js |
||||
node_js: |
node_js: |
||||
- 7 |
|
||||
- 8 |
- 8 |
||||
- 10 |
- 10 |
||||
- 11 |
|
||||
|
- 12 |
@ -1,8 +1,8 @@ |
|||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||
const nodeVersionMatches = require('node-version-matches') |
const nodeVersionMatches = require('node-version-matches') |
||||
|
|
||||
if (nodeVersionMatches('>=7.6.0')) { |
|
||||
|
if (nodeVersionMatches('>=8.0.0')) { |
||||
require('../lib/cli-app').run() |
require('../lib/cli-app').run() |
||||
} else { |
} else { |
||||
console.log('Sorry, this app requires node v7.6.0 or above. Please upgrade https://nodejs.org/en/') |
|
||||
|
console.log('Sorry, this app requires node v8.0.0 or above. Please upgrade https://nodejs.org/en/') |
||||
} |
} |
1146
package-lock.json
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -1,18 +1,19 @@ |
|||||
const TestRunner = require('test-runner') |
|
||||
const request = require('req-then') |
|
||||
|
const Tom = require('test-runner').Tom |
||||
|
const fetch = require('node-fetch') |
||||
const LocalWebServer = require('../') |
const LocalWebServer = require('../') |
||||
const a = require('assert') |
const a = require('assert') |
||||
|
|
||||
const runner = new TestRunner() |
|
||||
|
const tom = module.exports = new Tom('test') |
||||
|
|
||||
runner.test('basic', async function () { |
|
||||
|
tom.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.listen({ |
const server = localWebServer.listen({ |
||||
port: port, |
port: port, |
||||
directory: 'test/fixture' |
directory: 'test/fixture' |
||||
}) |
}) |
||||
const response = await request(`http://localhost:${port}/one.txt`) |
|
||||
|
const response = await fetch(`http://localhost:${port}/one.txt`) |
||||
server.close() |
server.close() |
||||
a.strictEqual(response.data.toString(), 'one\n') |
|
||||
|
const body = await response.text() |
||||
|
a.strictEqual(body, 'one\n') |
||||
}) |
}) |
Write
Preview
Loading…
Cancel
Save
Reference in new issue