Skip to content
Myr

command.executableSubcommand.signals.test.js

This file

Path

tests/command.executableSubcommand.signals.test.js

39 lines · 1.7 KiB · JavaScript

Last changed by

Merge branch 'develop' into release/7.xJohn Geebefore adoptiond90ef12

History of this file

Take it

The walk stopped after 200 commits: lines older than 55386f4 point at it.

Merge pull request #1051 from shadowspawn/feature/pretty-helpJohn Geebefore adoption55386f4

lines 1–3why, one step back
1const childProcess = require('child_process');
2const path = require('path');3

Windows tests (and GitHub Actions) (#1070)John Geebefore adoption7ab5fbf

line 4why, one step back
4// Test that a signal sent to the parent process is received by the executable subcommand process (which is listening).

Merge pull request #1051 from shadowspawn/feature/pretty-helpJohn Geebefore adoption55386f4

line 5why, one step back
5

Windows tests (and GitHub Actions) (#1070)John Geebefore adoption7ab5fbf

lines 6–10why, one step back
6// Disabling tests on Windows as:
7// "Windows does not support sending signals"8// https://nodejs.org/api/process.html#process_signal_events9const describeOrSkipOnWindows = (process.platform === 'win32') ? describe.skip : describe;10

Merge pull request #1305 from tj/release/6.xTomoaki Abebefore adoptionc5a5e7b

line 11why, one step back
11// Note: the previous (sinon) test had custom code for SIGUSR1, revisit if required:

Merge pull request #1051 from shadowspawn/feature/pretty-helpJohn Geebefore adoption55386f4

lines 12–16why, one step back
12// As described at https://nodejs.org/api/process.html#process_signal_events
13// this signal will start a debugger and thus the process might output an14// additional error message:15// "Failed to open socket on port 5858, waiting 1000 ms before retrying".16

Windows tests (and GitHub Actions) (#1070)John Geebefore adoption7ab5fbf

line 17why, one step back
17describeOrSkipOnWindows.each([['SIGINT'], ['SIGHUP'], ['SIGTERM'], ['SIGUSR1'], ['SIGUSR2']])(

Merge pull request #1051 from shadowspawn/feature/pretty-helpJohn Geebefore adoption55386f4

line 18why, one step back
18 'test signal handling in executableSubcommand', (value) => {

Update dependencies and rewrite tests (#1167)John Geebefore adoptiond736ff7

line 19why, one step back
19 // Slightly tricky test, stick with callback and disable lint warning.

Merge branch 'develop' into release/7.xJohn Geebefore adoptiond90ef12

lines 20–21why, one step back
20 // eslint-disable-next-line jest/no-done-callback
21 test(`when command killed with ${value} then executableSubcommand receives ${value}`, (done) => {

Merge pull request #1051 from shadowspawn/feature/pretty-helpJohn Geebefore adoption55386f4

lines 22–24why, one step back
22 const pmPath = path.join(__dirname, './fixtures/pm');
2324 // The child process writes to stdout.

Replace use of var with const and let (#1161)John Geebefore adoption3e5b05e

line 25why, one step back
25 const proc = childProcess.spawn(pmPath, ['listen'], {});

Merge pull request #1051 from shadowspawn/feature/pretty-helpJohn Geebefore adoption55386f4

lines 26–39why, one step back
26
27 let processOutput = '';28 proc.stdout.on('data', (data) => {29 if (processOutput.length === 0) {30 proc.kill(`${value}`);31 }32 processOutput += data.toString();33 });34 proc.on('close', (code) => {35 expect(processOutput).toBe(`Listening for signal...${value}`);36 done();37 });38 });39 });