Skip to content

Commit

Permalink
Fix windows tests (#531)
Browse files Browse the repository at this point in the history
* Fix windows tests

Signed-off-by: Matteo Collina <[email protected]>

* fixup

Signed-off-by: Matteo Collina <[email protected]>

* fixup

Signed-off-by: Matteo Collina <[email protected]>

* fixup

Signed-off-by: Matteo Collina <[email protected]>

---------

Signed-off-by: Matteo Collina <[email protected]>
  • Loading branch information
mcollina authored Oct 14, 2024
1 parent b929456 commit 5ef4545
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 13 deletions.
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

0 comments on commit 5ef4545

Please sign in to comment.