Skip to content

[9.1] [@kbn/scout] Add runtime validation for global.setup.ts (#248113)#248516

Merged
steliosmavro merged 2 commits intoelastic:9.1from
steliosmavro:backport/9.1/pr-248113
Jan 13, 2026
Merged

[9.1] [@kbn/scout] Add runtime validation for global.setup.ts (#248113)#248516
steliosmavro merged 2 commits intoelastic:9.1from
steliosmavro:backport/9.1/pr-248113

Conversation

@steliosmavro
Copy link
Contributor

Backport

This will backport the following commits from main to 9.1:

Questions ?

Please refer to the Backport tool documentation

…8113)

## Summary

This PR replaces the ESLint rule
`scout_require_global_setup_hook_in_parallel_tests` with a runtime
validation in Scout's config validator. The runtime check is more
reliable since it validates the actual config and filesystem state at
execution time, rather than relying on static analysis.

## Changes

**Runtime validation in `@kbn/scout`:**
- Added `runGlobalSetup` to `ScoutTestOptions` type
- `createPlaywrightConfig` now passes `runGlobalSetup` to the config's
`use` object
- `validatePlaywrightConfig` checks that `global.setup.ts` exists when
`runGlobalSetup: true`
- Clear error message with expected file path and resolution steps

**Removed ESLint rule:**
- Deleted `scout_require_global_setup_hook_in_parallel_tests.js` rule
and tests
- Removed from `kbn-eslint-plugin-eslint/index.js` exports
- Removed from `.eslintrc.js` configuration

## Why runtime over ESLint?

- ESLint can't reliably check filesystem/config consistency when values
are computed dynamically
- Runtime validation catches the issue at the right moment (before tests
run)
- Having `global.setup.ts` present but unused is valid (teams may enable
it later)
- The opposite case (`runGlobalSetup: true` without the file) should
fail fast

(cherry picked from commit 80affb2)

# Conflicts:
#	packages/kbn-eslint-plugin-eslint/rules/scout_require_global_setup_hook_in_parallel_tests.js
#	packages/kbn-eslint-plugin-eslint/rules/scout_require_global_setup_hook_in_parallel_tests.test.js
#	src/platform/packages/shared/kbn-scout/src/playwright/runner/config_validator.ts
@steliosmavro steliosmavro added the backport This PR is a backport of another PR label Jan 9, 2026
@steliosmavro steliosmavro enabled auto-merge (squash) January 9, 2026 17:48
@elasticmachine
Copy link
Contributor

elasticmachine commented Jan 12, 2026

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #40 / Search solution tests Search onboarding API keys Elasticsearch Start [Onboarding Empty State] should show the api key in code view

Metrics [docs]

‼️ ERROR: no builds found for mergeBase sha [c444c5c]

History

@steliosmavro steliosmavro merged commit af8504b into elastic:9.1 Jan 13, 2026
13 checks passed
@steliosmavro steliosmavro self-assigned this Jan 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants