Socket
Socket
Sign inDemoInstall

polyfill-io-feature-detection

Package Overview
Dependencies
0
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.11 to 1.1.12

.vscode/settings.json

3

package.json
{
"name": "polyfill-io-feature-detection",
"version": "1.1.11",
"version": "1.1.12",
"description": "Feature detection in the browser before loading polyfill using services like polyfill.io",

@@ -28,2 +28,3 @@ "license": "MIT",

"chai": "3.5.0",
"chakram": "^1.5.0",
"mocha": "3.2.0"

@@ -30,0 +31,0 @@ },

@@ -8,2 +8,3 @@ /*

var pf = require('./../../index.js');
var chakram = require('chakram');

@@ -22,6 +23,10 @@ describe('Polyfill Loader Tests for IE 11', function () {

setTimeout(function () {
if (obj.onload) {
obj.onload();
if (obj.src.indexOf("https://error") > -1) {
obj.onerror();
} else {
obj.onerror();
if (obj.onload) {
obj.onload();
} else {
obj.onerror();
}
}

@@ -73,2 +78,49 @@ }, 500);

it('should call my custom service if configured as parameter polyfillService', function (done) {
var features = "Promise";
function main(data) {
expect(data).to.eq('https://myservice?features=Promise&flags=gated,always');
// this test is done, go to the next one
done();
}
pf.polyfillLoader({
"onCompleted": main,
"features": features,
"polyfillService": "https://myservice"
});
});
it('should call main with error parameter when failed to load the script', function (done) {
var features = "Promise";
function main(data) {
expect(data.toString()).to.eq((new Error('Failed to load script https://error?features=Promise&flags=gated,always')).toString());
// this test is done, go to the next one
done();
}
pf.polyfillLoader({
"onCompleted": main,
"features": features,
"polyfillService": "https://error"
});
});
it("should have polyfill.io service enable on default and returning 200 status", function (done) {
// this.timeout(5000);
var features = "Promise,Date.now";
function main(data) {
expect(data).to.eq("https://cdn.polyfill.io/v2/polyfill.min.js?features=Promise&flags=gated,always");
var Ie11UA = "Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko";
return chakram.get(data + "&ua=" + encodeURIComponent(Ie11UA))
.then(function (response) {
chakram.expect(response).to.have.status(200);
done();
});
}
pf.polyfillLoader({
"onCompleted": main,
"features": features
});
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc