Skip to content

Commit

Permalink
test: only include custom-elements-es5-adapter for non-IE11 ES5 tests #…
Browse files Browse the repository at this point in the history
  • Loading branch information
hotforfeature committed Oct 20, 2017
1 parent 0e6d9ec commit 4de9538
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ addons:
script:
- npm run bower
- npm run test:ci
- npm run test:ci:es5
- npm run test:ci:ie11
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@
"lint": "tslint --project origami/tsconfig.json",
"bower": "bower install",
"test": "karma start",
"test:es5": "ES5=true karma start",
"test:watch": "karma start --auto-watch --no-single-run --browsers Chrome",
"test:ci": "CI=true karma start",
"test:ci:es5": "ES5=true CI=true karma start",
"test:ci:ie11": "IE11=true ES5=true CI=true karma start",
"precommit": "npm run lint",
"commitmsg": "validate-commit-msg",
"commit": "git-cz",
Expand Down
30 changes: 21 additions & 9 deletions test/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module.exports = function(config) {
const CI = Boolean(process.env.CI);
const ES5 = Boolean(process.env.ES5);
const IE11 = Boolean(process.env.IE11);
const TRAVIS = Boolean(process.env.TRAVIS);
const COVERAGE = !CI;

Expand All @@ -15,7 +17,6 @@ module.exports = function(config) {
require('karma-mocha-reporter')
],
files: [
'./bower_components/webcomponentsjs/custom-elements-es5-adapter.js',
'./bower_components/webcomponentsjs/webcomponents-loader.js',
{ pattern: './bower_components/**/*', watched: false, included: false, served: true },
{ pattern: './test/karma-shim.js', watched: false }
Expand Down Expand Up @@ -57,6 +58,11 @@ module.exports = function(config) {
}
};

if (ES5 && !IE11) {
configuration.files.splice(0, 0,
'./bower_components/webcomponentsjs/custom-elements-es5-adapter.js');
}

if (COVERAGE) {
configuration.plugins.push(require('karma-coverage-istanbul-reporter'));
configuration.reporters.push('coverage-istanbul');
Expand All @@ -75,19 +81,12 @@ module.exports = function(config) {
if (CI) {
configuration.plugins.push(require('karma-sauce-launcher'));
configuration.sauceLabs = {
testName: 'Origami Karma',
testName: ES5 ? 'Origami Karma (ES5)' : 'Origami Karma',
startConnect: TRAVIS ? false : true,
tunnelIdentifier: TRAVIS ? process.env.TRAVIS_JOB_NUMBER : undefined
};

// IE11 takes a while and doesn't respond
configuration.browserNoActivityTimeout = 5 * 60 * 1000;
configuration.customLaunchers = {
SL_IE_11: {
base: 'SauceLabs',
browserName: 'internet explorer',
version: '11'
},
SL_Chrome: {
base: 'SauceLabs',
browserName: 'chrome',
Expand Down Expand Up @@ -130,6 +129,19 @@ module.exports = function(config) {
}
};

if (ES5 && IE11) {
configuration.sauceLabs.testName += ' (IE11)';
// IE11 takes a while and doesn't respond
configuration.browserNoActivityTimeout = 5 * 60 * 1000;
configuration.customLaunchers = {
SL_IE_11: {
base: 'SauceLabs',
browserName: 'internet explorer',
version: '11'
}
};
}

configuration.browsers = Object.keys(configuration.customLaunchers);
configuration.reporters.push('saucelabs');
}
Expand Down
4 changes: 2 additions & 2 deletions test/webpack.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const path = require('path');
const webpack = require('webpack');

const ES5 = Boolean(process.env.ES5);
const ROOT = path.resolve(__dirname, '..');

function root(args) {
Expand All @@ -9,8 +10,7 @@ function root(args) {
}

const compilerOptions = require(root('tsconfig.json')).compilerOptions;
// TODO: ES5 and ES6 tests
compilerOptions.target = 'ES5';
compilerOptions.target = ES5 ? 'ES5' : 'ES6';
compilerOptions.module = 'commonjs';
compilerOptions.declaration = false;
compilerOptions.silent = true;
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"target": "ES5"
"target": "ES6"
}
}

0 comments on commit 4de9538

Please sign in to comment.