From 47a0366b16315357875b54be495b4784080bf390 Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Thu, 27 Jul 2017 16:27:00 -0700 Subject: [PATCH] Fix typo in coverage This patch: - fixes typo in coverage - enables coverage on Travis CI References #50. --- .travis.yml | 2 +- CONTRIBUTING.md | 4 ++++ test/test.js | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 94c43cc61d9..e45bf61d95b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,5 +17,5 @@ install: # puppeteer's install script downloads Chrome script: - yarn run lint - - yarn run unit + - yarn run coverage - yarn run test-phantom diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 217c2a71604..670f841105d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -87,6 +87,10 @@ npm run debug-unit There are also phantomjs tests located under [third_party/phantomjs/test](https://github.com/GoogleChrome/puppeteer/tree/master/third_party/phantomjs). These are used to test `phantom_shim`. +## Public API Coverage + +Every public API method should be called at least once during `npm run unit` command. +To ensure this, there's a `npm run coverage` command which tracks public API usage and reports back if some methods were not called. ## Debugging Puppeteer uses [DEBUG](https://github.com/visionmedia/debug) module to expose some of it's inner guts under the `puppeteer` namespace. diff --git a/test/test.js b/test/test.js index e2c5734da77..aca52d08cf5 100644 --- a/test/test.js +++ b/test/test.js @@ -1361,7 +1361,7 @@ if (process.env.COVERAGE) { for (let method of coverage.keys()) { (disabled.has(method) ? xit : it)(`public method '${method}' was tested`, SX(async function(){ - expect(publicAPICoverage.get(method)).toBe(true); + expect(coverage.get(method)).toBe(true); })); } });