Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix windows tests #531

Merged
merged 4 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [14, 16, 18, 20]
node-version: [20, 22]

steps:
- uses: actions/checkout@v3
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
"sinon": "^15.0.0",
"split2": "^4.0.0",
"standard": "^17.0.0",
"tap": "^16.0.0"
"tap": "^16.0.0",
"why-is-node-running": "^2.3.0"
},
"dependencies": {
"@minimistjs/subarg": "^1.0.0",
Expand Down
32 changes: 24 additions & 8 deletions test/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ test('should run benchmark against server', (t) => {
})

t.teardown(() => {
child.kill()
try {
child.kill()
} catch {}
})

child
Expand Down Expand Up @@ -102,7 +104,9 @@ test('should parse HAR file and run requests', (t) => {
})

t.teardown(() => {
child.kill()
try {
child.kill()
} catch {}
})

child
Expand All @@ -126,7 +130,9 @@ test('should throw on unknown HAR file', (t) => {
})

t.teardown(() => {
child.kill()
try {
child.kill()
} catch {}
})

const lines = []
Expand Down Expand Up @@ -155,7 +161,9 @@ test('should throw on invalid HAR file', (t) => {
})

t.teardown(() => {
child.kill()
try {
child.kill()
} catch {}
})

const lines = []
Expand Down Expand Up @@ -187,7 +195,9 @@ test('should write warning about unused HAR requests', (t) => {
})

t.teardown(() => {
child.kill()
try {
child.kill()
} catch {}
})

const lines = []
Expand Down Expand Up @@ -241,7 +251,9 @@ test('run with workers', { skip: !hasWorkerSupport }, (t) => {
})

t.teardown(() => {
child.kill()
try {
child.kill()
} catch {}
})

child
Expand Down Expand Up @@ -278,7 +290,9 @@ test('should run handle PUT bodies', (t) => {
})

t.teardown(() => {
child.kill()
try {
child.kill()
} catch {}
})

const outputLines = []
Expand Down Expand Up @@ -323,7 +337,9 @@ test('should run handle PUT bodies', (t) => {
})

t.teardown(() => {
child.kill()
try {
child.kill()
} catch {}
})

const outputLines = []
Expand Down
9 changes: 8 additions & 1 deletion test/envPort.test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
'use strict'

const why = require('why-is-node-running')
const t = require('tap')
const split = require('split2')
const path = require('path')
const childProcess = require('child_process')
const helper = require('./helper')

setInterval(function () {
console.log(why())
}, 30000).unref()

const lines = [
/Running 1s test @ .*$/,
/10 connections.*$/,
Expand Down Expand Up @@ -46,7 +51,9 @@ const child = childProcess.spawn(process.execPath, [path.join(__dirname, '..'),
})

t.teardown(() => {
child.kill()
try {
child.kill()
} catch {}
})

child
Expand Down
4 changes: 2 additions & 2 deletions test/run.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ test('tracker will emit reqError with error message on timeout', (t) => {
})

test('tracker will emit reqError with error message on error', (t) => {
t.plan(2)
t.plan(1)

const server = helper.startSocketDestroyingServer()

Expand All @@ -535,8 +535,8 @@ test('tracker will emit reqError with error message on error', (t) => {
})

tracker.once('reqError', (err) => {
console.log(err)
t.type(err, Error, 'reqError should pass an Error to listener')
t.ok(err.message, 'err.message should have a value')
tracker.stop()
})
})
Expand Down
Loading