browserstack-capabilities
Advanced tools
Comparing version 0.4.0 to 0.5.0
18
index.js
@@ -43,3 +43,3 @@ var _ = require("lodash"); | ||
var res = request('GET', 'https://api.browserstack.com/4/browsers?flat=true', { | ||
var res = request('GET', 'https://api.browserstack.com/automate/browsers.json', { | ||
'headers': { | ||
@@ -64,6 +64,14 @@ 'Authorization': auth | ||
browserMatches = _.flatten(_.map(rules, function (rule) { | ||
if (rule.browser_version === 'latest') { | ||
var latest_rule = _.clone(rule); | ||
delete latest_rule.browser_version; | ||
return [_.last(_.sortBy(_.filter(browserMatches, latest_rule), ['browser_version']))]; | ||
if (rule.browser_version === 'current') { | ||
var current_rule = _.clone(rule); | ||
delete current_rule.browser_version; | ||
// ignore any browser with a version that can't be determined to be a number | ||
var candidates = _.filter(browserMatches, function(browser) { | ||
return isFinite(browser['browser_version']); | ||
}); | ||
candidates = _.filter(candidates, current_rule); | ||
var current = _.last(_.sortBy(candidates, function(browser) { | ||
return parseFloat(browser['browser_version']); | ||
})); | ||
return current ? [current] : []; | ||
} | ||
@@ -70,0 +78,0 @@ return _.filter(browserMatches, rule); |
{ | ||
"name": "browserstack-capabilities", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "An easier way to generate multiple capabilities based on JSON filters.", | ||
@@ -29,3 +29,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"lodash": "^3.10.1", | ||
"lodash": "^4.17.11", | ||
"sync-request": "^4.0.1" | ||
@@ -35,4 +35,4 @@ }, | ||
"chai": "^3.4.1", | ||
"mocha": "^2.3.4" | ||
"mocha": "^5.2.0" | ||
} | ||
} |
@@ -17,3 +17,4 @@ var expect = require("chai").expect; | ||
os_version: '7', | ||
browser_version: '10.0' | ||
browser_version: '10.0', | ||
real_mobile: null | ||
}, { | ||
@@ -24,3 +25,4 @@ device: null, | ||
os_version: '8', | ||
browser_version: '10.0' | ||
browser_version: '10.0', | ||
real_mobile: null | ||
}]; | ||
@@ -45,3 +47,4 @@ | ||
os_version: '7', | ||
browser_version: '9.0' | ||
browser_version: '9.0', | ||
real_mobile: null | ||
}, { | ||
@@ -52,3 +55,4 @@ device: null, | ||
os_version: '7', | ||
browser_version: '10.0' | ||
browser_version: '10.0', | ||
real_mobile: null | ||
}, { | ||
@@ -59,3 +63,4 @@ device: null, | ||
os_version: '7', | ||
browser_version: '11.0' | ||
browser_version: '11.0', | ||
real_mobile: null | ||
}]; | ||
@@ -80,3 +85,4 @@ | ||
os_version: '8', | ||
browser_version: '10.0' | ||
browser_version: '10.0', | ||
real_mobile: null | ||
}]; | ||
@@ -107,3 +113,4 @@ | ||
os_version: '10', | ||
browser_version: '42.0' | ||
browser_version: '42.0', | ||
real_mobile: null | ||
}, { | ||
@@ -114,3 +121,4 @@ device: null, | ||
os_version: '8.1', | ||
browser_version: '42.0' | ||
browser_version: '42.0', | ||
real_mobile: null | ||
}, { | ||
@@ -121,3 +129,4 @@ device: null, | ||
os_version: '10', | ||
browser_version: '46.0' | ||
browser_version: '46.0', | ||
real_mobile: null | ||
}, { | ||
@@ -128,3 +137,4 @@ device: null, | ||
os_version: '8.1', | ||
browser_version: '46.0' | ||
browser_version: '46.0', | ||
real_mobile: null | ||
}]; | ||
@@ -151,3 +161,4 @@ | ||
os_version: '7', | ||
browser_version: '10.0' | ||
browser_version: '10.0', | ||
real_mobile: null | ||
}, { | ||
@@ -158,3 +169,4 @@ device: null, | ||
os_version: '7', | ||
browser_version: '11.0' | ||
browser_version: '11.0', | ||
real_mobile: null | ||
}]; | ||
@@ -181,3 +193,4 @@ | ||
os_version: '10', | ||
browser_version: '11.0' | ||
browser_version: '11.0', | ||
real_mobile: null | ||
}, | ||
@@ -189,3 +202,4 @@ { | ||
os_version: '8.1', | ||
browser_version: '11.0' | ||
browser_version: '11.0', | ||
real_mobile: null | ||
}, | ||
@@ -197,3 +211,4 @@ { | ||
os_version: '7', | ||
browser_version: '11.0' | ||
browser_version: '11.0', | ||
real_mobile: null | ||
}, | ||
@@ -205,3 +220,4 @@ { | ||
os_version: '7', | ||
browser_version: '10.0' | ||
browser_version: '10.0', | ||
real_mobile: null | ||
}]; | ||
@@ -228,3 +244,4 @@ | ||
os_version: '10', | ||
browser_version: '11.0' | ||
browser_version: '11.0', | ||
real_mobile: null | ||
}, | ||
@@ -236,3 +253,4 @@ { | ||
os_version: '8.1', | ||
browser_version: '11.0' | ||
browser_version: '11.0', | ||
real_mobile: null | ||
}, | ||
@@ -244,3 +262,4 @@ { | ||
os_version: '7', | ||
browser_version: '10.0' | ||
browser_version: '10.0', | ||
real_mobile: null | ||
}]; | ||
@@ -267,3 +286,4 @@ | ||
os_version: '7', | ||
browser_version: '42.0' | ||
browser_version: '42.0', | ||
real_mobile: null | ||
}, | ||
@@ -275,3 +295,4 @@ { | ||
os_version: '8.1', | ||
browser_version: '42.0' | ||
browser_version: '42.0', | ||
real_mobile: null | ||
}, | ||
@@ -283,3 +304,4 @@ { | ||
os_version: '10', | ||
browser_version: '42.0' | ||
browser_version: '42.0', | ||
real_mobile: null | ||
}]; | ||
@@ -306,3 +328,4 @@ | ||
os_version: '10', | ||
browser_version: '11.0' | ||
browser_version: '11.0', | ||
real_mobile: null | ||
}, | ||
@@ -314,3 +337,4 @@ { | ||
os_version: '7', | ||
browser_version: '10.0' | ||
browser_version: '10.0', | ||
real_mobile: null | ||
}]; | ||
@@ -322,7 +346,7 @@ | ||
describe("latest combinations", function () { | ||
it("should take a latest browser_version include", function () { | ||
describe("current combinations", function () { | ||
it("should take a current browser_version include", function () { | ||
var generatedCombo = bsCapabilities.create({ | ||
browser: "ie", | ||
browser_version: ["latest"], | ||
browser_version: ["current"], | ||
os: "Windows", | ||
@@ -338,3 +362,4 @@ os_version: ["XP", "7", "8", "8.1", "10"] | ||
device: null, | ||
browser_version: '8.0' | ||
browser_version: '7.0', | ||
real_mobile: null | ||
}, | ||
@@ -346,3 +371,4 @@ { | ||
device: null, | ||
browser_version: '11.0' | ||
browser_version: '11.0', | ||
real_mobile: null | ||
}, | ||
@@ -354,3 +380,4 @@ { | ||
device: null, | ||
browser_version: '10.0 Metro' | ||
browser_version: '10.0', | ||
real_mobile: null | ||
}, | ||
@@ -362,3 +389,4 @@ { | ||
device: null, | ||
browser_version: '11.0 Metro' | ||
browser_version: '11.0', | ||
real_mobile: null | ||
}, | ||
@@ -370,3 +398,4 @@ { | ||
device: null, | ||
browser_version: '11.0' | ||
browser_version: '11.0', | ||
real_mobile: null | ||
} | ||
@@ -377,3 +406,25 @@ ]; | ||
}); | ||
it("should only take operating system where browser exists", function () { | ||
var generatedCombo = bsCapabilities.create({ | ||
browser: "edge", | ||
browser_version: ["current"], | ||
os: "Windows", | ||
os_version: ["XP", "7", "8", "8.1", "10"] | ||
}); | ||
var expectedCombos = [ | ||
{ | ||
os: 'Windows', | ||
os_version: '10', | ||
browser: 'edge', | ||
device: null, | ||
browser_version: '18.0', | ||
real_mobile: null | ||
} | ||
]; | ||
expect(generatedCombo).to.deep.equal(expectedCombos); | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
431591
11
12484
1
+ Addedlodash@4.17.21(transitive)
- Removedlodash@3.10.1(transitive)
Updatedlodash@^4.17.11