Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Webpack build, Karma tests #46

Closed
wants to merge 13 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"presets": [
["env", {
"targets": {
"browsers": ["last 2 Chrome versions","last 2 Firefox versions","Firefox ESR","last 2 Safari versions","IE >= 9"]
},
"useBuiltins": true,
"debug": true
}]
]
}
8 changes: 7 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@
"env": {
"browser": true,
"commonjs": true,
"mocha": true
"es6": true,
"mocha": true,
"node": true
},
"parserOptions": {
"sourceType": "module"
},
"globals": {
"VERSION": false,
"expect": false,
"sinon": false,
"chai": false
Expand Down
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.3.0
6.11.0
16 changes: 4 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
language: node_js
node_js:
- '6.3.0'
before_install:
- export PATH=$PWD/travis_phantomjs/phantomjs-$PHANTOMJS_VERSION-linux-x86_64/bin:$PATH
- if [ $(phantomjs --version) != '$PHANTOMJS_VERSION' ]; then rm -rf $PWD/travis_phantomjs; mkdir -p $PWD/travis_phantomjs; fi
- if [ $(phantomjs --version) != '$PHANTOMJS_VERSION' ]; then wget https://github.com/Medium/phantomjs/releases/download/v$PHANTOMJS_VERSION/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2 -O $PWD/travis_phantomjs/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2; fi
- if [ $(phantomjs --version) != '$PHANTOMJS_VERSION' ]; then tar -xvf $PWD/travis_phantomjs/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2 -C $PWD/travis_phantomjs; fi
- phantomjs --version
before_script:
- npm install -g grunt-cli
- '6.11.0'
sudo: false
dist: trusty
cache:
directories:
- node_modules
- travis_phantomjs
branches:
only: [master]
env:
- PHANTOMJS_VERSION=2.1.1
addons:
sauce_connect: true
27 changes: 0 additions & 27 deletions bower.json

This file was deleted.

5 changes: 5 additions & 0 deletions browserslist
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
last 2 Chrome versions
last 2 Firefox versions
Firefox ESR
last 2 Safari versions
IE >= 9
143 changes: 143 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
const webpackConfig = require('./webpack.config')({
dev: true
});

const customLaunchers = {
SL_IE_Windows_8_1: {
base: 'SauceLabs',
browserName: 'internet explorer',
version: 'latest',
platform: 'Windows 8.1'
},
SL_MicrosoftEdge_Latest_Windows_10: {
base: 'SauceLabs',
browserName: 'MicrosoftEdge',
version: 'latest',
platform: 'Windows 10'
},
SL_Firefox_OSX_Prev_10_12: {
base: 'SauceLabs',
browserName: 'firefox',
version: 'latest-1',
platform: 'OS X 10.12'
},
SL_Firefox_OSX_Latest_10_12: {
base: 'SauceLabs',
browserName: 'firefox',
version: 'latest',
platform: 'OS X 10.12'
},
SL_Chrome_Prev_Linux: {
base: 'SauceLabs',
browserName: 'chrome',
version: 'latest-1',
platform: 'linux'
},
SL_Chrome_Latest_Linux: {
base: 'SauceLabs',
browserName: 'chrome',
version: 'latest',
platform: 'linux'
},
SL_Firefox_Prev_Windows_10: {
base: 'SauceLabs',
browserName: 'firefox',
version: 'latest-1',
platform: 'Windows 10'
},
SL_Firefox_Latest_Windows_10: {
base: 'SauceLabs',
browserName: 'firefox',
version: 'latest',
platform: 'Windows 10'
},
SL_Chrome_Prev_OSX_10_12: {
base: 'SauceLabs',
browserName: 'chrome',
version: 'latest-1',
platform: 'OS X 10.12'
},
SL_Chrome_Latest_OSX_10_12: {
base: 'SauceLabs',
browserName: 'chrome',
version: 'latest',
platform: 'OS X 10.12'
},
SL_Chrome_Prev_Windows_10: {
base: 'SauceLabs',
browserName: 'chrome',
version: 'latest-1',
platform: 'Windows 10'
},
SL_Chrome_Latest_Windows_10: {
base: 'SauceLabs',
browserName: 'chrome',
version: 'latest',
platform: 'Windows 10'
}
};

module.exports = function(config) {
config.set({
frameworks: [
'mocha',
'chai',
'sinon-chai',
'chai-as-promised'
],

files: [
{
pattern: 'spec/test_index.js',
watched: false
},
],

browsers: [
'Chrome'
],

reporters: [
'mocha'
],

sauceLabs: {
testName: 'zendesk_app_framework_sdk mocha tests',
startConnect: true
},

customLaunchers,

preprocessors: {
'spec/test_index.js': [
'webpack',
'sourcemap'
]
},

webpack: {
devtool: 'inline-source-map',
context: webpackConfig.context,
module: webpackConfig.module,
plugins: webpackConfig.plugins
},

webpackMiddleware: {
noInfo: true,
stats: 'errors-only'
}
});

if (process.env.TRAVIS) {
config.browsers = Object.keys(customLaunchers);
config.browserNoActivityTimeout = 20000;
config.browserDisconnectTolerance = 3;

config.singleRun = true;

config.sauceLabs.startConnect = false;
config.sauceLabs.recordScreenshots = true;
config.sauceLabs.tunnelIdentifier = process.env.TRAVIS_JOB_NUMBER;
config.sauceLabs.build = `TRAVIS #${process.env.TRAVIS_BUILD_NUMBER} (${process.env.TRAVIS_BUILD_ID})`;
}
};
Loading