chore: enforce file extensions on imports (#6202)
* chore: enforce file extensions on imports To make our output agnostic it should include file extensions in the output, as per the ESM spec. It's a bit odd for Node packages but makes it easier to publish a browser build.
This commit is contained in:
parent
8d6e0d8a79
commit
ffec2475d0
@ -10,7 +10,8 @@ module.exports = {
|
||||
"plugins": [
|
||||
"mocha",
|
||||
"@typescript-eslint",
|
||||
"unicorn"
|
||||
"unicorn",
|
||||
"import"
|
||||
],
|
||||
|
||||
"extends": [
|
||||
@ -88,7 +89,8 @@ module.exports = {
|
||||
|
||||
"no-restricted-imports": ["error", {
|
||||
patterns: ["*Events"],
|
||||
}]
|
||||
}],
|
||||
"import/extensions": ["error", "ignorePackages"]
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
|
@ -18,9 +18,9 @@ const base = require('./base');
|
||||
|
||||
module.exports = {
|
||||
...base,
|
||||
require: ['ts-node/register', './test/mocha-utils.ts'],
|
||||
require: ['./test/mocha-ts-require', './test/mocha-utils.ts'],
|
||||
spec: 'test/*.spec.ts',
|
||||
extension: ['ts'],
|
||||
extension: ['js', 'ts'],
|
||||
parallel: process.env.CI && !process.env.COVERAGE,
|
||||
// retry twice more, so we run each test up to 3 times if needed.
|
||||
retries: process.env.CI ? 2 : 0,
|
||||
|
@ -8,7 +8,7 @@
|
||||
"node": ">=10.18.1"
|
||||
},
|
||||
"scripts": {
|
||||
"unit": "tsc --version && mocha --config mocha-config/puppeteer-unit-tests.js",
|
||||
"unit": "npm run tsc-cjs && mocha --config mocha-config/puppeteer-unit-tests.js",
|
||||
"unit-with-coverage": "cross-env COVERAGE=1 npm run unit",
|
||||
"assert-unit-coverage": "cross-env COVERAGE=1 mocha --config mocha-config/coverage-tests.js",
|
||||
"funit": "PUPPETEER_PRODUCT=firefox npm run unit",
|
||||
@ -76,6 +76,7 @@
|
||||
"dependency-cruiser": "^9.7.0",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint-config-prettier": "^6.11.0",
|
||||
"eslint-plugin-import": "^2.22.0",
|
||||
"eslint-plugin-mocha": "^6.3.0",
|
||||
"eslint-plugin-prettier": "^3.1.3",
|
||||
"eslint-plugin-unicorn": "^19.0.1",
|
||||
|
@ -33,6 +33,7 @@
|
||||
* find the one closest to our Chromium revision.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line import/extensions
|
||||
import { PUPPETEER_REVISIONS } from '../src/revisions';
|
||||
import { execSync } from 'child_process';
|
||||
|
||||
|
@ -25,34 +25,34 @@
|
||||
* Once we have migrated to API Extractor and removed DocLint we can remove the
|
||||
* duplication and use this file.
|
||||
*/
|
||||
export * from './common/Accessibility';
|
||||
export * from './common/Browser';
|
||||
export * from './node/BrowserFetcher';
|
||||
export * from './common/Connection';
|
||||
export * from './common/ConsoleMessage';
|
||||
export * from './common/Coverage';
|
||||
export * from './common/DeviceDescriptors';
|
||||
export * from './common/Dialog';
|
||||
export * from './common/DOMWorld';
|
||||
export * from './common/JSHandle';
|
||||
export * from './common/ExecutionContext';
|
||||
export * from './common/EventEmitter';
|
||||
export * from './common/FileChooser';
|
||||
export * from './common/FrameManager';
|
||||
export * from './common/Input';
|
||||
export * from './common/Page';
|
||||
export * from './common/Puppeteer';
|
||||
export * from './node/LaunchOptions';
|
||||
export * from './node/Launcher';
|
||||
export * from './common/HTTPRequest';
|
||||
export * from './common/HTTPResponse';
|
||||
export * from './common/SecurityDetails';
|
||||
export * from './common/Target';
|
||||
export * from './common/Errors';
|
||||
export * from './common/Tracing';
|
||||
export * from './common/NetworkManager';
|
||||
export * from './common/WebWorker';
|
||||
export * from './common/USKeyboardLayout';
|
||||
export * from './common/EvalTypes';
|
||||
export * from './common/TimeoutSettings';
|
||||
export * from './common/LifecycleWatcher';
|
||||
export * from './common/Accessibility.js';
|
||||
export * from './common/Browser.js';
|
||||
export * from './node/BrowserFetcher.js';
|
||||
export * from './common/Connection.js';
|
||||
export * from './common/ConsoleMessage.js';
|
||||
export * from './common/Coverage.js';
|
||||
export * from './common/DeviceDescriptors.js';
|
||||
export * from './common/Dialog.js';
|
||||
export * from './common/DOMWorld.js';
|
||||
export * from './common/JSHandle.js';
|
||||
export * from './common/ExecutionContext.js';
|
||||
export * from './common/EventEmitter.js';
|
||||
export * from './common/FileChooser.js';
|
||||
export * from './common/FrameManager.js';
|
||||
export * from './common/Input.js';
|
||||
export * from './common/Page.js';
|
||||
export * from './common/Puppeteer.js';
|
||||
export * from './node/LaunchOptions.js';
|
||||
export * from './node/Launcher.js';
|
||||
export * from './common/HTTPRequest.js';
|
||||
export * from './common/HTTPResponse.js';
|
||||
export * from './common/SecurityDetails.js';
|
||||
export * from './common/Target.js';
|
||||
export * from './common/Errors.js';
|
||||
export * from './common/Tracing.js';
|
||||
export * from './common/NetworkManager.js';
|
||||
export * from './common/WebWorker.js';
|
||||
export * from './common/USKeyboardLayout.js';
|
||||
export * from './common/EvalTypes.js';
|
||||
export * from './common/TimeoutSettings.js';
|
||||
export * from './common/LifecycleWatcher.js';
|
||||
|
@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { CDPSession } from './Connection';
|
||||
import { ElementHandle } from './JSHandle';
|
||||
import { CDPSession } from './Connection.js';
|
||||
import { ElementHandle } from './JSHandle.js';
|
||||
import { Protocol } from 'devtools-protocol';
|
||||
|
||||
/**
|
||||
|
@ -14,15 +14,15 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { assert } from './assert';
|
||||
import { helper } from './helper';
|
||||
import { Target } from './Target';
|
||||
import { EventEmitter } from './EventEmitter';
|
||||
import { Connection, ConnectionEmittedEvents } from './Connection';
|
||||
import { assert } from './assert.js';
|
||||
import { helper } from './helper.js';
|
||||
import { Target } from './Target.js';
|
||||
import { EventEmitter } from './EventEmitter.js';
|
||||
import { Connection, ConnectionEmittedEvents } from './Connection.js';
|
||||
import { Protocol } from 'devtools-protocol';
|
||||
import { Page } from './Page';
|
||||
import { Page } from './Page.js';
|
||||
import { ChildProcess } from 'child_process';
|
||||
import { Viewport } from './PuppeteerViewport';
|
||||
import { Viewport } from './PuppeteerViewport.js';
|
||||
|
||||
type BrowserCloseCallback = () => Promise<void> | void;
|
||||
|
||||
|
@ -13,15 +13,15 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { assert } from './assert';
|
||||
import { debug } from './Debug';
|
||||
import { assert } from './assert.js';
|
||||
import { debug } from './Debug.js';
|
||||
const debugProtocolSend = debug('puppeteer:protocol:SEND ►');
|
||||
const debugProtocolReceive = debug('puppeteer:protocol:RECV ◀');
|
||||
|
||||
import { Protocol } from 'devtools-protocol';
|
||||
import { ProtocolMapping } from 'devtools-protocol/types/protocol-mapping';
|
||||
import { ConnectionTransport } from './ConnectionTransport';
|
||||
import { EventEmitter } from './EventEmitter';
|
||||
import { ProtocolMapping } from 'devtools-protocol/types/protocol-mapping.js';
|
||||
import { ConnectionTransport } from './ConnectionTransport.js';
|
||||
import { EventEmitter } from './EventEmitter.js';
|
||||
|
||||
interface ConnectionCallback {
|
||||
resolve: Function;
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { JSHandle } from './JSHandle';
|
||||
import { JSHandle } from './JSHandle.js';
|
||||
|
||||
/**
|
||||
* @public
|
||||
|
@ -14,12 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { assert } from './assert';
|
||||
import { helper, debugError, PuppeteerEventListener } from './helper';
|
||||
import { assert } from './assert.js';
|
||||
import { helper, debugError, PuppeteerEventListener } from './helper.js';
|
||||
import { Protocol } from 'devtools-protocol';
|
||||
import { CDPSession } from './Connection';
|
||||
import { CDPSession } from './Connection.js';
|
||||
|
||||
import { EVALUATION_SCRIPT_URL } from './ExecutionContext';
|
||||
import { EVALUATION_SCRIPT_URL } from './ExecutionContext.js';
|
||||
|
||||
/**
|
||||
* The CoverageEntry class represents one entry of the coverage report.
|
||||
|
@ -14,16 +14,19 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { assert } from './assert';
|
||||
import { helper } from './helper';
|
||||
import { LifecycleWatcher, PuppeteerLifeCycleEvent } from './LifecycleWatcher';
|
||||
import { TimeoutError } from './Errors';
|
||||
import { JSHandle, ElementHandle } from './JSHandle';
|
||||
import { ExecutionContext } from './ExecutionContext';
|
||||
import { TimeoutSettings } from './TimeoutSettings';
|
||||
import { MouseButton } from './Input';
|
||||
import { FrameManager, Frame } from './FrameManager';
|
||||
import { getQueryHandlerAndSelector, QueryHandler } from './QueryHandler';
|
||||
import { assert } from './assert.js';
|
||||
import { helper } from './helper.js';
|
||||
import {
|
||||
LifecycleWatcher,
|
||||
PuppeteerLifeCycleEvent,
|
||||
} from './LifecycleWatcher.js';
|
||||
import { TimeoutError } from './Errors.js';
|
||||
import { JSHandle, ElementHandle } from './JSHandle.js';
|
||||
import { ExecutionContext } from './ExecutionContext.js';
|
||||
import { TimeoutSettings } from './TimeoutSettings.js';
|
||||
import { MouseButton } from './Input.js';
|
||||
import { FrameManager, Frame } from './FrameManager.js';
|
||||
import { getQueryHandlerAndSelector, QueryHandler } from './QueryHandler.js';
|
||||
import {
|
||||
SerializableOrJSHandle,
|
||||
EvaluateHandleFn,
|
||||
@ -31,8 +34,8 @@ import {
|
||||
EvaluateFn,
|
||||
EvaluateFnReturnType,
|
||||
UnwrapPromiseLike,
|
||||
} from './EvalTypes';
|
||||
import { isNode } from '../environment';
|
||||
} from './EvalTypes.js';
|
||||
import { isNode } from '../environment.js';
|
||||
|
||||
// This predicateQueryHandler is declared here so that TypeScript knows about it
|
||||
// when it is used in the predicate function below.
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { isNode } from '../environment';
|
||||
import { isNode } from '../environment.js';
|
||||
|
||||
/**
|
||||
* A debug function that can be used in any environment.
|
||||
|
@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { assert } from './assert';
|
||||
import { CDPSession } from './Connection';
|
||||
import { assert } from './assert.js';
|
||||
import { CDPSession } from './Connection.js';
|
||||
import { Protocol } from 'devtools-protocol';
|
||||
|
||||
/**
|
||||
|
@ -13,8 +13,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { CDPSession } from './Connection';
|
||||
import { Viewport } from './PuppeteerViewport';
|
||||
import { CDPSession } from './Connection.js';
|
||||
import { Viewport } from './PuppeteerViewport.js';
|
||||
import { Protocol } from 'devtools-protocol';
|
||||
|
||||
export class EmulationManager {
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { JSHandle, ElementHandle } from './JSHandle';
|
||||
import { JSHandle, ElementHandle } from './JSHandle.js';
|
||||
|
||||
/**
|
||||
* @public
|
||||
|
@ -14,14 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { assert } from './assert';
|
||||
import { helper } from './helper';
|
||||
import { createJSHandle, JSHandle, ElementHandle } from './JSHandle';
|
||||
import { CDPSession } from './Connection';
|
||||
import { DOMWorld } from './DOMWorld';
|
||||
import { Frame } from './FrameManager';
|
||||
import { assert } from './assert.js';
|
||||
import { helper } from './helper.js';
|
||||
import { createJSHandle, JSHandle, ElementHandle } from './JSHandle.js';
|
||||
import { CDPSession } from './Connection.js';
|
||||
import { DOMWorld } from './DOMWorld.js';
|
||||
import { Frame } from './FrameManager.js';
|
||||
import { Protocol } from 'devtools-protocol';
|
||||
import { EvaluateHandleFn, SerializableOrJSHandle } from './EvalTypes';
|
||||
import { EvaluateHandleFn, SerializableOrJSHandle } from './EvalTypes.js';
|
||||
|
||||
export const EVALUATION_SCRIPT_URL = '__puppeteer_evaluation_script__';
|
||||
const SOURCE_URL_REGEX = /^[\040\t]*\/\/[@#] sourceURL=\s*(\S*?)\s*$/m;
|
||||
|
@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { ElementHandle } from './JSHandle';
|
||||
import { ElementHandle } from './JSHandle.js';
|
||||
import { Protocol } from 'devtools-protocol';
|
||||
import { assert } from './assert';
|
||||
import { assert } from './assert.js';
|
||||
|
||||
/**
|
||||
* File choosers let you react to the page requesting for a file.
|
||||
|
@ -14,19 +14,22 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { EventEmitter } from './EventEmitter';
|
||||
import { assert } from './assert';
|
||||
import { helper, debugError } from './helper';
|
||||
import { ExecutionContext, EVALUATION_SCRIPT_URL } from './ExecutionContext';
|
||||
import { LifecycleWatcher, PuppeteerLifeCycleEvent } from './LifecycleWatcher';
|
||||
import { DOMWorld, WaitForSelectorOptions } from './DOMWorld';
|
||||
import { NetworkManager } from './NetworkManager';
|
||||
import { TimeoutSettings } from './TimeoutSettings';
|
||||
import { CDPSession } from './Connection';
|
||||
import { JSHandle, ElementHandle } from './JSHandle';
|
||||
import { MouseButton } from './Input';
|
||||
import { Page } from './Page';
|
||||
import { HTTPResponse } from './HTTPResponse';
|
||||
import { EventEmitter } from './EventEmitter.js';
|
||||
import { assert } from './assert.js';
|
||||
import { helper, debugError } from './helper.js';
|
||||
import { ExecutionContext, EVALUATION_SCRIPT_URL } from './ExecutionContext.js';
|
||||
import {
|
||||
LifecycleWatcher,
|
||||
PuppeteerLifeCycleEvent,
|
||||
} from './LifecycleWatcher.js';
|
||||
import { DOMWorld, WaitForSelectorOptions } from './DOMWorld.js';
|
||||
import { NetworkManager } from './NetworkManager.js';
|
||||
import { TimeoutSettings } from './TimeoutSettings.js';
|
||||
import { CDPSession } from './Connection.js';
|
||||
import { JSHandle, ElementHandle } from './JSHandle.js';
|
||||
import { MouseButton } from './Input.js';
|
||||
import { Page } from './Page.js';
|
||||
import { HTTPResponse } from './HTTPResponse.js';
|
||||
import { Protocol } from 'devtools-protocol';
|
||||
import {
|
||||
SerializableOrJSHandle,
|
||||
@ -35,7 +38,7 @@ import {
|
||||
EvaluateFn,
|
||||
EvaluateFnReturnType,
|
||||
UnwrapPromiseLike,
|
||||
} from './EvalTypes';
|
||||
} from './EvalTypes.js';
|
||||
|
||||
const UTILITY_WORLD_NAME = '__puppeteer_utility_world__';
|
||||
|
||||
|
@ -13,11 +13,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { CDPSession } from './Connection';
|
||||
import { Frame } from './FrameManager';
|
||||
import { HTTPResponse } from './HTTPResponse';
|
||||
import { assert } from './assert';
|
||||
import { helper, debugError } from './helper';
|
||||
import { CDPSession } from './Connection.js';
|
||||
import { Frame } from './FrameManager.js';
|
||||
import { HTTPResponse } from './HTTPResponse.js';
|
||||
import { assert } from './assert.js';
|
||||
import { helper, debugError } from './helper.js';
|
||||
import { Protocol } from 'devtools-protocol';
|
||||
|
||||
/**
|
||||
|
@ -13,10 +13,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { CDPSession } from './Connection';
|
||||
import { Frame } from './FrameManager';
|
||||
import { HTTPRequest } from './HTTPRequest';
|
||||
import { SecurityDetails } from './SecurityDetails';
|
||||
import { CDPSession } from './Connection.js';
|
||||
import { Frame } from './FrameManager.js';
|
||||
import { HTTPRequest } from './HTTPRequest.js';
|
||||
import { SecurityDetails } from './SecurityDetails.js';
|
||||
import { Protocol } from 'devtools-protocol';
|
||||
|
||||
/**
|
||||
|
@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { assert } from './assert';
|
||||
import { CDPSession } from './Connection';
|
||||
import { keyDefinitions, KeyDefinition, KeyInput } from './USKeyboardLayout';
|
||||
import { assert } from './assert.js';
|
||||
import { CDPSession } from './Connection.js';
|
||||
import { keyDefinitions, KeyDefinition, KeyInput } from './USKeyboardLayout.js';
|
||||
|
||||
type KeyDescription = Required<
|
||||
Pick<KeyDefinition, 'keyCode' | 'key' | 'text' | 'code' | 'location'>
|
||||
|
@ -14,14 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { assert } from './assert';
|
||||
import { helper, debugError } from './helper';
|
||||
import { ExecutionContext } from './ExecutionContext';
|
||||
import { Page } from './Page';
|
||||
import { CDPSession } from './Connection';
|
||||
import { KeyInput } from './USKeyboardLayout';
|
||||
import { FrameManager, Frame } from './FrameManager';
|
||||
import { getQueryHandlerAndSelector } from './QueryHandler';
|
||||
import { assert } from './assert.js';
|
||||
import { helper, debugError } from './helper.js';
|
||||
import { ExecutionContext } from './ExecutionContext.js';
|
||||
import { Page } from './Page.js';
|
||||
import { CDPSession } from './Connection.js';
|
||||
import { KeyInput } from './USKeyboardLayout.js';
|
||||
import { FrameManager, Frame } from './FrameManager.js';
|
||||
import { getQueryHandlerAndSelector } from './QueryHandler.js';
|
||||
import { Protocol } from 'devtools-protocol';
|
||||
import {
|
||||
EvaluateFn,
|
||||
@ -30,7 +30,7 @@ import {
|
||||
EvaluateHandleFn,
|
||||
WrapElementHandle,
|
||||
UnwrapPromiseLike,
|
||||
} from './EvalTypes';
|
||||
} from './EvalTypes.js';
|
||||
|
||||
export interface BoxModel {
|
||||
content: Array<{ x: number; y: number }>;
|
||||
|
@ -14,14 +14,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { assert } from './assert';
|
||||
import { helper, PuppeteerEventListener } from './helper';
|
||||
import { TimeoutError } from './Errors';
|
||||
import { FrameManager, Frame, FrameManagerEmittedEvents } from './FrameManager';
|
||||
import { HTTPRequest } from './HTTPRequest';
|
||||
import { HTTPResponse } from './HTTPResponse';
|
||||
import { NetworkManagerEmittedEvents } from './NetworkManager';
|
||||
import { CDPSessionEmittedEvents } from './Connection';
|
||||
import { assert } from './assert.js';
|
||||
import { helper, PuppeteerEventListener } from './helper.js';
|
||||
import { TimeoutError } from './Errors.js';
|
||||
import {
|
||||
FrameManager,
|
||||
Frame,
|
||||
FrameManagerEmittedEvents,
|
||||
} from './FrameManager.js';
|
||||
import { HTTPRequest } from './HTTPRequest.js';
|
||||
import { HTTPResponse } from './HTTPResponse.js';
|
||||
import { NetworkManagerEmittedEvents } from './NetworkManager.js';
|
||||
import { CDPSessionEmittedEvents } from './Connection.js';
|
||||
|
||||
export type PuppeteerLifeCycleEvent =
|
||||
| 'load'
|
||||
|
@ -13,14 +13,14 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { EventEmitter } from './EventEmitter';
|
||||
import { assert } from './assert';
|
||||
import { helper, debugError } from './helper';
|
||||
import { EventEmitter } from './EventEmitter.js';
|
||||
import { assert } from './assert.js';
|
||||
import { helper, debugError } from './helper.js';
|
||||
import { Protocol } from 'devtools-protocol';
|
||||
import { CDPSession } from './Connection';
|
||||
import { FrameManager } from './FrameManager';
|
||||
import { HTTPRequest } from './HTTPRequest';
|
||||
import { HTTPResponse } from './HTTPResponse';
|
||||
import { CDPSession } from './Connection.js';
|
||||
import { FrameManager } from './FrameManager.js';
|
||||
import { HTTPRequest } from './HTTPRequest.js';
|
||||
import { HTTPResponse } from './HTTPResponse.js';
|
||||
|
||||
/**
|
||||
* @public
|
||||
|
@ -16,30 +16,38 @@
|
||||
|
||||
import * as fs from 'fs';
|
||||
import { promisify } from 'util';
|
||||
import { EventEmitter } from './EventEmitter';
|
||||
import { EventEmitter } from './EventEmitter.js';
|
||||
import * as mime from 'mime';
|
||||
import { Connection, CDPSession, CDPSessionEmittedEvents } from './Connection';
|
||||
import { Dialog } from './Dialog';
|
||||
import { EmulationManager } from './EmulationManager';
|
||||
import { Frame, FrameManager, FrameManagerEmittedEvents } from './FrameManager';
|
||||
import { Keyboard, Mouse, Touchscreen, MouseButton } from './Input';
|
||||
import { Tracing } from './Tracing';
|
||||
import { assert } from './assert';
|
||||
import { helper, debugError } from './helper';
|
||||
import { Coverage } from './Coverage';
|
||||
import { WebWorker } from './WebWorker';
|
||||
import { Browser, BrowserContext } from './Browser';
|
||||
import { Target } from './Target';
|
||||
import { createJSHandle, JSHandle, ElementHandle } from './JSHandle';
|
||||
import { Viewport } from './PuppeteerViewport';
|
||||
import { Credentials, NetworkManagerEmittedEvents } from './NetworkManager';
|
||||
import { HTTPRequest } from './HTTPRequest';
|
||||
import { HTTPResponse } from './HTTPResponse';
|
||||
import { Accessibility } from './Accessibility';
|
||||
import { TimeoutSettings } from './TimeoutSettings';
|
||||
import { FileChooser } from './FileChooser';
|
||||
import { ConsoleMessage, ConsoleMessageType } from './ConsoleMessage';
|
||||
import { PuppeteerLifeCycleEvent } from './LifecycleWatcher';
|
||||
import {
|
||||
Connection,
|
||||
CDPSession,
|
||||
CDPSessionEmittedEvents,
|
||||
} from './Connection.js';
|
||||
import { Dialog } from './Dialog.js';
|
||||
import { EmulationManager } from './EmulationManager.js';
|
||||
import {
|
||||
Frame,
|
||||
FrameManager,
|
||||
FrameManagerEmittedEvents,
|
||||
} from './FrameManager.js';
|
||||
import { Keyboard, Mouse, Touchscreen, MouseButton } from './Input.js';
|
||||
import { Tracing } from './Tracing.js';
|
||||
import { assert } from './assert.js';
|
||||
import { helper, debugError } from './helper.js';
|
||||
import { Coverage } from './Coverage.js';
|
||||
import { WebWorker } from './WebWorker.js';
|
||||
import { Browser, BrowserContext } from './Browser.js';
|
||||
import { Target } from './Target.js';
|
||||
import { createJSHandle, JSHandle, ElementHandle } from './JSHandle.js';
|
||||
import { Viewport } from './PuppeteerViewport.js';
|
||||
import { Credentials, NetworkManagerEmittedEvents } from './NetworkManager.js';
|
||||
import { HTTPRequest } from './HTTPRequest.js';
|
||||
import { HTTPResponse } from './HTTPResponse.js';
|
||||
import { Accessibility } from './Accessibility.js';
|
||||
import { TimeoutSettings } from './TimeoutSettings.js';
|
||||
import { FileChooser } from './FileChooser.js';
|
||||
import { ConsoleMessage, ConsoleMessageType } from './ConsoleMessage.js';
|
||||
import { PuppeteerLifeCycleEvent } from './LifecycleWatcher.js';
|
||||
import { Protocol } from 'devtools-protocol';
|
||||
import {
|
||||
SerializableOrJSHandle,
|
||||
@ -48,7 +56,7 @@ import {
|
||||
EvaluateFn,
|
||||
EvaluateFnReturnType,
|
||||
UnwrapPromiseLike,
|
||||
} from './EvalTypes';
|
||||
} from './EvalTypes.js';
|
||||
|
||||
const writeFileAsync = promisify(fs.writeFile);
|
||||
|
||||
|
@ -13,26 +13,29 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import Launcher from '../node/Launcher';
|
||||
import Launcher from '../node/Launcher.js';
|
||||
import {
|
||||
LaunchOptions,
|
||||
ChromeArgOptions,
|
||||
BrowserOptions,
|
||||
} from '../node/LaunchOptions';
|
||||
import { ProductLauncher } from '../node/Launcher';
|
||||
import { BrowserFetcher, BrowserFetcherOptions } from '../node/BrowserFetcher';
|
||||
import { puppeteerErrors, PuppeteerErrors } from './Errors';
|
||||
import { ConnectionTransport } from './ConnectionTransport';
|
||||
import { devicesMap, DevicesMap } from './DeviceDescriptors';
|
||||
import { Browser } from './Browser';
|
||||
} from '../node/LaunchOptions.js';
|
||||
import { ProductLauncher } from '../node/Launcher.js';
|
||||
import {
|
||||
BrowserFetcher,
|
||||
BrowserFetcherOptions,
|
||||
} from '../node/BrowserFetcher.js';
|
||||
import { puppeteerErrors, PuppeteerErrors } from './Errors.js';
|
||||
import { ConnectionTransport } from './ConnectionTransport.js';
|
||||
import { devicesMap, DevicesMap } from './DeviceDescriptors.js';
|
||||
import { Browser } from './Browser.js';
|
||||
import {
|
||||
registerCustomQueryHandler,
|
||||
unregisterCustomQueryHandler,
|
||||
customQueryHandlers,
|
||||
clearQueryHandlers,
|
||||
QueryHandler,
|
||||
} from './QueryHandler';
|
||||
import { PUPPETEER_REVISIONS } from '../revisions';
|
||||
} from './QueryHandler.js';
|
||||
import { PUPPETEER_REVISIONS } from '../revisions.js';
|
||||
|
||||
/**
|
||||
* The main Puppeteer class. Provides the {@link Puppeteer.launch | launch}
|
||||
|
@ -14,11 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Page, PageEmittedEvents } from './Page';
|
||||
import { WebWorker } from './WebWorker';
|
||||
import { CDPSession } from './Connection';
|
||||
import { Browser, BrowserContext } from './Browser';
|
||||
import { Viewport } from './PuppeteerViewport';
|
||||
import { Page, PageEmittedEvents } from './Page.js';
|
||||
import { WebWorker } from './WebWorker.js';
|
||||
import { CDPSession } from './Connection.js';
|
||||
import { Browser, BrowserContext } from './Browser.js';
|
||||
import { Viewport } from './PuppeteerViewport.js';
|
||||
import { Protocol } from 'devtools-protocol';
|
||||
|
||||
/**
|
||||
|
@ -13,9 +13,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { assert } from './assert';
|
||||
import { helper } from './helper';
|
||||
import { CDPSession } from './Connection';
|
||||
import { assert } from './assert.js';
|
||||
import { helper } from './helper.js';
|
||||
import { CDPSession } from './Connection.js';
|
||||
|
||||
/**
|
||||
* @public
|
||||
|
@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { ConnectionTransport } from './ConnectionTransport';
|
||||
import { ConnectionTransport } from './ConnectionTransport.js';
|
||||
import NodeWebSocket from 'ws';
|
||||
|
||||
export class WebSocketTransport implements ConnectionTransport {
|
||||
|
@ -13,13 +13,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { EventEmitter } from './EventEmitter';
|
||||
import { debugError } from './helper';
|
||||
import { ExecutionContext } from './ExecutionContext';
|
||||
import { JSHandle } from './JSHandle';
|
||||
import { CDPSession } from './Connection';
|
||||
import { EventEmitter } from './EventEmitter.js';
|
||||
import { debugError } from './helper.js';
|
||||
import { ExecutionContext } from './ExecutionContext.js';
|
||||
import { JSHandle } from './JSHandle.js';
|
||||
import { CDPSession } from './Connection.js';
|
||||
import { Protocol } from 'devtools-protocol';
|
||||
import { EvaluateHandleFn, SerializableOrJSHandle } from './EvalTypes';
|
||||
import { EvaluateHandleFn, SerializableOrJSHandle } from './EvalTypes.js';
|
||||
|
||||
/**
|
||||
* @internal
|
||||
|
@ -13,14 +13,14 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { TimeoutError } from './Errors';
|
||||
import { debug } from './Debug';
|
||||
import { TimeoutError } from './Errors.js';
|
||||
import { debug } from './Debug.js';
|
||||
import * as fs from 'fs';
|
||||
import { CDPSession } from './Connection';
|
||||
import { CDPSession } from './Connection.js';
|
||||
import { promisify } from 'util';
|
||||
import { Protocol } from 'devtools-protocol';
|
||||
import { CommonEventEmitter } from './EventEmitter';
|
||||
import { assert } from './assert';
|
||||
import { CommonEventEmitter } from './EventEmitter.js';
|
||||
import { assert } from './assert.js';
|
||||
|
||||
const openAsync = promisify(fs.open);
|
||||
const writeAsync = promisify(fs.write);
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { initializePuppeteer } from './initialize';
|
||||
import { initializePuppeteer } from './initialize.js';
|
||||
|
||||
const puppeteer = initializePuppeteer('puppeteer-core');
|
||||
export default puppeteer;
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { initializePuppeteer } from './initialize';
|
||||
import { initializePuppeteer } from './initialize.js';
|
||||
|
||||
const puppeteer = initializePuppeteer('puppeteer');
|
||||
export default puppeteer;
|
||||
|
@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Puppeteer } from './common/Puppeteer';
|
||||
import { PUPPETEER_REVISIONS } from './revisions';
|
||||
import { Puppeteer } from './common/Puppeteer.js';
|
||||
import { PUPPETEER_REVISIONS } from './revisions.js';
|
||||
import pkgDir from 'pkg-dir';
|
||||
|
||||
export const initializePuppeteer = (packageName: string): Puppeteer => {
|
||||
|
@ -17,8 +17,8 @@
|
||||
import os from 'os';
|
||||
import https from 'https';
|
||||
import ProgressBar from 'progress';
|
||||
import puppeteer from './index';
|
||||
import { PUPPETEER_REVISIONS } from './revisions';
|
||||
import puppeteer from './index.js';
|
||||
import { PUPPETEER_REVISIONS } from './revisions.js';
|
||||
|
||||
const firefoxVersions =
|
||||
'https://product-details.mozilla.org/1.0/firefox_versions.json';
|
||||
|
@ -23,13 +23,13 @@ import * as https from 'https';
|
||||
import * as http from 'http';
|
||||
|
||||
import extractZip from 'extract-zip';
|
||||
import { debug } from '../common/Debug';
|
||||
import { debug } from '../common/Debug.js';
|
||||
import { promisify } from 'util';
|
||||
import removeRecursive from 'rimraf';
|
||||
import * as URL from 'url';
|
||||
import ProxyAgent from 'https-proxy-agent';
|
||||
import { getProxyForUrl } from 'proxy-from-env';
|
||||
import { assert } from '../common/assert';
|
||||
import { assert } from '../common/assert.js';
|
||||
|
||||
const debugFetcher = debug(`puppeteer:fetcher`);
|
||||
|
||||
|
@ -14,18 +14,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { debug } from '../common/Debug';
|
||||
import { debug } from '../common/Debug.js';
|
||||
|
||||
import removeFolder from 'rimraf';
|
||||
import * as childProcess from 'child_process';
|
||||
import { assert } from '../common/assert';
|
||||
import { helper, debugError } from '../common/helper';
|
||||
import { LaunchOptions } from './LaunchOptions';
|
||||
import { Connection } from '../common/Connection';
|
||||
import { WebSocketTransport } from '../common/WebSocketTransport';
|
||||
import { PipeTransport } from './PipeTransport';
|
||||
import { assert } from '../common/assert.js';
|
||||
import { helper, debugError } from '../common/helper.js';
|
||||
import { LaunchOptions } from './LaunchOptions.js';
|
||||
import { Connection } from '../common/Connection.js';
|
||||
import { WebSocketTransport } from '../common/WebSocketTransport.js';
|
||||
import { PipeTransport } from './PipeTransport.js';
|
||||
import * as readline from 'readline';
|
||||
import { TimeoutError } from '../common/Errors';
|
||||
import { TimeoutError } from '../common/Errors.js';
|
||||
import { promisify } from 'util';
|
||||
|
||||
const removeFolderAsync = promisify(removeFolder);
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Viewport } from '../common/PuppeteerViewport';
|
||||
import { Viewport } from '../common/PuppeteerViewport.js';
|
||||
|
||||
/**
|
||||
* Launcher options that only apply to Chrome.
|
||||
|
@ -20,14 +20,14 @@ import * as https from 'https';
|
||||
import * as URL from 'url';
|
||||
import * as fs from 'fs';
|
||||
|
||||
import { BrowserFetcher } from './BrowserFetcher';
|
||||
import { Connection } from '../common/Connection';
|
||||
import { Browser } from '../common/Browser';
|
||||
import { assert } from '../common/assert';
|
||||
import { debugError } from '../common/helper';
|
||||
import { ConnectionTransport } from '../common/ConnectionTransport';
|
||||
import { WebSocketTransport } from '../common/WebSocketTransport';
|
||||
import { BrowserRunner } from './BrowserRunner';
|
||||
import { BrowserFetcher } from './BrowserFetcher.js';
|
||||
import { Connection } from '../common/Connection.js';
|
||||
import { Browser } from '../common/Browser.js';
|
||||
import { assert } from '../common/assert.js';
|
||||
import { debugError } from '../common/helper.js';
|
||||
import { ConnectionTransport } from '../common/ConnectionTransport.js';
|
||||
import { WebSocketTransport } from '../common/WebSocketTransport.js';
|
||||
import { BrowserRunner } from './BrowserRunner.js';
|
||||
import { promisify } from 'util';
|
||||
|
||||
const mkdtempAsync = promisify(fs.mkdtemp);
|
||||
@ -37,7 +37,7 @@ import {
|
||||
ChromeArgOptions,
|
||||
LaunchOptions,
|
||||
BrowserOptions,
|
||||
} from './LaunchOptions';
|
||||
} from './LaunchOptions.js';
|
||||
|
||||
/**
|
||||
* Describes a launcher - a class that is able to create and launch a browser instance.
|
||||
|
@ -13,8 +13,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { helper, debugError, PuppeteerEventListener } from '../common/helper';
|
||||
import { ConnectionTransport } from '../common/ConnectionTransport';
|
||||
import {
|
||||
helper,
|
||||
debugError,
|
||||
PuppeteerEventListener,
|
||||
} from '../common/helper.js';
|
||||
import { ConnectionTransport } from '../common/ConnectionTransport.js';
|
||||
|
||||
export class PipeTransport implements ConnectionTransport {
|
||||
_pipeWrite: NodeJS.WritableStream;
|
||||
|
13
test/.eslintrc.js
Normal file
13
test/.eslintrc.js
Normal file
@ -0,0 +1,13 @@
|
||||
module.exports = {
|
||||
rules: {
|
||||
'no-restricted-imports': [
|
||||
'error',
|
||||
{
|
||||
/** The mocha tests run on the compiled output in the /lib directory
|
||||
* so we should avoid importing from src.
|
||||
*/
|
||||
patterns: ['*src*'],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
@ -14,14 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { waitEvent } from './utils';
|
||||
import { waitEvent } from './utils.js';
|
||||
import expect from 'expect';
|
||||
import {
|
||||
getTestState,
|
||||
setupTestBrowserHooks,
|
||||
setupTestPageAndContextHooks,
|
||||
describeChromeOnly,
|
||||
} from './mocha-utils';
|
||||
} from './mocha-utils'; // eslint-disable-line import/extensions
|
||||
|
||||
describeChromeOnly('Target.createCDPSession', function () {
|
||||
setupTestBrowserHooks();
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { EventEmitter } from '../src/common/EventEmitter';
|
||||
import { EventEmitter } from '../lib/cjs/common/EventEmitter.js';
|
||||
import sinon from 'sinon';
|
||||
import expect from 'expect';
|
||||
|
||||
|
@ -20,7 +20,7 @@ import {
|
||||
setupTestBrowserHooks,
|
||||
setupTestPageAndContextHooks,
|
||||
describeFailsFirefox,
|
||||
} from './mocha-utils';
|
||||
} from './mocha-utils'; // eslint-disable-line import/extensions
|
||||
|
||||
describeFailsFirefox('Accessibility', function () {
|
||||
setupTestBrowserHooks();
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import expect from 'expect';
|
||||
import { getTestState, setupTestBrowserHooks } from './mocha-utils';
|
||||
import { getTestState, setupTestBrowserHooks } from './mocha-utils'; // eslint-disable-line import/extensions
|
||||
|
||||
describe('Browser specs', function () {
|
||||
setupTestBrowserHooks();
|
||||
|
@ -19,8 +19,8 @@ import {
|
||||
getTestState,
|
||||
setupTestBrowserHooks,
|
||||
itFailsFirefox,
|
||||
} from './mocha-utils';
|
||||
import utils from './utils';
|
||||
} from './mocha-utils'; // eslint-disable-line import/extensions
|
||||
import utils from './utils.js';
|
||||
|
||||
describe('BrowserContext', function () {
|
||||
setupTestBrowserHooks();
|
||||
|
@ -19,7 +19,7 @@ import {
|
||||
setupTestBrowserHooks,
|
||||
setupTestPageAndContextHooks,
|
||||
describeChromeOnly,
|
||||
} from './mocha-utils';
|
||||
} from './mocha-utils'; // eslint-disable-line import/extensions
|
||||
|
||||
describeChromeOnly('Chromium-Specific Launcher tests', function () {
|
||||
describe('Puppeteer.launch |browserURL| option', function () {
|
||||
|
@ -20,8 +20,8 @@ import {
|
||||
setupTestPageAndContextHooks,
|
||||
setupTestBrowserHooks,
|
||||
itFailsFirefox,
|
||||
} from './mocha-utils';
|
||||
import utils from './utils';
|
||||
} from './mocha-utils'; // eslint-disable-line import/extensions
|
||||
import utils from './utils.js';
|
||||
|
||||
describe('Page.click', function () {
|
||||
setupTestBrowserHooks();
|
||||
|
@ -19,7 +19,7 @@ import {
|
||||
setupTestBrowserHooks,
|
||||
setupTestPageAndContextHooks,
|
||||
itFailsFirefox,
|
||||
} from './mocha-utils';
|
||||
} from './mocha-utils'; // eslint-disable-line import/extensions
|
||||
|
||||
describe('Cookie specs', () => {
|
||||
setupTestBrowserHooks();
|
||||
|
@ -39,32 +39,32 @@ const fs = require('fs');
|
||||
* part of the TSDoc migration.
|
||||
*/
|
||||
const MODULES_TO_CHECK_FOR_COVERAGE = {
|
||||
Accessibility: '../src/common/Accessibility',
|
||||
Browser: '../src/common/Browser',
|
||||
BrowserContext: '../src/common/Browser',
|
||||
BrowserFetcher: '../src/node/BrowserFetcher',
|
||||
CDPSession: '../src/common/Connection',
|
||||
ConsoleMessage: '../src/common/ConsoleMessage',
|
||||
Coverage: '../src/common/Coverage',
|
||||
Dialog: '../src/common/Dialog',
|
||||
ElementHandle: '../src/common/JSHandle',
|
||||
ExecutionContext: '../src/common/ExecutionContext',
|
||||
EventEmitter: '../src/common/EventEmitter',
|
||||
FileChooser: '../src/common/FileChooser',
|
||||
Frame: '../src/common/FrameManager',
|
||||
JSHandle: '../src/common/JSHandle',
|
||||
Keyboard: '../src/common/Input',
|
||||
Mouse: '../src/common/Input',
|
||||
Page: '../src/common/Page',
|
||||
Puppeteer: '../src/common/Puppeteer',
|
||||
HTTPRequest: '../src/common/HTTPRequest',
|
||||
HTTPResponse: '../src/common/HTTPResponse',
|
||||
SecurityDetails: '../src/common/SecurityDetails',
|
||||
Target: '../src/common/Target',
|
||||
TimeoutError: '../src/common/Errors',
|
||||
Touchscreen: '../src/common/Input',
|
||||
Tracing: '../src/common/Tracing',
|
||||
WebWorker: '../src/common/WebWorker',
|
||||
Accessibility: '../lib/cjs/common/Accessibility',
|
||||
Browser: '../lib/cjs/common/Browser',
|
||||
BrowserContext: '../lib/cjs/common/Browser',
|
||||
BrowserFetcher: '../lib/cjs/node/BrowserFetcher',
|
||||
CDPSession: '../lib/cjs/common/Connection',
|
||||
ConsoleMessage: '../lib/cjs/common/ConsoleMessage',
|
||||
Coverage: '../lib/cjs/common/Coverage',
|
||||
Dialog: '../lib/cjs/common/Dialog',
|
||||
ElementHandle: '../lib/cjs/common/JSHandle',
|
||||
ExecutionContext: '../lib/cjs/common/ExecutionContext',
|
||||
EventEmitter: '../lib/cjs/common/EventEmitter',
|
||||
FileChooser: '../lib/cjs/common/FileChooser',
|
||||
Frame: '../lib/cjs/common/FrameManager',
|
||||
JSHandle: '../lib/cjs/common/JSHandle',
|
||||
Keyboard: '../lib/cjs/common/Input',
|
||||
Mouse: '../lib/cjs/common/Input',
|
||||
Page: '../lib/cjs/common/Page',
|
||||
Puppeteer: '../lib/cjs/common/Puppeteer',
|
||||
HTTPRequest: '../lib/cjs/common/HTTPRequest',
|
||||
HTTPResponse: '../lib/cjs/common/HTTPResponse',
|
||||
SecurityDetails: '../lib/cjs/common/SecurityDetails',
|
||||
Target: '../lib/cjs/common/Target',
|
||||
TimeoutError: '../lib/cjs/common/Errors',
|
||||
Touchscreen: '../lib/cjs/common/Input',
|
||||
Tracing: '../lib/cjs/common/Tracing',
|
||||
WebWorker: '../lib/cjs/common/WebWorker',
|
||||
};
|
||||
|
||||
function traceAPICoverage(apiCoverage, className, modulePath) {
|
||||
|
@ -20,7 +20,7 @@ import {
|
||||
setupTestPageAndContextHooks,
|
||||
setupTestBrowserHooks,
|
||||
describeChromeOnly,
|
||||
} from './mocha-utils';
|
||||
} from './mocha-utils'; // eslint-disable-line import/extensions
|
||||
|
||||
describe('Coverage specs', function () {
|
||||
describeChromeOnly('JSCoverage', function () {
|
||||
|
@ -19,7 +19,7 @@ import {
|
||||
setupTestBrowserHooks,
|
||||
setupTestPageAndContextHooks,
|
||||
itFailsFirefox,
|
||||
} from './mocha-utils';
|
||||
} from './mocha-utils'; // eslint-disable-line import/extensions
|
||||
|
||||
describe('DefaultBrowserContext', function () {
|
||||
setupTestBrowserHooks();
|
||||
|
@ -21,7 +21,7 @@ import {
|
||||
setupTestPageAndContextHooks,
|
||||
setupTestBrowserHooks,
|
||||
itFailsFirefox,
|
||||
} from './mocha-utils';
|
||||
} from './mocha-utils'; // eslint-disable-line import/extensions
|
||||
|
||||
describe('Page.Events.Dialog', function () {
|
||||
setupTestBrowserHooks();
|
||||
|
@ -21,10 +21,10 @@ import {
|
||||
setupTestPageAndContextHooks,
|
||||
describeFailsFirefox,
|
||||
itFailsFirefox,
|
||||
} from './mocha-utils';
|
||||
} from './mocha-utils'; // eslint-disable-line import/extensions
|
||||
|
||||
import utils from './utils';
|
||||
import { ElementHandle } from '../src/common/JSHandle';
|
||||
import utils from './utils.js';
|
||||
import { ElementHandle } from '../lib/cjs/common/JSHandle.js';
|
||||
|
||||
describe('ElementHandle specs', function () {
|
||||
setupTestBrowserHooks();
|
||||
|
@ -21,7 +21,7 @@ import {
|
||||
setupTestPageAndContextHooks,
|
||||
itFailsFirefox,
|
||||
describeFailsFirefox,
|
||||
} from './mocha-utils';
|
||||
} from './mocha-utils'; // eslint-disable-line import/extensions
|
||||
|
||||
describe('Emulation', () => {
|
||||
setupTestBrowserHooks();
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import utils from './utils';
|
||||
import utils from './utils.js';
|
||||
import expect from 'expect';
|
||||
import {
|
||||
getTestState,
|
||||
@ -22,7 +22,7 @@ import {
|
||||
setupTestPageAndContextHooks,
|
||||
itFailsFirefox,
|
||||
describeFailsFirefox,
|
||||
} from './mocha-utils';
|
||||
} from './mocha-utils'; // eslint-disable-line import/extensions
|
||||
|
||||
const bigint = typeof BigInt !== 'undefined';
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
|
||||
import expect from 'expect';
|
||||
import { getTestState, itChromeOnly } from './mocha-utils';
|
||||
import { getTestState, itChromeOnly } from './mocha-utils'; // eslint-disable-line import/extensions
|
||||
|
||||
import path from 'path';
|
||||
|
||||
|
@ -14,14 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import utils from './utils';
|
||||
import utils from './utils.js';
|
||||
import expect from 'expect';
|
||||
import {
|
||||
getTestState,
|
||||
setupTestBrowserHooks,
|
||||
setupTestPageAndContextHooks,
|
||||
itFailsFirefox,
|
||||
} from './mocha-utils';
|
||||
} from './mocha-utils'; // eslint-disable-line import/extensions
|
||||
|
||||
describe('Frame specs', function () {
|
||||
setupTestBrowserHooks();
|
||||
|
@ -23,7 +23,7 @@ import {
|
||||
getTestState,
|
||||
describeChromeOnly,
|
||||
itFailsWindows,
|
||||
} from './mocha-utils';
|
||||
} from './mocha-utils'; // eslint-disable-line import/extensions
|
||||
import rimraf from 'rimraf';
|
||||
|
||||
const rmAsync = promisify(rimraf);
|
||||
|
@ -19,7 +19,7 @@ import {
|
||||
getTestState,
|
||||
describeFailsFirefox,
|
||||
itFailsFirefox,
|
||||
} from './mocha-utils';
|
||||
} from './mocha-utils'; // eslint-disable-line import/extensions
|
||||
|
||||
describe('ignoreHTTPSErrors', function () {
|
||||
/* Note that this test creates its own browser rather than use
|
||||
|
@ -21,7 +21,7 @@ import {
|
||||
setupTestBrowserHooks,
|
||||
setupTestPageAndContextHooks,
|
||||
describeFailsFirefox,
|
||||
} from './mocha-utils';
|
||||
} from './mocha-utils'; // eslint-disable-line import/extensions
|
||||
|
||||
const FILE_TO_UPLOAD = path.join(__dirname, '/assets/file-to-upload.txt');
|
||||
|
||||
|
@ -20,7 +20,7 @@ import {
|
||||
setupTestBrowserHooks,
|
||||
setupTestPageAndContextHooks,
|
||||
itFailsFirefox,
|
||||
} from './mocha-utils';
|
||||
} from './mocha-utils'; // eslint-disable-line import/extensions
|
||||
|
||||
describe('JSHandle', function () {
|
||||
setupTestBrowserHooks();
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import utils from './utils';
|
||||
import utils from './utils.js';
|
||||
import os from 'os';
|
||||
import expect from 'expect';
|
||||
import {
|
||||
@ -22,8 +22,8 @@ import {
|
||||
setupTestBrowserHooks,
|
||||
setupTestPageAndContextHooks,
|
||||
itFailsFirefox,
|
||||
} from './mocha-utils';
|
||||
import { KeyInput } from '../src/common/USKeyboardLayout';
|
||||
} from './mocha-utils'; // eslint-disable-line import/extensions
|
||||
import { KeyInput } from '../lib/cjs/common/USKeyboardLayout.js';
|
||||
|
||||
describe('Keyboard', function () {
|
||||
setupTestBrowserHooks();
|
||||
|
@ -23,11 +23,11 @@ import {
|
||||
itFailsFirefox,
|
||||
itOnlyRegularInstall,
|
||||
itFailsWindowsUntilDate,
|
||||
} from './mocha-utils';
|
||||
import utils from './utils';
|
||||
} from './mocha-utils'; // eslint-disable-line import/extensions
|
||||
import utils from './utils.js';
|
||||
import expect from 'expect';
|
||||
import rimraf from 'rimraf';
|
||||
import { Page } from '../src/common/Page';
|
||||
import { Page } from '../lib/cjs/common/Page.js';
|
||||
|
||||
const rmAsync = promisify(rimraf);
|
||||
const mkdtempAsync = promisify(fs.mkdtemp);
|
||||
|
8
test/mocha-ts-require.js
Normal file
8
test/mocha-ts-require.js
Normal file
@ -0,0 +1,8 @@
|
||||
require('ts-node').register({
|
||||
/**
|
||||
* We ignore the lib/ directory because that's already been TypeScript
|
||||
* compiled and checked. So we don't want to check it again as part of running
|
||||
* the unit tests.
|
||||
*/
|
||||
ignore: ['lib/*', 'node_modules'],
|
||||
});
|
@ -14,19 +14,19 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { TestServer } from '../utils/testserver/index';
|
||||
import { TestServer } from '../utils/testserver/index.js';
|
||||
import * as path from 'path';
|
||||
import * as fs from 'fs';
|
||||
import * as os from 'os';
|
||||
import sinon from 'sinon';
|
||||
import puppeteer from '../src/index';
|
||||
import { Browser, BrowserContext } from '../src/common/Browser';
|
||||
import { Page } from '../src/common/Page';
|
||||
import { Puppeteer } from '../src/common/Puppeteer';
|
||||
import utils from './utils';
|
||||
import puppeteer from '../lib/cjs/index.js';
|
||||
import { Browser, BrowserContext } from '../lib/cjs/common/Browser.js';
|
||||
import { Page } from '../lib/cjs/common/Page.js';
|
||||
import { Puppeteer } from '../lib/cjs/common/Puppeteer.js';
|
||||
import utils from './utils.js';
|
||||
import rimraf from 'rimraf';
|
||||
|
||||
import { trackCoverage } from './coverage-utils';
|
||||
import { trackCoverage } from './coverage-utils.js';
|
||||
|
||||
const setupServer = async () => {
|
||||
const assetsPath = path.join(__dirname, 'assets');
|
||||
|
@ -20,8 +20,8 @@ import {
|
||||
setupTestBrowserHooks,
|
||||
setupTestPageAndContextHooks,
|
||||
itFailsFirefox,
|
||||
} from './mocha-utils';
|
||||
import { KeyInput } from '../src/common/USKeyboardLayout';
|
||||
} from './mocha-utils'; // eslint-disable-line import/extensions
|
||||
import { KeyInput } from '../lib/cjs/common/USKeyboardLayout.js';
|
||||
|
||||
interface Dimensions {
|
||||
x: number;
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import utils from './utils';
|
||||
import utils from './utils.js';
|
||||
import expect from 'expect';
|
||||
import {
|
||||
getTestState,
|
||||
@ -22,7 +22,7 @@ import {
|
||||
setupTestPageAndContextHooks,
|
||||
itFailsFirefox,
|
||||
describeFailsFirefox,
|
||||
} from './mocha-utils';
|
||||
} from './mocha-utils'; // eslint-disable-line import/extensions
|
||||
import os from 'os';
|
||||
|
||||
describe('navigation', function () {
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import utils from './utils';
|
||||
import utils from './utils.js';
|
||||
import expect from 'expect';
|
||||
import {
|
||||
getTestState,
|
||||
@ -24,7 +24,7 @@ import {
|
||||
setupTestPageAndContextHooks,
|
||||
itFailsFirefox,
|
||||
describeFailsFirefox,
|
||||
} from './mocha-utils';
|
||||
} from './mocha-utils'; // eslint-disable-line import/extensions
|
||||
|
||||
describe('network', function () {
|
||||
setupTestBrowserHooks();
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import expect from 'expect';
|
||||
import { getTestState, describeChromeOnly } from './mocha-utils';
|
||||
import { getTestState, describeChromeOnly } from './mocha-utils'; // eslint-disable-line import/extensions
|
||||
|
||||
describeChromeOnly('OOPIF', function () {
|
||||
/* We use a special browser for this test as we need the --site-per-process flag */
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import utils from './utils';
|
||||
import utils from './utils.js';
|
||||
const { waitEvent } = utils;
|
||||
import expect from 'expect';
|
||||
import sinon from 'sinon';
|
||||
@ -25,9 +25,9 @@ import {
|
||||
setupTestPageAndContextHooks,
|
||||
itFailsFirefox,
|
||||
describeFailsFirefox,
|
||||
} from './mocha-utils';
|
||||
import { Page, Metrics } from '../src/common/Page';
|
||||
import { JSHandle } from '../src/common/JSHandle';
|
||||
} from './mocha-utils'; // eslint-disable-line import/extensions
|
||||
import { Page, Metrics } from '../lib/cjs/common/Page.js';
|
||||
import { JSHandle } from '../lib/cjs/common/JSHandle.js';
|
||||
|
||||
describe('Page', function () {
|
||||
setupTestBrowserHooks();
|
||||
|
@ -18,7 +18,7 @@ import {
|
||||
getTestState,
|
||||
setupTestBrowserHooks,
|
||||
setupTestPageAndContextHooks,
|
||||
} from './mocha-utils';
|
||||
} from './mocha-utils'; // eslint-disable-line import/extensions
|
||||
|
||||
describe('querySelector', function () {
|
||||
setupTestBrowserHooks();
|
||||
|
@ -16,14 +16,14 @@
|
||||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import utils from './utils';
|
||||
import utils from './utils.js';
|
||||
import expect from 'expect';
|
||||
import {
|
||||
getTestState,
|
||||
setupTestBrowserHooks,
|
||||
setupTestPageAndContextHooks,
|
||||
describeFailsFirefox,
|
||||
} from './mocha-utils';
|
||||
} from './mocha-utils'; // eslint-disable-line import/extensions
|
||||
|
||||
describe('request interception', function () {
|
||||
setupTestBrowserHooks();
|
||||
|
@ -20,7 +20,7 @@ import {
|
||||
setupTestBrowserHooks,
|
||||
setupTestPageAndContextHooks,
|
||||
itFailsFirefox,
|
||||
} from './mocha-utils';
|
||||
} from './mocha-utils'; // eslint-disable-line import/extensions
|
||||
|
||||
describe('Screenshots', function () {
|
||||
setupTestBrowserHooks();
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import utils from './utils';
|
||||
import utils from './utils.js';
|
||||
const { waitEvent } = utils;
|
||||
import expect from 'expect';
|
||||
import {
|
||||
@ -22,8 +22,8 @@ import {
|
||||
setupTestBrowserHooks,
|
||||
setupTestPageAndContextHooks,
|
||||
itFailsFirefox,
|
||||
} from './mocha-utils';
|
||||
import { Target } from '../src/common/Target';
|
||||
} from './mocha-utils'; // eslint-disable-line import/extensions
|
||||
import { Target } from '../lib/cjs/common/Target.js';
|
||||
|
||||
describe('Target', function () {
|
||||
setupTestBrowserHooks();
|
||||
|
@ -20,7 +20,7 @@ import {
|
||||
setupTestBrowserHooks,
|
||||
setupTestPageAndContextHooks,
|
||||
describeFailsFirefox,
|
||||
} from './mocha-utils';
|
||||
} from './mocha-utils'; // eslint-disable-line import/extensions
|
||||
|
||||
describeFailsFirefox('Touchscreen', function () {
|
||||
setupTestBrowserHooks();
|
||||
|
@ -17,7 +17,7 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import expect from 'expect';
|
||||
import { getTestState, describeChromeOnly } from './mocha-utils';
|
||||
import { getTestState, describeChromeOnly } from './mocha-utils'; // eslint-disable-line import/extensions
|
||||
|
||||
describeChromeOnly('Tracing', function () {
|
||||
let outputFile;
|
||||
|
@ -14,14 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import utils from './utils';
|
||||
import utils from './utils.js';
|
||||
import expect from 'expect';
|
||||
import {
|
||||
getTestState,
|
||||
setupTestBrowserHooks,
|
||||
setupTestPageAndContextHooks,
|
||||
itFailsFirefox,
|
||||
} from './mocha-utils';
|
||||
} from './mocha-utils'; // eslint-disable-line import/extensions
|
||||
|
||||
describe('waittask specs', function () {
|
||||
setupTestBrowserHooks();
|
||||
|
@ -20,10 +20,10 @@ import {
|
||||
setupTestBrowserHooks,
|
||||
setupTestPageAndContextHooks,
|
||||
describeFailsFirefox,
|
||||
} from './mocha-utils';
|
||||
import utils from './utils';
|
||||
import { WebWorker } from '../src/common/WebWorker';
|
||||
import { ConsoleMessage } from '../src/common/ConsoleMessage';
|
||||
} from './mocha-utils'; // eslint-disable-line import/extensions
|
||||
import utils from './utils.js';
|
||||
import { WebWorker } from '../lib/cjs/common/WebWorker.js';
|
||||
import { ConsoleMessage } from '../lib/cjs/common/ConsoleMessage.js';
|
||||
const { waitEvent } = utils;
|
||||
|
||||
describeFailsFirefox('Workers', function () {
|
||||
|
Loading…
Reference in New Issue
Block a user