Skip to content

Commit

Permalink
Add explicit browsers for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Acconut committed Mar 30, 2018
1 parent 9c84b3f commit 1a986b0
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 71 deletions.
25 changes: 21 additions & 4 deletions README.md
Expand Up @@ -57,11 +57,28 @@ Please consult the documentation below for more details.

## Browser support

[![Sauce Test Status](https://saucelabs.com/browser-matrix/marius_transloadit.svg)](https://saucelabs.com/u/marius_transloadit)
<a href="https://browserstack.com">
<img alt="BrowserStack logo" src="demo/browserstack.png" align="right" />
</a>

tus-js-client is tested and known to support following browsers:

* Internet Explorer 10+
* Microsoft Edge 12+
* Mozilla Firefox 14+
* Google Chrome 20+
* Safari 6+
* Opera 12.1+
* TODO

Support in other browsers is very likely but has not been confirimed yet.
Since we only use Web Storage, XMLHttpRequest2, the File API and Blob API,
more than 95% of today's users should be able to use tus-js-client.

Compatability between browsers is continuously ensured by automated tests
in the corresponding browsers on [BrowserStack](https://browserstack.com),
who provide their great service glady for Open Source project for free.

We use localStorage, XMLHttpRequest2, the File API and Blob API. About 85% of
today's users should be able to use this software, calculated using
[iwanttouse.com](http://www.iwanttouse.com/#namevalue-storage,xhr2,fileapi,blobbuilder).

## Node compatibility

Expand Down
89 changes: 43 additions & 46 deletions bin/browserstack-jasmine.js
Expand Up @@ -2,55 +2,52 @@

"use strict";

const fetch = require("node-fetch");
const browserstackRunner = require("browserstack-runner");
const browserstack = require("browserstack-runner");
const BS_USERNAME = process.env.BROWSERSTACK_USERNAME;
const BS_KEY = process.env.BROWSERSTACK_KEY;

fetch(`https://${BS_USERNAME}:${BS_KEY}@api.browserstack.com/5/browsers?flat=true`)
.then(res => {
if (res.ok) {
return res;
} else {
throw new Error(`failed to fetch browser list: ${res.statusText}`);
const browsers = [
"ie_10",
"ie_11",

"edge_previous",
"edge_current",

"chrome_previous",
"chrome_current",

"firefox_previous",
"firefox_current",

"safari_previous",
"safari_current",

"opera_previous",
"opera_current"
];

function runTests(cb) {
browserstack.run({
username: BS_USERNAME,
key: BS_KEY,
test_path: "test/SpecRunner.html",
test_framework: "jasmine2",
test_server_port: 8081,
browsers: browsers
}, function (err, report) {
if (err) {
return cb(err);
}
})
.then(res => res.json())
.then(res => {
return res.filter(({browser, browser_version, os, os_version}) => {
browser_version = parseInt(browser_version, 10);
if (browser === "edge") {
return !true;
}
if (browser === "ie" && os === "Windows" && os_version === "7" && browser_version >= 10) {
return true;
}
return false;
});
})
.then(browsers => {
return new Promise((resolve, reject) => {
browserstackRunner.run({
username: BS_USERNAME,
key: BS_KEY,
test_path: "test/SpecRunner.html",
test_framework: "jasmine2",
test_server_port: 8081,
browsers: browsers
}, function (error, report) {
if (error) {
reject(error);
return;
}
console.log(JSON.stringify(report, null, 2));
console.log("Test Finished");
resolve();
});
});
})
.catch(err => {
console.log(err);
process.exitCode = 1;
});

console.log(JSON.stringify(report, null, 2));
console.log("Test Finished");
cb();
});
}

runTests((err) => {
if (err) {
console.log(err);
process.exitCode = 1;
}
});
61 changes: 42 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Expand Up @@ -37,12 +37,11 @@
"babel-preset-es2015": "^6.1.18",
"babelify": "^7.3.0",
"browserify": "^12.0.0",
"browserstack": "^1.5.0",
"browserstack-runner": "^0.7.0",
"colors": "^1.1.2",
"derequire": "^2.0.3",
"eslint": "^4.19.1",
"exorcist": "^0.4.0",
"get-saucelabs-browsers": "^1.0.1",
"jasmine": "^2.5.2",
"jasmine-ajax": "^3.2.0",
"jasmine-core": "^2.4.1",
Expand Down

0 comments on commit 1a986b0

Please sign in to comment.