Skip to content

Commit

Permalink
Fix failing tests across browsers
Browse files Browse the repository at this point in the history
  • Loading branch information
cvle committed Nov 23, 2016
1 parent 4948b19 commit d16a568
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 57 deletions.
68 changes: 27 additions & 41 deletions browsers.json
Original file line number Diff line number Diff line change
@@ -1,59 +1,45 @@
{
"BS_Safari": {
"BS_Android4.1": {
"base": "BrowserStack",
"os": "android",
"os_version": "4.1",
"browser": "Android Browser",
"real_mobile": false
},
"BS_MobileSafari8.3": {
"base": "BrowserStack",
"os": "ios",
"os_version": "8.3",
"browser": "Mobile Safari",
"real_mobile": false
},
"BS_Opera22": {
"base": "BrowserStack",
"os": "OS X",
"os_version": "Yosemite",
"browser": "safari",
"browser_version": "8.0"
"browser": "opera",
"browser_version": "22.0"
},
"BS_Safari": {
"BS_Chrome28": {
"base": "BrowserStack",
"os": "OS X",
"os_version": "Mavericks",
"browser": "safari",
"browser_version": "7.0"
"browser": "chrome",
"browser_version": "28.0"
},
"BS_Chrome": {
"BS_Safari8": {
"base": "BrowserStack",
"os": "OS X",
"os_version": "Yosemite",
"browser": "chrome",
"browser_version": "49.0"
"browser": "safari",
"browser_version": "8.0"
},
"BS_Firefox": {
"BS_Firefox25": {
"base": "BrowserStack",
"os": "OS X",
"os_version": "Yosemite",
"browser": "firefox",
"browser_version": "45.0"
},
"BS_MobileSafari": {
"base": "BrowserStack",
"os": "ios",
"os_version": "8.0",
"browser": "iphone",
"real_mobile": false
},
"BS_MobileSafari": {
"base": "BrowserStack",
"os": "ios",
"os_version": "9.0",
"browser": "iphone",
"real_mobile": false
},
"BS_Chrome": {
"base": "BrowserStack",
"os": "Windows",
"os_version": "8.1",
"browser": "chrome",
"browser_version": "49.0"
},
"BS_Firefox": {
"base": "BrowserStack",
"os": "Windows",
"os_version": "8.1",
"browser": "firefox",
"browser_version": "45.0"
"browser_version": "25.0"
},
"BS_InternetExplorer9": {
"base": "BrowserStack",
Expand All @@ -76,11 +62,11 @@
"browser": "ie",
"browser_version": "11.0"
},
"BS_Edge": {
"BS_Edge13": {
"base": "BrowserStack",
"os": "Windows",
"os_version": "10",
"browser": "edge",
"browser_version": "14"
"browser_version": "13.0"
}
}
11 changes: 8 additions & 3 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,21 @@ module.exports = (config) => {
if (useCloud) {
Object.assign(config, {
browsers: Object.keys(browsers),
browserDisconnectTolerance: 3,
// My current OS plan allows max 2 parallel connections.
concurrency: 2,
retryLimit: 3
retryLimit: 3,

// Timeouts taken from https://github.com/karma-runner/karma-browserstack-launcher/issues/61
captureTimeout: 3e5,
browserNoActivityTimeout: 3e5,
browserDisconnectTimeout: 3e5,
browserDisconnectTolerance: 3
})

config.browserStack = {
username: browserStackUserName,
accessKey: browserStackAccessKey,
captureTimeout: 10000
captureTimeout: 3e5
}

if (isTravis) {
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
"all": "npm run lint && npm run test && npm run build",
"build": "npm run clean && npm run build:lib && npm run build:tests && npm run build:dist",
"build:lib": "babel src --out-dir lib",
"build:tests": "npm run build:tests:lib && npm run build:tests:local",
"build:tests:lib": "cross-env NODE_ENV=test babel src --out-dir tests",
"build:tests:local": "cross-env NODE_ENV=test webpack src/index.test.js tmp/tests.js",
"build:tests": "cross-env NODE_ENV=test webpack src/index.test.js tmp/tests.js",
"build:dist": "npm run build:dist:max && npm run build:dist:min",
"build:dist:max": "cross-env NODE_ENV=development webpack src/index.js dist/react-jss.js",
"build:dist:min": "cross-env NODE_ENV=production webpack src/index.js dist/react-jss.min.js",
Expand All @@ -49,6 +47,7 @@
"babel-plugin-transform-es3-property-literals": "^6.8.0",
"babel-preset-es2015": "^6.9.0",
"babel-preset-stage-0": "^6.5.0",
"caniuse-support": "^0.2.0",
"cross-env": "^3.1.3",
"es5-shim": "^4.5.9",
"eslint": "^2.8.0",
Expand All @@ -58,6 +57,7 @@
"eslint-plugin-jsx-a11y": "^1.5.5",
"eslint-plugin-react": "^5.0.1",
"expect.js": "^0.3.1",
"json-loader": "^0.5.4",
"karma": "^1.1.1",
"karma-benchmark": "^0.6.0",
"karma-benchmark-reporter": "^0.1.1",
Expand Down
25 changes: 15 additions & 10 deletions src/index.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
/* eslint-disable func-names, no-console */

import expect from 'expect.js'
import {getSupport, currentBrowser} from 'caniuse-support'

import {prefix, supportedProperty, supportedValue} from './index'

console.log(`Detected browser: ${currentBrowser.id} ${currentBrowser.version}`)

describe('css-vendor', () => {
describe('.prefix', () => {
it('should be correct for .css', () => {
Expand All @@ -22,11 +27,11 @@ describe('css-vendor', () => {
expect(supportedProperty('display')).to.be('display')
})

it('should prefix if needed', () => {
const prop = supportedProperty(`${prefix.css}animation`)
if (prop !== 'animation') {
expect(prop).to.be(`${prefix.css}animation`)
}
it('should prefix if needed', function () {
const {level, needPrefix} = getSupport('transforms2d')
if (level === 'none' || level === 'unknown') this.skip()
const prop = needPrefix ? `${prefix.css}transform` : 'transform'
expect(supportedProperty('transform')).to.be(prop)
})

it('should return false', () => {
Expand All @@ -44,11 +49,11 @@ describe('css-vendor', () => {
expect(supportedValue('color', value)).to.be(value)
})

it('should should prefix if needed', () => {
const value = supportedValue('display', 'flex')
if (value !== 'flex') {
expect(value).to.be(`${prefix.css}flex`)
}
it('should prefix if needed', function () {
const {level, needPrefix} = getSupport('flexbox')
if (level !== 'full') this.skip()
const value = needPrefix ? `${prefix.css}flex` : 'flex'
expect(supportedValue('display', 'flex')).to.be(value)
})

it('should return false for unknown value', () => {
Expand Down
3 changes: 3 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ module.exports = {
loader: 'babel-loader',
test: /\.js$/,
exclude: /node_modules/
}, {
loader: 'json-loader',
test: /\.json$/
}
]
}
Expand Down

0 comments on commit d16a568

Please sign in to comment.