Abstracted check for Node v6

This commit is contained in:
Scott Kyle 2016-05-10 11:34:33 -07:00
parent 4a5ac413cc
commit 4300e865c7
2 changed files with 9 additions and 1 deletions

View File

@ -109,6 +109,14 @@ module.exports = {
throw new TestFailureError(errorMessage || 'Condition expected to be true');
}
},
isNode: function() {
return typeof process == 'object' && Object.prototype.toString.call(process) == '[object process]';
},
isNode6: function() {
return this.isNode() && process.version.indexOf('v6.') == 0;
},
};
function TestFailureError(message) {

View File

@ -556,7 +556,7 @@ module.exports = BaseTest.extend({
// A Node 6 regression in v8 causes an error when converting our objects to strings:
// TypeError: Cannot convert a Symbol value to a string
if (typeof process != 'object' || ('' + process.version).indexOf('v6.') < 0) {
if (!TestCase.isNode6()) {
TestCase.assertEqual(list.join(' '), 'Ari Tim Bjarne');
}