Skip to content

Commit

Permalink
chore: update code coverage (#254)
Browse files Browse the repository at this point in the history
* chore: combine code coverage from multiple browsers

* chore: add firefox to browser list

* test: cover requestIdleCallback

* test: avoid running Firefox in Travis.
  • Loading branch information
doctyper authored and cwelch5 committed Mar 28, 2017
1 parent b8504c6 commit 2cc70de
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 24 deletions.
14 changes: 3 additions & 11 deletions karma.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,11 @@ module.exports = function (config) {
},

coverageReporter: {
dir: "coverage",
dir: "coverage/json",
includeAllSources: true,
reporters: [{
type: "html",
type: "json",
subdir: normalizationBrowserName
}, {
type: "text",
subdir: ".",
file: "text.txt"
}, {
type: "lcov",
subdir: ".",
file: "lcov.info"
}]
},

Expand Down Expand Up @@ -98,7 +90,7 @@ module.exports = function (config) {
// - IE (only Windows; has to be installed with `npm install karma-ie-launcher`)
browsers: process.env.TRAVIS
? ["ChromeTravis", "PhantomJS"]
: ["Chrome", "PhantomJS"],
: ["Chrome", "PhantomJS", "Firefox"],

customLaunchers: {
ChromeTravis: {
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,13 @@
"eslint-plugin-jsx-a11y": "^4.0.0",
"eslint-plugin-mocha": "^4.9.0",
"eslint-plugin-react": "^6.10.2",
"istanbul": "^0.4.5",
"karma": "^1.5.0",
"karma-chai": "^0.1.0",
"karma-chai-sinon": "^0.1.5",
"karma-chrome-launcher": "^2.0.0",
"karma-coverage": "^1.1.1",
"karma-firefox-launcher": "^1.0.1",
"karma-html-reporter": "^0.2.7",
"karma-mocha": "^1.3.0",
"karma-phantomjs-launcher": "^1.0.4",
Expand All @@ -85,7 +87,7 @@
"clean": "rimraf lib coverage es",
"lint": "eslint --ignore-path .gitignore -- .",
"test": "cross-env BABEL_ENV=test karma start karma.config.js",
"posttest": "cat ./coverage/text.txt",
"posttest": "istanbul report lcov text",
"pretest": "npm run clean && npm run lint",
"commit": "git-cz",
"compile": "npm run compile:commonjs && npm run compile:es",
Expand Down
20 changes: 20 additions & 0 deletions test/HelmetDeclarativeTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -3221,5 +3221,25 @@ describe("Helmet - Declarative API", () => {
done();
});
});

it("requestIdleCallback works as expected", (done) => {
requestIdleCallback((cb) => {
expect(cb).to.exist;

expect(cb)
.to.have.property("didTimeout")
.that.is.a("boolean")
.that.equals(false);

expect(cb)
.to.have.property("timeRemaining")
.that.is.a("function");

const time = cb.timeRemaining();
expect(time).to.be.a("number");

done();
});
});
});
});
20 changes: 20 additions & 0 deletions test/HelmetTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -2811,5 +2811,25 @@ describe("Helmet", () => {
done();
});
});

it("requestIdleCallback works as expected", (done) => {
requestIdleCallback((cb) => {
expect(cb).to.exist;

expect(cb)
.to.have.property("didTimeout")
.that.is.a("boolean")
.that.equals(false);

expect(cb)
.to.have.property("timeRemaining")
.that.is.a("function");

const time = cb.timeRemaining();
expect(time).to.be.a("number");

done();
});
});
});
});
18 changes: 6 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2895,7 +2895,7 @@ istanbul-lib-instrument@^1.4.2:
istanbul-lib-coverage "^1.0.0"
semver "^5.3.0"

istanbul@^0.4.0:
istanbul@^0.4.0, istanbul@^0.4.5:
version "0.4.5"
resolved "https://registry.yarnpkg.com/istanbul/-/istanbul-0.4.5.tgz#65c7d73d4c4da84d4f3ac310b918fb0b8033733b"
dependencies:
Expand Down Expand Up @@ -3027,6 +3027,10 @@ karma-coverage@^1.1.1:
minimatch "^3.0.0"
source-map "^0.5.1"

karma-firefox-launcher@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/karma-firefox-launcher/-/karma-firefox-launcher-1.0.1.tgz#ce58f47c2013a88156d55a5d61337c099cf5bb51"

karma-html-reporter@^0.2.7:
version "0.2.7"
resolved "https://registry.yarnpkg.com/karma-html-reporter/-/karma-html-reporter-0.2.7.tgz#fd73da9f1ac99fd5bafb309cf070942188e7ba63"
Expand Down Expand Up @@ -3741,10 +3745,6 @@ path-is-inside@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53"

path-parse@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1"

path-to-regexp@^1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-1.7.0.tgz#59fde0f435badacba103a84e9d3bc64e96b9937d"
Expand Down Expand Up @@ -4173,16 +4173,10 @@ resolve-from@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226"

resolve@1.1.x:
resolve@1.1.x, resolve@^1.1.6:
version "1.1.7"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b"

resolve@^1.1.6:
version "1.3.2"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.3.2.tgz#1f0442c9e0cbb8136e87b9305f932f46c7f28235"
dependencies:
path-parse "^1.0.5"

restore-cursor@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-1.0.1.tgz#34661f46886327fed2991479152252df92daa541"
Expand Down

0 comments on commit 2cc70de

Please sign in to comment.