Skip to content

Commit

Permalink
Saucelabs integration (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
citizensas authored Mar 20, 2017
1 parent 9f9331c commit da6e4b7
Show file tree
Hide file tree
Showing 8 changed files with 162 additions and 153 deletions.
13 changes: 7 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ node_js:
- '6'
- '4'

script: npm run ci-test
env:
global:
- secure: PGLnN1ksLylD9BpxnKQymWfi6GpcGUuqkOlEJqA6yJp4oq7itvlPENtDYylVqmD3LM7tgFUk8PJHFsKDBY1d2dK6uqleKVMI0u49vZcAf4uIqDTJh1CEGhEMCZY7tgdLiGyjwSMzh/GqkJWia9hOCWSnpCmZi3gL/aaI46bm1aY=
- secure: E3GeYXyCZO/inAMVX+JZMtiJ2ocSTOkIsuML0tTWbHtd8abtX4hOkXqIlSE5WOqO1LnYX43Qs96iysg+D6S+JUlbESsU2+otl0PBV+cE8KMh23c8bUXCZ6NKAKGXXFTWc1UkeAqv8jeq+TSp2WtyBANXJWhaFNYnGOAN1jcvcUc=
matrix:
- CI=TRAVIS
- secure: Zmndw3YPp7JUPHRWfzF6ieqwDqWs4GnKMqXNaPNCcY1D76rH2CGTe6YQHhvNEgIm5UItH39x306TMWjqZfCFUVpAks8AQEigADAMPbgqLg8JG4QVIb1sQiZPiVHJA5Ho6YNB4hqv3fp+D9DWRDIMiLYmWiRD8/hFaow/xkfMyiA=
- secure: jdw+OA04vF8+t+iOkWRfDWexKGVxrjpt8iwkY/CBnmANFQckseLwVrDJyHrjcxQlY7SlkSudMNXizINKJDldPx4BBlt1I6n7441CYQ2KpRqzAQXgLPWy+Ea/lM2QcSfihG/xC8Q30CVfMUTZTZx/6nUlIoeB2eItzy9+KsE9UaU=

matrix:
include:
- node_js: '6'
env: CI=BS
env: CI_MODE=saucelabs
addons:
sauce_connect: true

after_success: codecov
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# workfront-api
[![NPM version][npm-version-image]][npm-url] [![NPM downloads][npm-downloads-image]][npm-url] [![Apache v2 License][license-image]][license-url] [![Build Status][travis-image]][travis-url] ![BrowserStack Status][browserstack-url] [![Coverage][coveralls-image]][coveralls-url] [![Code Climate][code-climate-image]][code-climate-url]
[![NPM version][npm-version-image]][npm-url] [![NPM downloads][npm-downloads-image]][npm-url] [![Apache v2 License][license-image]][license-url] [![Build Status][travis-image]][travis-url] [![Coverage][coveralls-image]][coveralls-url] [![Code Climate][code-climate-image]][code-climate-url]
[![Build Status][saucelabs-badge]][saucelabs-url]

Thanks to [BrowserStack](https://www.browserstack.com/), the code is tested against `Chrome 56`, `Firefox 52`, `IE 11` and `Safari 10`.
[![Build Status][saucelabs-matrix]][saucelabs-url]

## Usage

Expand Down Expand Up @@ -115,4 +116,6 @@ See the top-level file `LICENSE` and
[code-climate-url]: https://codeclimate.com/github/Workfront/workfront-api
[code-climate-image]: https://img.shields.io/codeclimate/github/Workfront/workfront-api.svg?style=flat

[browserstack-url]: https://www.browserstack.com/automate/badge.svg?badge_key=UlhFQU9IS014UmVHQ0tNVTdnK09ZRWdTdDdUcHpsSC90QXVJd2RIeGlrYz0tLUdybk9DbGxzalkxS2h6MlFrRWF3Tmc9PQ==--e8c67fb780c7cfc1b77d5ed945e7e91644c950cd
[saucelabs-badge]: https://saucelabs.com/buildstatus/citizensas
[saucelabs-url]: https://saucelabs.com/beta/builds/1b8be6f71455499c82f02afc881e6c14
[saucelabs-matrix]: https://saucelabs.com/browser-matrix/citizensas.svg
65 changes: 0 additions & 65 deletions karma-ci.conf.js

This file was deleted.

111 changes: 77 additions & 34 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,9 @@
'use strict'

const webpackConfig = require('./webpack.config')
webpackConfig.devtool = 'inline-source-map'

webpackConfig.resolve.alias = webpackConfig.resolve.alias || {}

// Conditional requires workaround (https://github.com/sinonjs/sinon/issues/830)
webpackConfig.resolve.alias.sinon ='sinon/pkg/sinon'

webpackConfig.module.rules = webpackConfig.module.rules || []
webpackConfig.module.rules.push({
test: /\.[tj]s$/,
enforce: 'post',
exclude: /(test-bundle\.js|\.spec|node_modules|mock|\.mock|\.stub)/,
use: {
loader: 'istanbul-instrumenter-loader',
options: {
esModules: true,
produceSourceMap: true
}
}
})
const CI = process.env.CI
const CI_MODE = process.env.CI_MODE

webpackConfig.externals = [
]
process.env.WEBPACK_ENV = 'test'

module.exports = function (config) {
config.set({
Expand Down Expand Up @@ -54,7 +34,7 @@ module.exports = function (config) {
'test/test-bundle.js': ['webpack', 'sourcemap']
},

webpack: webpackConfig,
webpack: require('./webpack.config'),

// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
Expand All @@ -64,26 +44,89 @@ module.exports = function (config) {

coverageReporter: {
reporters: [
{type: 'in-memory'},
// generates ./coverage/lcov.info
{type: 'lcov', subdir: '.'},
// generates ./coverage/coverage-final.json
{type: 'json', subdir: '.'}
{type: 'in-memory'}
]
},

remapOptions: {
warn: function() {}
},
remapCoverageReporter: {
'text-summary': null, // to show summary in console
html: './coverage'
// warn: function() {}
},
remapCoverageReporter: (function () {
if (CI) {
return {
'text-summary': null,
lcovonly: './coverage'
}
}
return {
'text-summary': null,
// to show summary in console
html: './coverage'
}
})(),

// make sure both reporter plugins are loaded
// plugins: ['karma-coverage', 'karma-remap-coverage'],

port: 9876,
colors: true,
autoWatch: false,
browsers: ['PhantomJS'],
singleRun: true
})

if (CI_MODE === 'saucelabs') {
const chrome = {
'SL_Chrome_Latest': {version: 'latest', platform: 'OS X 10.11', browserName: 'chrome', base: 'SauceLabs'},
'SL_Chrome_Latest-1': {version: 'latest-1', platform: 'OS X 10.11', browserName: 'chrome', base: 'SauceLabs'},
'SL_Chrome_Latest-2': {version: 'latest-2', platform: 'OS X 10.11', browserName: 'chrome', base: 'SauceLabs'}
}
const firefox = {
'SL_Firefox_Latest': {version: 'latest', platform: 'OS X 10.11', browserName: 'firefox', base: 'SauceLabs'},
'SL_Firefox_Latest-1': {version: 'latest-1', platform: 'OS X 10.11', browserName: 'firefox', base: 'SauceLabs'},
'SL_Firefox_Latest-2': {version: 'latest-2', platform: 'OS X 10.11', browserName: 'firefox', base: 'SauceLabs'}
}
const safari = {
'SL_Safari_Latest': {version: 'latest', platform: 'OS X 10.12', browserName: 'safari', base: 'SauceLabs'},
'SL_Safari_10': {version: '10.0', platform: 'OS X 10.11', browserName: 'safari', base: 'SauceLabs'},
'SL_Safari_9': {version: '9.0', platform: 'OS X 10.11', browserName: 'safari', base: 'SauceLabs'}
}
const ie = {
'SL_InternetExplorer_11': {version: '11.0', platform: 'Windows 7', browserName: 'internet explorer', base: 'SauceLabs'},
'SL_InternetExplorer_10': {version: '10.0', platform: 'Windows 7', browserName: 'internet explorer', base: 'SauceLabs'},
'SL_InternetExplorer_9': {version: '9.0', platform: 'Windows 7', browserName: 'internet explorer', base: 'SauceLabs'}
}
const edge = {
'SL_Edge_Latest': {version: 'latest', platform: 'Windows 10', browserName: 'MicrosoftEdge', base: 'SauceLabs'},
'SL_Edge_14': {version: '14.14393', platform: 'Windows 10', browserName: 'MicrosoftEdge', base: 'SauceLabs'},
'SL_Edge_13': {version: '13.10586', platform: 'Windows 10', browserName: 'MicrosoftEdge', base: 'SauceLabs'}
}
const linux = {
'SL_Chrome_Linux': {version: 'latest', platform: 'Linux', browserName: 'chrome', base: 'SauceLabs'},
'SL_Firefox_Linux': {version: 'latest', platform: 'Linux', browserName: 'firefox', base: 'SauceLabs'},
}

// Browsers to run on Sauce Labs
const customLaunchers = Object.assign({}, chrome, firefox, safari, ie, edge, linux)

// Override config for CI.
config.set({
reporters: ['progress', 'saucelabs'],
sauceLabs: {
testName: 'workfront-api',
recordScreenshots: false,
recordVideo: false,
connectOptions: {
port: 5757
},
public: 'public'
},
captureTimeout: 120000,
customLaunchers: customLaunchers,

// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: Object.keys(customLaunchers)
})
}
}
21 changes: 7 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
"description": "A Workfront API for the Node.js and the Web",
"main": "dist/workfront.js",
"dependencies": {
"es6-promise": "4.0.5",
"form-data": "0.2.0",
"es6-promise": "4.1.0",
"form-data": "2.1.2",
"isomorphic-fetch": "2.2.1",
"workfront-api-constants": "2.0.0"
},
"devDependencies": {
"@types/mocha": "2.2.39",
"@types/mocha": "2.2.40",
"@types/node": "7.0.8",
"@types/should": "8.1.30",
"@types/sinon": "1.16.35",
"codecov": "1.0.1",
"codecov": "2.1.0",
"dateformat": "1.0.12",
"del": "1.2.1",
"fetch-mock": "5.9.4",
Expand All @@ -29,7 +29,6 @@
"http-server": "0.9.0",
"istanbul-instrumenter-loader": "2.0.0",
"karma": "1.5.0",
"karma-browserstack-launcher": "1.2.0",
"karma-chrome-launcher": "2.0.0",
"karma-cli": "1.0.1",
"karma-coverage": "1.1.1",
Expand All @@ -38,22 +37,17 @@
"karma-remap-coverage": "0.1.4",
"karma-sauce-launcher": "1.1.0",
"karma-sourcemap-loader": "0.3.7",
"karma-spec-reporter": "0.0.30",
"karma-webpack": "2.0.2",
"karma-webpack": "2.0.3",
"mocha": "3.2.0",
"npm-run-all": "4.0.2",
"phantomjs-polyfill-object-assign": "0.0.2",
"phantomjs-prebuilt": "2.1.14",
"remap-istanbul": "0.9.1",
"requirejs": "2.3.3",
"semver": "5.1.0",
"shelljs": "0.5.3",
"should": "11.2.1",
"should-sinon": "0.0.5",
"should-spies": "1.1.0",
"sinon": "^1.12.2",
"source-map-loader": "0.1.6",
"ts-loader": "2.0.1",
"sinon": "2.0.0",
"ts-loader": "2.0.2",
"tslib": "1.6.0",
"tslint": "4.5.1",
"tslint-loader": "3.4.3",
Expand All @@ -65,7 +59,6 @@
},
"scripts": {
"test": "karma start karma.conf.js",
"ci-test": "karma start karma-ci.conf.js && codecov",
"build": "webpack -p --bail",
"update-online-docs": "gulp publish-docs",
"prepublish": "npm run build",
Expand Down
2 changes: 1 addition & 1 deletion test/test-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

// require all modules ending in ".spec.js", ".spec.ts" from the
// current directory and all subdirectories
var testsContext = require.context('./', true, /\.spec\.[t]s$/)
var testsContext = require.context('.', true, /\.spec\.[t]s$/)
testsContext.keys().forEach(testsContext)
5 changes: 3 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"compilerOptions": {
"allowJs": true,
"importHelpers": true,
"module": "es6",
"moduleResolution": "node",
"noEmitHelpers": true,
"noImplicitAny": false,
"noLib": true,
"noUnusedLocals": true,
"sourceMap": true,
"outDir": "./es",
"moduleResolution": "node",
"target": "es5"
},
"compileOnSave": false,
Expand All @@ -22,6 +22,7 @@
],
"exclude": [
"node_modules",
"coverage",
"dist"
]
}
Loading

0 comments on commit da6e4b7

Please sign in to comment.