Skip to content

Commit fd7a590

Browse files
wraithgardaviddias
authored andcommitted
chore: test fix exec.node.js tests
It was not using the dirty-chai so the expect.to.not.exist was failing. It was also trying to trap SIG* with bin/sh which does not recognize those signals (dropping the SIG prefix works in sh). This SIG* trapping was what I think was making CI tests fail so I enabled testing in CI again.
1 parent e0b8227 commit fd7a590

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

test/exec.node.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
/* eslint-env mocha */
33
'use strict'
44

5-
const expect = require('chai').expect
5+
const chai = require('chai')
6+
const dirtyChai = require('dirty-chai')
7+
const expect = chai.expect
8+
chai.use(dirtyChai)
69
const isrunning = require('is-running')
710
const cp = require('child_process')
811
const path = require('path')
@@ -18,12 +21,12 @@ function token () {
1821
return Math.random().toString().substr(2)
1922
}
2023

21-
function psExpect (pid, expect, grace, callback) {
24+
function psExpect (pid, shouldBeRunning, grace, callback) {
2225
setTimeout(() => {
2326
const actual = isrunning(pid)
2427

25-
if (actual !== expect && grace > 0) {
26-
return psExpect(pid, expect, --grace, callback)
28+
if (actual !== shouldBeRunning && grace > 0) {
29+
return psExpect(pid, shouldBeRunning, --grace, callback)
2730
}
2831

2932
callback(null, actual)
@@ -66,7 +69,7 @@ function makeCheck (n, done) {
6669
describe('exec', () => {
6770
// TODO: skip on windows for now
6871
// TODO: running under coverage messes up the process hierarchies
69-
if (isWindows || process.env['COVERAGE']) {
72+
if (isWindows || process.env.COVERAGE) {
7073
return
7174
}
7275

@@ -101,11 +104,6 @@ describe('exec', () => {
101104
})
102105
})
103106

104-
// Travis and CircleCI don't like the usage of SIGHUP
105-
if (process.env.CI) {
106-
return
107-
}
108-
109107
it('SIGKILL kills survivor', (done) => {
110108
const check = makeCheck(2, done)
111109

test/survivor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/sh
2-
trap "echo 'you cannot kill me!'" SIGHUP SIGINT SIGTERM SIGQUIT SIGPIPE
3-
while true; do sleep 1; done
2+
trap "echo 'you cannot kill me!'" HUP INT TERM QUIT PIPE
3+
while true; do sleep 1; done

0 commit comments

Comments
 (0)