| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 7added3 commit 60de9f8
37 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -442,3 +442,7 @@ exports.fileExists = function(pathname) { | |||
| 442 | 442 | return false; | |
| 443 | 443 | } | |
| 444 | 444 | }; | |
| 445 | + | ||
| 446 | + exports.fail = function(msg) { | ||
| 447 | + assert.fail(null, null, msg); | ||
| 448 | + }; | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,7 +24,7 @@ function master() { | |||
| 24 | 24 | }); | |
| 25 | 25 | proc.stdout.on('data', function(data) { | |
| 26 | 26 | assert.equal(data, 'ok\r\n'); | |
| 27 | - net.createServer(assert.fail).listen(common.PORT, function() { | ||
| 27 | + net.createServer(common.fail).listen(common.PORT, function() { | ||
| 28 | 28 | handle = this._handle; | |
| 29 | 29 | proc.send('one'); | |
| 30 | 30 | proc.send('two', handle); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,7 +13,7 @@ const empty = common.fixturesDir + '/empty.js'; | |||
| 13 | 13 | ||
| 14 | 14 | assert.throws(function() { | |
| 15 | 15 | var child = spawn(invalidcmd, 'this is not an array'); | |
| 16 | - child.on('error', assert.fail); | ||
| 16 | + child.on('error', common.fail); | ||
| 17 | 17 | }, TypeError); | |
| 18 | 18 | ||
| 19 | 19 | // verify that valid argument combinations do not throw | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -20,8 +20,8 @@ if (cluster.isMaster) { | |||
| 20 | 20 | })); | |
| 21 | 21 | } | |
| 22 | 22 | else { | |
| 23 | - var s = net.createServer(assert.fail); | ||
| 24 | - s.listen(42, assert.fail.bind(null, 'listen should have failed')); | ||
| 23 | + var s = net.createServer(common.fail); | ||
| 24 | + s.listen(42, common.fail.bind(null, 'listen should have failed')); | ||
| 25 | 25 | s.on('error', common.mustCall(function(err) { | |
| 26 | 26 | assert.equal(err.code, 'EACCES'); | |
| 27 | 27 | process.disconnect(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -68,7 +68,7 @@ if (!id) { | |||
| 68 | 68 | else if (id === 'one') { | |
| 69 | 69 | if (cluster.isMaster) return startWorker(); | |
| 70 | 70 | ||
| 71 | - var server = http.createServer(assert.fail).listen(common.PORT, function() { | ||
| 71 | + var server = http.createServer(common.fail).listen(common.PORT, function() { | ||
| 72 | 72 | process.send('READY'); | |
| 73 | 73 | }); | |
| 74 | 74 | ||
@@ -84,12 +84,12 @@ else if (id === 'two') { | |||
| 84 | 84 | assert(ok); | |
| 85 | 85 | }); | |
| 86 | 86 | ||
| 87 | - var server = http.createServer(assert.fail); | ||
| 87 | + var server = http.createServer(common.fail); | ||
| 88 | 88 | process.on('message', function(m) { | |
| 89 | 89 | if (typeof m === 'object') return; // ignore system messages | |
| 90 | 90 | if (m === 'QUIT') process.exit(); | |
| 91 | 91 | assert.equal(m, 'START'); | |
| 92 | - server.listen(common.PORT, assert.fail); | ||
| 92 | + server.listen(common.PORT, common.fail); | ||
| 93 | 93 | server.on('error', function(e) { | |
| 94 | 94 | assert.equal(e.code, 'EADDRINUSE'); | |
| 95 | 95 | process.send(e.code); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,7 +12,7 @@ var net = require('net'); | |||
| 12 | 12 | var id = '' + process.argv[2]; | |
| 13 | 13 | ||
| 14 | 14 | if (id === 'undefined') { | |
| 15 | - var server = net.createServer(assert.fail); | ||
| 15 | + var server = net.createServer(common.fail); | ||
| 16 | 16 | server.listen(common.PORT, function() { | |
| 17 | 17 | var worker = fork(__filename, ['worker']); | |
| 18 | 18 | worker.on('message', function(msg) { | |
@@ -24,14 +24,14 @@ if (id === 'undefined') { | |||
| 24 | 24 | }); | |
| 25 | 25 | } | |
| 26 | 26 | else if (id === 'worker') { | |
| 27 | - var server = net.createServer(assert.fail); | ||
| 28 | - server.listen(common.PORT, assert.fail); | ||
| 27 | + var server = net.createServer(common.fail); | ||
| 28 | + server.listen(common.PORT, common.fail); | ||
| 29 | 29 | server.on('error', common.mustCall(function(e) { | |
| 30 | 30 | assert(e.code, 'EADDRINUSE'); | |
| 31 | 31 | process.send('stop-listening'); | |
| 32 | 32 | process.once('message', function(msg) { | |
| 33 | 33 | if (msg !== 'stopped-listening') return; | |
| 34 | - server = net.createServer(assert.fail); | ||
| 34 | + server = net.createServer(common.fail); | ||
| 35 | 35 | server.listen(common.PORT, common.mustCall(function() { | |
| 36 | 36 | server.close(); | |
| 37 | 37 | })); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,5 +17,5 @@ if (cluster.isMaster) { | |||
| 17 | 17 | } | |
| 18 | 18 | else { | |
| 19 | 19 | // listen() without port should not trigger a libuv assert | |
| 20 | - net.createServer(assert.fail).listen(process.exit); | ||
| 20 | + net.createServer(common.fail).listen(process.exit); | ||
| 21 | 21 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,7 +10,7 @@ if (cluster.isMaster) { | |||
| 10 | 10 | if (msg === 'done') this.kill(); | |
| 11 | 11 | }); | |
| 12 | 12 | } else { | |
| 13 | - const server = net.createServer(assert.fail); | ||
| 13 | + const server = net.createServer(common.fail); | ||
| 14 | 14 | server.listen(common.PORT, function() { | |
| 15 | 15 | server.unref(); | |
| 16 | 16 | server.ref(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,7 +3,7 @@ var common = require('../common'); | |||
| 3 | 3 | var assert = require('assert'); | |
| 4 | 4 | var cluster = require('cluster'); | |
| 5 | 5 | ||
| 6 | - setTimeout(assert.fail.bind(assert, 'setup not emitted'), 1000).unref(); | ||
| 6 | + setTimeout(common.fail.bind(assert, 'setup not emitted'), 1000).unref(); | ||
| 7 | 7 | ||
| 8 | 8 | cluster.on('setup', function() { | |
| 9 | 9 | var clusterArgs = cluster.settings.args; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,7 +8,7 @@ if (cluster.isMaster) { | |||
| 8 | 8 | // Master opens and binds the socket and shares it with the worker. | |
| 9 | 9 | cluster.schedulingPolicy = cluster.SCHED_NONE; | |
| 10 | 10 | // Hog the TCP port so that when the worker tries to bind, it'll fail. | |
| 11 | - net.createServer(assert.fail).listen(common.PORT, function() { | ||
| 11 | + net.createServer(common.fail).listen(common.PORT, function() { | ||
| 12 | 12 | var server = this; | |
| 13 | 13 | var worker = cluster.fork(); | |
| 14 | 14 | worker.on('exit', common.mustCall(function(exitCode) { | |
@@ -18,8 +18,8 @@ if (cluster.isMaster) { | |||
| 18 | 18 | }); | |
| 19 | 19 | } | |
| 20 | 20 | else { | |
| 21 | - var s = net.createServer(assert.fail); | ||
| 22 | - s.listen(common.PORT, assert.fail.bind(null, 'listen should have failed')); | ||
| 21 | + var s = net.createServer(common.fail); | ||
| 22 | + s.listen(common.PORT, common.fail.bind(null, 'listen should have failed')); | ||
| 23 | 23 | s.on('error', common.mustCall(function(err) { | |
| 24 | 24 | assert.equal(err.code, 'EADDRINUSE'); | |
| 25 | 25 | process.disconnect(); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments