| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 44cc39d commit 1091b86
45 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -385,7 +385,7 @@ process.on('exit', function() { | |||
| 385 | 385 | if (!exports.globalCheck) return; | |
| 386 | 386 | const leaked = leakedGlobals(); | |
| 387 | 387 | if (leaked.length > 0) { | |
| 388 | - fail(`Unexpected global(s) found: ${leaked.join(', ')}`); | ||
| 388 | + assert.fail(`Unexpected global(s) found: ${leaked.join(', ')}`); | ||
| 389 | 389 | } | |
| 390 | 390 | }); | |
| 391 | 391 | ||
@@ -473,14 +473,9 @@ exports.fileExists = function(pathname) { | |||
| 473 | 473 | } | |
| 474 | 474 | }; | |
| 475 | 475 | ||
| 476 | - function fail(msg) { | ||
| 477 | - assert.fail(null, null, msg); | ||
| 478 | - } | ||
| 479 | - exports.fail = fail; | ||
| 480 | - | ||
| 481 | 476 | exports.mustNotCall = function(msg) { | |
| 482 | 477 | return function mustNotCall() { | |
| 483 | - fail(msg || 'function should not have been called'); | ||
| 478 | + assert.fail(msg || 'function should not have been called'); | ||
| 484 | 479 | }; | |
| 485 | 480 | }; | |
| 486 | 481 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -222,7 +222,7 @@ TestSession.prototype.sendInspectorCommands = function(commands) { | |||
| 222 | 222 | }; | |
| 223 | 223 | this.sendAll_(commands, () => { | |
| 224 | 224 | timeoutId = setTimeout(() => { | |
| 225 | - common.fail(`Messages without response: ${ | ||
| 225 | + assert.fail(`Messages without response: ${ | ||
| 226 | 226 | Object.keys(this.messages_).join(', ')}`); | |
| 227 | 227 | }, TIMEOUT); | |
| 228 | 228 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -28,7 +28,7 @@ function callbackOnly(err) { | |||
| 28 | 28 | } | |
| 29 | 29 | ||
| 30 | 30 | function onEvent(err) { | |
| 31 | - common.fail('Error should not be emitted if there is callback'); | ||
| 31 | + assert.fail('Error should not be emitted if there is callback'); | ||
| 32 | 32 | } | |
| 33 | 33 | ||
| 34 | 34 | function onError(err) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -449,7 +449,7 @@ TEST(function test_lookup_all_mixed(done) { | |||
| 449 | 449 | else if (isIPv6(ip.address)) | |
| 450 | 450 | assert.strictEqual(ip.family, 6); | |
| 451 | 451 | else | |
| 452 | - assert(false); | ||
| 452 | + assert.fail('unexpected IP address'); | ||
| 453 | 453 | }); | |
| 454 | 454 | ||
| 455 | 455 | done(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -37,7 +37,7 @@ tls.connect(opts, fail).on('error', common.mustCall((err) => { | |||
| 37 | 37 | })); | |
| 38 | 38 | ||
| 39 | 39 | function fail() { | |
| 40 | - assert(false, 'should fail to connect'); | ||
| 40 | + assert.fail('should fail to connect'); | ||
| 41 | 41 | } | |
| 42 | 42 | ||
| 43 | 43 | // New secure contexts have the well-known root CAs. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,8 +1,9 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | - const common = require('../common'); | ||
| 2 | + require('../common'); | ||
| 3 | + const assert = require('assert'); | ||
| 3 | 4 | ||
| 4 | 5 | process.on('beforeExit', function() { | |
| 5 | - common.fail('exit should not allow this to occur'); | ||
| 6 | + assert.fail('exit should not allow this to occur'); | ||
| 6 | 7 | }); | |
| 7 | 8 | ||
| 8 | 9 | process.exit(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,7 +15,7 @@ switch (process.argv[2] || '') { | |||
| 15 | 15 | case 'spawn': | |
| 16 | 16 | break; | |
| 17 | 17 | default: | |
| 18 | - common.fail(); | ||
| 18 | + assert.fail(); | ||
| 19 | 19 | } | |
| 20 | 20 | ||
| 21 | 21 | function checkExit(statusCode) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,8 +21,7 @@ if (process.argv[2] === 'child') { | |||
| 21 | 21 | ||
| 22 | 22 | child.stderr.setEncoding('utf8'); | |
| 23 | 23 | child.stderr.on('data', function(data) { | |
| 24 | - console.log('parent stderr: ' + data); | ||
| 25 | - assert.ok(false); | ||
| 24 | + assert.fail(`Unexpected parent stderr: ${data}`); | ||
| 26 | 25 | }); | |
| 27 | 26 | ||
| 28 | 27 | // check if we receive both 'hello' at start and 'goodbye' at end | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -33,7 +33,7 @@ if (cluster.isMaster) { | |||
| 33 | 33 | setTimeout(function() { client.end(); }, 50); | |
| 34 | 34 | }).on('error', function(e) { | |
| 35 | 35 | console.error(e); | |
| 36 | - common.fail('server.listen failed'); | ||
| 36 | + assert.fail('server.listen failed'); | ||
| 37 | 37 | cluster.worker.disconnect(); | |
| 38 | 38 | }); | |
| 39 | 39 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -184,15 +184,16 @@ if (process.argv[2] === 'child') { | |||
| 184 | 184 | test.expectedMessages.forEach(function(expectedMessage) { | |
| 185 | 185 | if (test.messagesReceived === undefined || | |
| 186 | 186 | test.messagesReceived.indexOf(expectedMessage) === -1) | |
| 187 | - assert(false, `test ${test.fn.name} should have sent message: ${ | ||
| 188 | - expectedMessage} but didn't`); | ||
| 187 | + assert.fail('test ' + test.fn.name + ' should have sent message: ' + | ||
| 188 | + expectedMessage + ' but didn\'t'); | ||
| 189 | 189 | }); | |
| 190 | 190 | ||
| 191 | 191 | if (test.messagesReceived) { | |
| 192 | 192 | test.messagesReceived.forEach(function(receivedMessage) { | |
| 193 | - if (!test.expectedMessages.includes(receivedMessage)) { | ||
| 194 | - assert(false, `test ${test.fn.name} should not have sent message: ${ | ||
| 195 | - receivedMessage} but did`); | ||
| 193 | + if (test.expectedMessages.indexOf(receivedMessage) === -1) { | ||
| 194 | + assert.fail('test ' + test.fn.name + | ||
| 195 | + ' should not have sent message: ' + receivedMessage + | ||
| 196 | + ' but did'); | ||
| 196 | 197 | } | |
| 197 | 198 | }); | |
| 198 | 199 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments