Skip to content
This repository was archived by the owner on Sep 3, 2022. It is now read-only.
Merged
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
21 changes: 21 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,23 @@ jobs:
- run: make test
- store_test_results:
path: junit-reports
coverage:
docker:
- image: circleci/node:8-browsers
steps:
- checkout
- run: npm config set "//registry.npmjs.org/:_authToken" $NPM_AUTH
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to be able to re-use this from the test job, but I couldn't figure out how.

- restore_cache:
key: yarn-dependency-cache-{{ checksum "yarn.lock" }}
- run: yarn install --frozen-lockfile
- save_cache:
key: yarn-dependency-cache-{{ checksum "yarn.lock" }}
paths:
- node_modules
- run: yarn run karma start karma.conf.coverage.js
- store_test_results:
path: junit-reports
- run: yarn run codecov
publish:
docker:
- image: circleci/node:8-browsers
Expand All @@ -31,6 +48,10 @@ workflows:
filters:
tags:
only: /.*/
- coverage:
filters:
tags:
only: /.*/
- deploy:
requires:
- test
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@ test-browser: install
# Default test target.
test: lint test-browser
.PHONY: test

.DEFAULT_GOAL = test
19 changes: 7 additions & 12 deletions karma.conf.ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ module.exports = function(config) {
baseConfig(config);

if (!process.env.SAUCE_USERNAME || !process.env.SAUCE_ACCESS_KEY) {
throw new Error('SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables are required but are missing');
throw new Error(
'SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables are required but are missing'
);
}

config.set({
Expand All @@ -80,24 +82,17 @@ module.exports = function(config) {
suppressPassed: true
},

browsers: ['PhantomJS'].concat(Object.keys(customLaunchers)),

customLaunchers: customLaunchers,

junitReporter: {
outputDir: 'junit-reports',
suite: require('./package.json').name
},

browsers: ['PhantomJS'].concat(Object.keys(customLaunchers)),

customLaunchers: customLaunchers,

sauceLabs: {
testName: require('./package.json').name
}

// Edge and Safari 9 still panic with coverage. Keeping disabled.
// coverageReporter: {
// reporters: [
// { type: 'lcov' }
// ]
// }
});
};
44 changes: 44 additions & 0 deletions karma.conf.coverage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/* eslint-env node */
Copy link
Copy Markdown
Contributor

@fathyb fathyb Jun 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to do the coverage separately? Can't we run test with coverage enabled and then collect coverage data? RTFD 🤦‍♂️

'use strict';

var baseConfig = require('./karma.conf');

module.exports = function(config) {
baseConfig(config);

config.set({
singleRun: true,

reporters: ['spec', 'summary', 'junit', 'coverage'],

specReporter: {
suppressPassed: true
},

junitReporter: {
outputDir: 'junit-reports',
suite: require('./package.json').name
},

coverageReporter: {
reporters: [
{ type: 'lcovonly', subdir: '.' },
{ type: 'json', subdir: '.' }
]
},

browserify: {
debug: true,
transform: [
[
'browserify-istanbul',
{
instrumenterConfig: {
embedSource: true
}
}
]
]
}
});
};
25 changes: 2 additions & 23 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@ module.exports = function(config) {
config.set({
files: [
{ pattern: 'test/support/*.html', included: false },
// NOTE: This must run before all tests
'test/support/global.js',
'test/support/global.js', // NOTE: This must run before all tests
'test/**/*.test.js'
],

browsers: ['PhantomJS'],

frameworks: ['browserify', 'mocha'],

reporters: ['spec'/* , 'coverage' */],
reporters: ['spec'],

preprocessors: {
'test/**/*.js': 'browserify'
Expand All @@ -28,26 +27,6 @@ module.exports = function(config) {

browserify: {
debug: true
// Edge and Safari 9 still panic with coverage. Keeping disabled.
// transform: [
// [
// 'browserify-istanbul',
// {
// instrumenterConfig: {
// embedSource: true
// }
// }
// ]
// ]
}

// Edge and Safari 9 still panic with coverage. Keeping disabled.
// coverageReporter: {
// reporters: [
// { type: 'text' },
// { type: 'html' },
// { type: 'json' }
// ]
// }
});
};
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,16 @@
"@segment/analytics.js-integration": "^3.2.1",
"@segment/eslint-config": "^3.1.1",
"browserify": "13.0.0",
"browserify-istanbul": "^2.0.0",
"codecov": "^3.0.2",
"compat-trigger-event": "^1.0.0",
"component-each": "^0.2.6",
"eslint": "^2.9.0",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-mocha": "^2.2.0",
"eslint-plugin-require-path-exists": "^1.1.5",
"husky": "^0.14.3",
"istanbul": "^0.4.3",
"jquery": "^3.2.1",
"karma": "1.3.0",
"karma-browserify": "^5.0.4",
Expand Down
27 changes: 25 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,10 @@ argparse@^1.0.7:
dependencies:
sprintf-js "~1.0.2"

argv@0.0.2:
version "0.0.2"
resolved "https://registry.yarnpkg.com/argv/-/argv-0.0.2.tgz#ecbd16f8949b157183711b1bda334f37840185ab"

arr-diff@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf"
Expand Down Expand Up @@ -707,6 +711,13 @@ browserify-des@^1.0.0:
des.js "^1.0.0"
inherits "^2.0.1"

browserify-istanbul@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/browserify-istanbul/-/browserify-istanbul-2.0.0.tgz#85a4b425da1f7c09e02ba32a3b44f6535d38c257"
dependencies:
minimatch "^3.0.0"
through "^2.3.8"

browserify-rsa@^4.0.0:
version "4.0.1"
resolved "https://registry.yarnpkg.com/browserify-rsa/-/browserify-rsa-4.0.1.tgz#21e0abfaf6f2029cf2fafb133567a701d4135524"
Expand Down Expand Up @@ -1091,6 +1102,14 @@ code-point-at@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77"

codecov@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/codecov/-/codecov-3.0.2.tgz#aea43843a5cd2fb6b7e488b2eff25d367ab70b12"
dependencies:
argv "0.0.2"
request "^2.81.0"
urlgrey "0.4.4"

collection-visit@^1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0"
Expand Down Expand Up @@ -3021,7 +3040,7 @@ isstream@~0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a"

istanbul@^0.4.0:
istanbul@^0.4.0, istanbul@^0.4.3:
version "0.4.5"
resolved "https://registry.yarnpkg.com/istanbul/-/istanbul-0.4.5.tgz#65c7d73d4c4da84d4f3ac310b918fb0b8033733b"
dependencies:
Expand Down Expand Up @@ -5353,7 +5372,7 @@ through2@^2.0.0:
readable-stream "^2.1.5"
xtend "~4.0.1"

"through@>=2.2.7 <3", through@^2.3.6:
"through@>=2.2.7 <3", through@^2.3.6, through@^2.3.8:
version "2.3.8"
resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5"

Expand Down Expand Up @@ -5565,6 +5584,10 @@ url@~0.11.0:
punycode "1.3.2"
querystring "0.2.0"

urlgrey@0.4.4:
version "0.4.4"
resolved "https://registry.yarnpkg.com/urlgrey/-/urlgrey-0.4.4.tgz#892fe95960805e85519f1cd4389f2cb4cbb7652f"

use@^3.1.0:
version "3.1.0"
resolved "https://registry.npmjs.org/use/-/use-3.1.0.tgz#14716bf03fdfefd03040aef58d8b4b85f3a7c544"
Expand Down