Skip to content
Permalink
Browse files

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 7a4170fe6e4ba1488fd27c98f2a6af089782bf57
Showing with 1 addition and 56 deletions.
  1. +0 −17 DeviceDescriptors.js
  2. +0 −17 Errors.js
  3. +0 −2 docs/api.md
  4. +1 −2 examples/screenshot-fullpage.js
  5. +0 −2 package.json
  6. +0 −16 test/launcher.spec.js

This file was deleted.

This file was deleted.

@@ -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].
@@ -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();
@@ -39,8 +39,6 @@
},
"files": [
"lib/",
"Errors.js",
"DeviceDescriptors.js",
"index.js",
"install.js",
"typescript-if-required.js"
@@ -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();

0 comments on commit 7a4170f

Please sign in to comment.
You can’t perform that action at this time.