Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
chore: remove top level errors and DeviceDescriptors (#6043)
As far as I can tell these became irrelevant as of v1.15 which added
`puppeteer.errors` and `puppeteer.devices [1]. This is a breaking change
but one that's easily mitigated. We've said that we don't consider
changes to our folder/file structure a breaking change, but we can't
really do that if we have these two top level files that we've
documented.

[1]: e3abb0a#diff-522b24108d7446af4c59873472a90444
  • Loading branch information
jackfranklin committed Jun 19, 2020
1 parent 5ff698e commit 7a4170f
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 56 deletions.
17 changes: 0 additions & 17 deletions DeviceDescriptors.js

This file was deleted.

17 changes: 0 additions & 17 deletions Errors.js

This file was deleted.

2 changes: 0 additions & 2 deletions docs/api.md
Expand Up @@ -514,8 +514,6 @@ const iPhone = puppeteer.devices['iPhone 6'];
})();
```

> **NOTE** The old way (Puppeteer versions <= v1.14.0) devices can be obtained with `require('puppeteer/DeviceDescriptors')`.
#### puppeteer.errors
- returns: <[Object]>
- `TimeoutError` <[function]> A class of [TimeoutError].
Expand Down
3 changes: 1 addition & 2 deletions examples/screenshot-fullpage.js
Expand Up @@ -17,12 +17,11 @@
'use strict';

const puppeteer = require('puppeteer');
const devices = require('puppeteer/DeviceDescriptors');

(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.emulate(devices['iPhone 6']);
await page.emulate(puppeteer.devices['iPhone 6']);
await page.goto('https://www.nytimes.com/');
await page.screenshot({ path: 'full.png', fullPage: true });
await browser.close();
Expand Down
2 changes: 0 additions & 2 deletions package.json
Expand Up @@ -39,8 +39,6 @@
},
"files": [
"lib/",
"Errors.js",
"DeviceDescriptors.js",
"index.js",
"install.js",
"typescript-if-required.js"
Expand Down
16 changes: 0 additions & 16 deletions test/launcher.spec.js
Expand Up @@ -592,22 +592,6 @@ describe('Launcher specs', function () {
});
});

describe('Top-level requires', function () {
it('should require top-level Errors', async () => {
const { puppeteer, puppeteerPath } = getTestState();
const Errors = require(path.join(puppeteerPath, '/Errors'));
expect(Errors.TimeoutError).toBe(puppeteer.errors.TimeoutError);
});
it('should require top-level DeviceDescriptors', async () => {
const { puppeteer, puppeteerPath } = getTestState();
const { devicesMap } = require(path.join(
puppeteerPath,
'/DeviceDescriptors'
));
expect(devicesMap['iPhone 6']).toBe(puppeteer.devices['iPhone 6']);
});
});

describe('Browser target events', function () {
itFailsFirefox('should work', async () => {
const { server, puppeteer, defaultBrowserOptions } = getTestState();
Expand Down

0 comments on commit 7a4170f

Please sign in to comment.