Skip to content

Commit

Permalink
fix: nodejs 11 support (#3549)
Browse files Browse the repository at this point in the history
Due to an update in the v8 runtime, Node.js `Array.prototype.sort()` is now stable (See [here](nodejs/node#22754 (comment))).

These changes allow for tests to pass on both Node.js 10 and 11.

Fixes #3445
  • Loading branch information
JamieMagee authored and rarkins committed Apr 16, 2019
1 parent 4b9a18f commit 05a46dd
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ notifications:
language: node_js

node_js:
- '10.15.0'
- 'lts/dubnium'
- '11'

sudo: false

Expand Down
4 changes: 2 additions & 2 deletions lib/config/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,10 @@ async function validateConfig(config, isPreset, parentPath) {
}
function sortAll(a, b) {
if (a.depName === b.depName) {
return a.message > b.message;
return a.message > b.message ? 1 : -1;
}
// istanbul ignore next
return a.depName > b.depName;
return a.depName > b.depName ? 1 : -1;
}
errors.sort(sortAll);
warnings.sort(sortAll);
Expand Down
2 changes: 1 addition & 1 deletion lib/versioning/ruby/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const getNewValue = (currentValue, rangeStrategy, fromVersion, toVersion) => {
}
};

const sortVersions = (left, right) => gt(left, right);
const sortVersions = (left, right) => (gt(left, right) ? 1 : -1);

module.exports = {
equals,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
},
"homepage": "https://renovatebot.com",
"engines": {
"node": "^10.13.0"
"node": "^10.13.0 || ^11.0.0"
},
"dependencies": {
"@renovate/pep440": "0.4.1",
Expand Down
8 changes: 4 additions & 4 deletions test/config/__snapshots__/validation.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

exports[`config/validation validateConfig(config) errors for all types 1`] = `
Array [
Object {
"depName": "Configuration Error",
"message": "extends: Invalid timezone: Europe/Brussel",
},
Object {
"depName": "Configuration Error",
"message": "Configuration option \`enabled\` should be boolean. Found: 1 (number)",
Expand Down Expand Up @@ -38,6 +34,10 @@ Array [
"depName": "Configuration Error",
"message": "Invalid schedule: \`Schedule \\"every 15 mins every weekday\\" should not specify minutes\`",
},
Object {
"depName": "Configuration Error",
"message": "extends: Invalid timezone: Europe/Brussel",
},
Object {
"depName": "Configuration Error",
"message": "packageRules must contain JSON objects",
Expand Down

0 comments on commit 05a46dd

Please sign in to comment.