Skip to content

Commit f104060

Browse files
committed
Test on a specified port
1 parent c0b957d commit f104060

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

.travis.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
language: node_js
22
node_js:
3-
- "node"
4-
sudo: required
5-
script: "sudo node_modules/mocha/bin/mocha --exit"
3+
- "node"

test/test.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1+
process.env.TEST = true
2+
process.env.PORT = 4443
3+
process.env.HTTP_PORT = 8080
4+
15
const assert = require('assert')
26
const childProcess = require('child_process');
37
const fs = require('fs');
48
const http = require('http')
59
const https = require('https')
610
const app = require('../index.js')
711

8-
process.env.TEST = true
9-
1012
// run an external script located in the scriptPath
1113
function runScript(scriptPath, args = [], background = false) {
1214
return new Promise((resolve, reject) => {
@@ -29,12 +31,13 @@ async function sleep(ms = 0) {
2931
function makeRequest(path = "/", secure = false) {
3032
const agentOptions = {
3133
host: 'localhost',
32-
port: '443',
34+
port: process.env.PORT || 443,
3335
path: '/',
3436
rejectUnauthorized: false
3537
}
3638
const options = {
3739
host: "localhost",
40+
port: process.env.HTTP_PORT || 80,
3841
path: path,
3942
method: "GET",
4043
headers: { }

0 commit comments

Comments
 (0)