Skip to content

Commit 62bfe18

Browse files
Fishrock123Myles Borins
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 Re-do of 52bae22 for v4.x Ref: #6697 PR-URL: #7114 Reviewed-By: Myles Borins <[email protected]>
1 parent 3189446 commit 62bfe18

File tree

219 files changed

+291
-294
lines changed

Some content is hidden

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

219 files changed

+291
-294
lines changed

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

Lines changed: 4 additions & 5 deletions
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 !== 'Invalid array buffer length') 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

Lines changed: 4 additions & 5 deletions
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 !== 'Invalid array buffer length') 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

Lines changed: 4 additions & 5 deletions
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 !== 'Invalid array buffer length') 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

Lines changed: 4 additions & 5 deletions
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 !== 'Invalid array buffer length') 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

Lines changed: 4 additions & 5 deletions
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 !== 'Invalid array buffer length') 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

Lines changed: 4 additions & 5 deletions
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 !== 'Invalid array buffer length') 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

Lines changed: 4 additions & 5 deletions
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 !== 'Invalid array buffer length') 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

Lines changed: 4 additions & 5 deletions
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 !== 'Invalid array buffer length') 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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,10 @@ exports.fail = function(msg) {
459459
assert.fail(null, null, msg);
460460
};
461461

462+
exports.skip = function(msg) {
463+
console.log(`1..0 # Skipped: ${msg}`);
464+
};
465+
462466
// Returns true if the exit code "exitCode" and/or signal name "signal"
463467
// represent the exit code and/or signal name of a node process that aborted,
464468
// false otherwise.

test/disabled/tls_server.js

Lines changed: 1 addition & 1 deletion
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;

0 commit comments

Comments
 (0)