Skip to content

Conversation

@steliosmavro
Copy link

Summary
Adds a new ESLint rule to discourage the use of the kbnClient fixture within API tests in Scout. The rule emits a warning if kbnClient is unpacked or used directly in the test body, guiding test authors to avoid using it for endpoint validation and to follow best practices.

Why

  • Prevents misuse of kbnClient in API tests, which can lead to privilege issues or unclear test intent.
  • Encourages test authors to use apiClient for endpoint validation, maintaining consistency and clarity in test design.

What changed

  • Introduced a new ESLint rule that checks for direct usage or unpacking of kbnClient in API test blocks.
  • The rule emits a warning when kbnClient is used, but can be overridden with a comment in rare, justified cases.

How to use

  • Write API tests as usual, avoiding direct use of kbnClient in the test body.
  • If the rule triggers in a valid edge case, suppress the warning with an ESLint comment and provide a justification.

@steliosmavro steliosmavro requested a review from csr December 3, 2025 21:37
@steliosmavro steliosmavro requested a review from a team as a code owner December 3, 2025 21:37
@steliosmavro steliosmavro added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting labels Dec 3, 2025
@cla-checker-service
Copy link

❌ Author of the following commits did not sign a Contributor Agreement:
fd7ea94

Please, read and sign the above mentioned agreement if you want to contribute to this project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant