Skip to content

Commit b1f58ed

Browse files
Fishrock123evanlucas
authored andcommitted
test: abstract skip functionality to common
The tap skipping output is so prevalent yet obscure in nature that we ought to move it into it's own function in test/common.js PR-URL: #6697 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Fedor Indutny <[email protected]>
1 parent 7d3f575 commit b1f58ed

File tree

229 files changed

+300
-304
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

229 files changed

+300
-304
lines changed

test/addons/stringbytes-external-exceed-max/test-stringbytes-external-at-max.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@ const assert = require('assert');
88
// v8::String::kMaxLength defined in v8.h
99
const kStringMaxLength = process.binding('buffer').kStringMaxLength;
1010

11-
const skipMessage =
12-
'1..0 # Skipped: intensive toString tests due to memory confinements';
11+
const skipMessage = 'intensive toString tests due to memory confinements';
1312
if (!common.enoughTestMem) {
14-
console.log(skipMessage);
13+
common.skip(skipMessage);
1514
return;
1615
}
1716

@@ -20,13 +19,13 @@ try {
2019
} catch (e) {
2120
// If the exception is not due to memory confinement then rethrow it.
2221
if (e.message !== 'Array buffer allocation failed') throw (e);
23-
console.log(skipMessage);
22+
common.skip(skipMessage);
2423
return;
2524
}
2625

2726
// Ensure we have enough memory available for future allocations to succeed.
2827
if (!binding.ensureAllocation(2 * kStringMaxLength)) {
29-
console.log(skipMessage);
28+
common.skip(skipMessage);
3029
return;
3130
}
3231

test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-ascii.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ const common = require('../../common');
44
const binding = require('./build/Release/binding');
55
const assert = require('assert');
66

7-
const skipMessage =
8-
'1..0 # Skipped: intensive toString tests due to memory confinements';
7+
const skipMessage = 'intensive toString tests due to memory confinements';
98
if (!common.enoughTestMem) {
10-
console.log(skipMessage);
9+
common.skip(skipMessage);
1110
return;
1211
}
1312

@@ -20,13 +19,13 @@ try {
2019
} catch (e) {
2120
// If the exception is not due to memory confinement then rethrow it.
2221
if (e.message !== 'Array buffer allocation failed') throw (e);
23-
console.log(skipMessage);
22+
common.skip(skipMessage);
2423
return;
2524
}
2625

2726
// Ensure we have enough memory available for future allocations to succeed.
2827
if (!binding.ensureAllocation(2 * kStringMaxLength)) {
29-
console.log(skipMessage);
28+
common.skip(skipMessage);
3029
return;
3130
}
3231

test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-base64.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ const common = require('../../common');
44
const binding = require('./build/Release/binding');
55
const assert = require('assert');
66

7-
const skipMessage =
8-
'1..0 # Skipped: intensive toString tests due to memory confinements';
7+
const skipMessage = 'intensive toString tests due to memory confinements';
98
if (!common.enoughTestMem) {
10-
console.log(skipMessage);
9+
common.skip(skipMessage);
1110
return;
1211
}
1312

@@ -20,13 +19,13 @@ try {
2019
} catch (e) {
2120
// If the exception is not due to memory confinement then rethrow it.
2221
if (e.message !== 'Array buffer allocation failed') throw (e);
23-
console.log(skipMessage);
22+
common.skip(skipMessage);
2423
return;
2524
}
2625

2726
// Ensure we have enough memory available for future allocations to succeed.
2827
if (!binding.ensureAllocation(2 * kStringMaxLength)) {
29-
console.log(skipMessage);
28+
common.skip(skipMessage);
3029
return;
3130
}
3231

test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-binary.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ const common = require('../../common');
44
const binding = require('./build/Release/binding');
55
const assert = require('assert');
66

7-
const skipMessage =
8-
'1..0 # Skipped: intensive toString tests due to memory confinements';
7+
const skipMessage = 'intensive toString tests due to memory confinements';
98
if (!common.enoughTestMem) {
10-
console.log(skipMessage);
9+
common.skip(skipMessage);
1110
return;
1211
}
1312

@@ -20,13 +19,13 @@ try {
2019
} catch (e) {
2120
// If the exception is not due to memory confinement then rethrow it.
2221
if (e.message !== 'Array buffer allocation failed') throw (e);
23-
console.log(skipMessage);
22+
common.skip(skipMessage);
2423
return;
2524
}
2625

2726
// Ensure we have enough memory available for future allocations to succeed.
2827
if (!binding.ensureAllocation(2 * kStringMaxLength)) {
29-
console.log(skipMessage);
28+
common.skip(skipMessage);
3029
return;
3130
}
3231

test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-hex.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ const common = require('../../common');
44
const binding = require('./build/Release/binding');
55
const assert = require('assert');
66

7-
const skipMessage =
8-
'1..0 # Skipped: intensive toString tests due to memory confinements';
7+
const skipMessage = 'intensive toString tests due to memory confinements';
98
if (!common.enoughTestMem) {
10-
console.log(skipMessage);
9+
common.skip(skipMessage);
1110
return;
1211
}
1312

@@ -20,13 +19,13 @@ try {
2019
} catch (e) {
2120
// If the exception is not due to memory confinement then rethrow it.
2221
if (e.message !== 'Array buffer allocation failed') throw (e);
23-
console.log(skipMessage);
22+
common.skip(skipMessage);
2423
return;
2524
}
2625

2726
// Ensure we have enough memory available for future allocations to succeed.
2827
if (!binding.ensureAllocation(2 * kStringMaxLength)) {
29-
console.log(skipMessage);
28+
common.skip(skipMessage);
3029
return;
3130
}
3231

test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-utf8.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ const common = require('../../common');
44
const binding = require('./build/Release/binding');
55
const assert = require('assert');
66

7-
const skipMessage =
8-
'1..0 # Skipped: intensive toString tests due to memory confinements';
7+
const skipMessage = 'intensive toString tests due to memory confinements';
98
if (!common.enoughTestMem) {
10-
console.log(skipMessage);
9+
common.skip(skipMessage);
1110
return;
1211
}
1312

@@ -20,13 +19,13 @@ try {
2019
} catch (e) {
2120
// If the exception is not due to memory confinement then rethrow it.
2221
if (e.message !== 'Array buffer allocation failed') throw (e);
23-
console.log(skipMessage);
22+
common.skip(skipMessage);
2423
return;
2524
}
2625

2726
// Ensure we have enough memory available for future allocations to succeed.
2827
if (!binding.ensureAllocation(2 * kStringMaxLength)) {
29-
console.log(skipMessage);
28+
common.skip(skipMessage);
3029
return;
3130
}
3231

test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-2.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ const common = require('../../common');
44
const binding = require('./build/Release/binding');
55
const assert = require('assert');
66

7-
const skipMessage =
8-
'1..0 # Skipped: intensive toString tests due to memory confinements';
7+
const skipMessage = 'intensive toString tests due to memory confinements';
98
if (!common.enoughTestMem) {
10-
console.log(skipMessage);
9+
common.skip(skipMessage);
1110
return;
1211
}
1312

@@ -20,13 +19,13 @@ try {
2019
} catch (e) {
2120
// If the exception is not due to memory confinement then rethrow it.
2221
if (e.message !== 'Array buffer allocation failed') throw (e);
23-
console.log(skipMessage);
22+
common.skip(skipMessage);
2423
return;
2524
}
2625

2726
// Ensure we have enough memory available for future allocations to succeed.
2827
if (!binding.ensureAllocation(2 * kStringMaxLength)) {
29-
console.log(skipMessage);
28+
common.skip(skipMessage);
3029
return;
3130
}
3231

test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ const common = require('../../common');
44
const binding = require('./build/Release/binding');
55
const assert = require('assert');
66

7-
const skipMessage =
8-
'1..0 # Skipped: intensive toString tests due to memory confinements';
7+
const skipMessage = 'intensive toString tests due to memory confinements';
98
if (!common.enoughTestMem) {
10-
console.log(skipMessage);
9+
common.skip(skipMessage);
1110
return;
1211
}
1312

@@ -20,13 +19,13 @@ try {
2019
} catch (e) {
2120
// If the exception is not due to memory confinement then rethrow it.
2221
if (e.message !== 'Array buffer allocation failed') throw (e);
23-
console.log(skipMessage);
22+
common.skip(skipMessage);
2423
return;
2524
}
2625

2726
// Ensure we have enough memory available for future allocations to succeed.
2827
if (!binding.ensureAllocation(2 * kStringMaxLength)) {
29-
console.log(skipMessage);
28+
common.skip(skipMessage);
3029
return;
3130
}
3231

test/common.js

+3
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,9 @@ exports.fail = function(msg) {
465465
assert.fail(null, null, msg);
466466
};
467467

468+
exports.skip = function(msg) {
469+
console.log(`1..0 # Skipped: ${msg}`);
470+
};
468471

469472
// A stream to push an array into a REPL
470473
function ArrayStream() {

test/disabled/tls_server.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ var certPem = fs.readFileSync(common.fixturesDir + '/cert.pem');
1313
try {
1414
var credentials = crypto.createCredentials({key: keyPem, cert: certPem});
1515
} catch (e) {
16-
console.log('1..0 # Skipped: node compiled without OpenSSL.');
16+
common.skip('node compiled without OpenSSL.');
1717
return;
1818
}
1919
var i = 0;

test/internet/test-dgram-broadcast-multi-process.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const messages = [
1616
];
1717

1818
if (common.inFreeBSDJail) {
19-
console.log('1..0 # Skipped: in a FreeBSD jail');
19+
common.skip('in a FreeBSD jail');
2020
return;
2121
}
2222

test/internet/test-dgram-multicast-multi-process.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const listeners = 3;
1717

1818
// Skip test in FreeBSD jails.
1919
if (common.inFreeBSDJail) {
20-
console.log('1..0 # Skipped: In a FreeBSD jail');
20+
common.skip('In a FreeBSD jail');
2121
return;
2222
}
2323

test/internet/test-dns-ipv6.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ let running = false;
1111
const queue = [];
1212

1313
if (!common.hasIPv6) {
14-
console.log('1..0 # Skipped: this test, no IPv6 support');
14+
common.skip('this test, no IPv6 support');
1515
return;
1616
}
1717

test/internet/test-http-https-default-ports.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var common = require('../common');
33
var assert = require('assert');
44

55
if (!common.hasCrypto) {
6-
console.log('1..0 # Skipped: missing crypto');
6+
common.skip('missing crypto');
77
return;
88
}
99
var https = require('https');

test/internet/test-tls-connnect-cnnic.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
var common = require('../common');
1212
if (!common.hasCrypto) {
13-
console.log('1..0 # Skipped: missing crypto');
13+
common.skip('missing crypto');
1414
return;
1515
}
1616

test/internet/test-tls-connnect-melissadata.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
var common = require('../common');
66
if (!common.hasCrypto) {
7-
console.log('1..0 # Skipped: missing crypto');
7+
common.skip('missing crypto');
88
return;
99
}
1010

test/internet/test-tls-reuse-host-from-socket.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var common = require('../common');
33
var assert = require('assert');
44

55
if (!common.hasCrypto) {
6-
console.log('1..0 # Skipped: missing crypto');
6+
common.skip('missing crypto');
77
return;
88
}
99
var tls = require('tls');

test/parallel/test-buffer-alloc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1364,7 +1364,7 @@ if (common.hasCrypto) {
13641364
crypto.createHash('sha1').update(b2).digest('hex')
13651365
);
13661366
} else {
1367-
console.log('1..0 # Skipped: missing crypto');
1367+
common.skip('missing crypto');
13681368
}
13691369

13701370
// Test Compare

test/parallel/test-buffer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1367,7 +1367,7 @@ if (common.hasCrypto) {
13671367
crypto.createHash('sha1').update(b2).digest('hex')
13681368
);
13691369
} else {
1370-
console.log('1..0 # Skipped: missing crypto');
1370+
common.skip('missing crypto');
13711371
}
13721372

13731373
// Test Compare

test/parallel/test-child-process-fork-dgram.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ var assert = require('assert');
1919
var common = require('../common');
2020

2121
if (common.isWindows) {
22-
console.log('1..0 # Skipped: Sending dgram sockets to child processes is ' +
22+
common.skip('Sending dgram sockets to child processes is ' +
2323
'not supported');
2424
return;
2525
}

test/parallel/test-cluster-bind-privileged-port.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ var cluster = require('cluster');
55
var net = require('net');
66

77
if (common.isWindows) {
8-
console.log('1..0 # Skipped: not reliable on Windows.');
8+
common.skip('not reliable on Windows.');
99
return;
1010
}
1111

1212
if (process.getuid() === 0) {
13-
console.log('1..0 # Skipped: Test is not supposed to be run as root.');
13+
common.skip('Test is not supposed to be run as root.');
1414
return;
1515
}
1616

test/parallel/test-cluster-dgram-1.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ var dgram = require('dgram');
99

1010

1111
if (common.isWindows) {
12-
console.log('1..0 # Skipped: dgram clustering is currently not supported ' +
12+
common.skip('dgram clustering is currently not supported ' +
1313
'on windows.');
1414
return;
1515
}

test/parallel/test-cluster-dgram-2.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ var dgram = require('dgram');
88

99

1010
if (common.isWindows) {
11-
console.log('1..0 # Skipped: dgram clustering is currently not supported ' +
11+
common.skip('dgram clustering is currently not supported ' +
1212
'on windows.');
1313
return;
1414
}

test/parallel/test-cluster-dgram-reuse.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const cluster = require('cluster');
55
const dgram = require('dgram');
66

77
if (common.isWindows) {
8-
console.log('1..0 # Skipped: dgram clustering is currently not supported ' +
8+
common.skip('dgram clustering is currently not supported ' +
99
'on windows.');
1010
return;
1111
}

test/parallel/test-cluster-disconnect-handles.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const net = require('net');
1010
const Protocol = require('_debugger').Protocol;
1111

1212
if (common.isWindows) {
13-
console.log('1..0 # Skipped: SCHED_RR not reliable on Windows');
13+
common.skip('SCHED_RR not reliable on Windows');
1414
return;
1515
}
1616

0 commit comments

Comments
 (0)