diff --git a/.travis.yml b/.travis.yml index 94c43cc6..e45bf61d 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 217c2a71..670f8411 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 e2c5734d..aca52d08 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); })); } });