Skip to content

Commit 88d9384

Browse files
🧹 Refactor Puppeteer imports to use named import 'launch' . (#3953)
1 parent 3fcc7af commit 88d9384

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

‎performances/src/main.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Page } from 'puppeteer'
2-
import puppeteer from 'puppeteer'
2+
import { launch } from 'puppeteer'
33
import { formatProfilingResults } from './format'
44
import { startProfiling } from './profilers/startProfiling'
55
import type { ProfilingResults, ProfilingOptions } from './profiling.types'
@@ -49,7 +49,7 @@ async function profileScenario(
4949
options: ProfilingOptions,
5050
runScenario: (page: Page, takeMeasurements: () => Promise<void>) => Promise<void>
5151
) {
52-
const browser = await puppeteer.launch({
52+
const browser = await launch({
5353
defaultViewport: { width: 1366, height: 768 },
5454
// Twitter detects headless browsing and refuses to load
5555
headless: false,

‎scripts/performance/lib/memoryPerformance.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Browser, CDPSession, Page, Protocol } from 'puppeteer'
2-
import puppeteer from 'puppeteer'
2+
import { launch } from 'puppeteer'
33
import { fetchPR, LOCAL_BRANCH } from '../../lib/gitUtils.ts'
44
import { formatSize, printLog } from '../../lib/executionUtils.ts'
55
import { markdownArray, type Pr } from './reportAsAPrComment.ts'
@@ -84,7 +84,7 @@ async function runTests(tests: Test[], benchmarkUrl: string, cb: (result: Perfor
8484
}
8585

8686
async function runTest(testButton: string, benchmarkUrl: string): Promise<TestRunResult> {
87-
const browser: Browser = await puppeteer.launch({
87+
const browser: Browser = await launch({
8888
args: ['--no-sandbox', '--disable-setuid-sandbox'],
8989
})
9090
const page: Page = await browser.newPage()

‎test/e2e/scenario/rum/s8sInject.scenario.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as fs from 'fs'
2-
import puppeteer from 'puppeteer'
2+
import { launch } from 'puppeteer'
33
import { test, expect } from '@playwright/test'
44
import { getSdkBundlePath } from '../../lib/framework'
55
import { APPLICATION_ID, CLIENT_TOKEN } from '../../lib/helpers/configuration'
@@ -14,7 +14,7 @@ test.describe('Inject RUM with Puppeteer', () => {
1414

1515
async function injectRumWithPuppeteer() {
1616
const ddRUM = fs.readFileSync(getSdkBundlePath('rum', '/datadog-rum.js'), 'utf8')
17-
const puppeteerBrowser = await puppeteer.launch({ headless: true, devtools: true, args: ['--no-sandbox'] })
17+
const puppeteerBrowser = await launch({ headless: true, devtools: true, args: ['--no-sandbox'] })
1818
let injected = true
1919

2020
const page = await puppeteerBrowser.newPage()

0 commit comments

Comments
 (0)