Skip to content
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
8 changes: 5 additions & 3 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ name: Node.js CI

on:
push:
branches: [ master ]
branches:
- master
pull_request:
branches: [ master ]
branches:
- master
schedule:
- cron: '0 2 * * *'

Expand All @@ -18,7 +20,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [12, 14]
node-version: [12, 14, 16]
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
Expand Down
1 change: 1 addition & 0 deletions lib/cmd/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class StartCommand extends Command {

// additional execArgv
execArgvObj.deprecation = false; // --no-deprecation
execArgvObj.traceWarnings = true; // --trace-warnings

const command = argv.node || 'node';

Expand Down
14 changes: 14 additions & 0 deletions test/fixtures/trace-warnings/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use strict';

const Event = require('events');
const event = new Event();
event.setMaxListeners(1);

module.exports = () => {
// --trace-warnings test about MaxListenersExceededWarning
event.on('xx', () => {});
event.on('xx', () => {});

// will not effect --no-deprecation argv
new Buffer('aaa');
};
4 changes: 4 additions & 0 deletions test/fixtures/trace-warnings/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "trace-warnings",
"version": "1.0.0"
}
12 changes: 12 additions & 0 deletions test/start.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,18 @@ describe('test/start.test.js', () => {
assert(result.data.toString() === 'hi, egg');
});

it('should start --trace-warnings work', function* () {
app = coffee.fork(eggBin, [ 'start', '--workers=1', path.join(__dirname, 'fixtures/trace-warnings') ]);
app.debug();
app.expect('code', 0);

yield sleep(waitTime);

assert(app.stderr.includes('MaxListenersExceededWarning:'));
assert(app.stderr.includes('app.js:10:9')); // should had trace
assert(!app.stdout.includes('DeprecationWarning:'));
});

it.skip('should get ready', function* () {
app = coffee.fork(path.join(__dirname, './fixtures/ipc-bin/start.js'), [], {
env: {
Expand Down
16 changes: 8 additions & 8 deletions test/stop.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe('test/stop.test.js', () => {

// no way to handle the SIGTERM signal in windows ?
if (!isWin) {
assert(app.stdout.includes('[master] receive signal SIGTERM, closing'));
assert(app.stdout.includes('[master] master is killed by signal SIGTERM, closing'));
assert(app.stdout.includes('[master] exit with code:0'));
assert(app.stdout.includes('[app_worker] exit with code:0'));
// assert(app.stdout.includes('[agent_worker] exit with code:0'));
Expand Down Expand Up @@ -106,7 +106,7 @@ describe('test/stop.test.js', () => {

// no way to handle the SIGTERM signal in windows ?
if (!isWin) {
assert(stdout.includes('[master] receive signal SIGTERM, closing'));
assert(stdout.includes('[master] master is killed by signal SIGTERM, closing'));
assert(stdout.includes('[master] exit with code:0'));
assert(stdout.includes('[app_worker] exit with code:0'));
}
Expand Down Expand Up @@ -191,7 +191,7 @@ describe('test/stop.test.js', () => {

// no way to handle the SIGTERM signal in windows ?
if (!isWin) {
assert(app.stdout.includes('[master] receive signal SIGTERM, closing'));
assert(app.stdout.includes('[master] master is killed by signal SIGTERM, closing'));
assert(app.stdout.includes('[master] exit with code:0'));
assert(app.stdout.includes('[app_worker] exit with code:0'));
// assert(app.stdout.includes('[agent_worker] exit with code:0'));
Expand Down Expand Up @@ -248,7 +248,7 @@ describe('test/stop.test.js', () => {

// no way to handle the SIGTERM signal in windows ?
if (!isWin) {
assert(app.stdout.includes('[master] receive signal SIGTERM, closing'));
assert(app.stdout.includes('[master] master is killed by signal SIGTERM, closing'));
assert(app.stdout.includes('[master] exit with code:0'));
assert(app.stdout.includes('[app_worker] exit with code:0'));
// assert(app.stdout.includes('[agent_worker] exit with code:0'));
Expand All @@ -261,7 +261,7 @@ describe('test/stop.test.js', () => {

// no way to handle the SIGTERM signal in windows ?
if (!isWin) {
assert(app2.stdout.includes('[master] receive signal SIGTERM, closing'));
assert(app2.stdout.includes('[master] master is killed by signal SIGTERM, closing'));
assert(app2.stdout.includes('[master] exit with code:0'));
assert(app2.stdout.includes('[app_worker] exit with code:0'));
}
Expand All @@ -275,7 +275,7 @@ describe('test/stop.test.js', () => {
beforeEach(function* () {
yield utils.cleanup(timeoutPath);
app = coffee.fork(eggBin, [ 'start', '--workers=2', '--title=stop-timeout', timeoutPath ]);
// app.debug();
app.debug();
app.expect('code', 0);

yield sleep(waitTime);
Expand Down Expand Up @@ -304,7 +304,7 @@ describe('test/stop.test.js', () => {

// no way to handle the SIGTERM signal in windows ?
if (!isWin) {
assert(app.stdout.includes('[master] receive signal SIGTERM, closing'));
assert(app.stdout.includes('[master] master is killed by signal SIGTERM, closing'));
assert(app.stdout.match(/app_worker#\d+:\d+ disconnect/));
assert(app.stdout.match(/don't fork, because worker:\d+ will be kill soon/));
}
Expand All @@ -326,7 +326,7 @@ describe('test/stop.test.js', () => {

// no way to handle the SIGTERM signal in windows ?
if (!isWin) {
assert(app.stdout.includes('[master] receive signal SIGTERM, closing'));
assert(app.stdout.includes('[master] master is killed by signal SIGTERM, closing'));
assert(app.stdout.includes('[master] exit with code:0'));
assert(app.stdout.includes('[agent_worker] exit with code:0'));
}
Expand Down