Skip to content

Commit ba6e036

Browse files
authored
fix(testing): handle undefined options in playwright preset (#34750)
## Current Behavior When calling `nxE2EPreset(__filename)` without passing the optional `options` parameter, the function throws a runtime error because `options.openHtmlReport` accesses a property on `undefined`. Other property accesses in the function already use optional chaining (`options?.testDir`, `options?.generateBlobReports`), but this one was missed. Additionally, the `openHtmlReport` property documents a default value of `'on-failure'` via JSDoc, but that default was never actually applied in the code. ## Expected Behavior Calling `nxE2EPreset(__filename)` without the `options` argument works without errors. The `openHtmlReport` option correctly falls back to `'on-failure'` when not specified, matching the documented `@default` in the interface. ## Related Issue(s) N/A - Discovered when upgrading NX and we didn't pass options
1 parent ec8be2d commit ba6e036

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/playwright/src/utils/preset.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export function nxE2EPreset(
6969
outputFolder: isTsSolutionSetup
7070
? 'test-output/playwright/report'
7171
: join(offset, 'dist', '.playwright', projectPath, 'playwright-report'),
72-
open: options.openHtmlReport,
72+
open: options?.openHtmlReport ?? 'on-failure',
7373
},
7474
]);
7575
const shouldGenerateBlobReports =

0 commit comments

Comments
 (0)