[scout] adding ESLint rules for test package imports#225791
[scout] adding ESLint rules for test package imports#225791dmlemeshko merged 12 commits intoelastic:mainfrom
Conversation
4f0625c to
e6f8960
Compare
I believe it works as expected now, I will push an update for this file |
|
@csr based on this error I think we are already guarded from solution packages being imported in |
|
✅ Importing ✅ Importing ✅ I can see the error you reported in your last comment when importing the Scout Observability package in a platform test: ✅ Importing Playwright in an observability test throws an error: |
|
Pinging @elastic/obs-ux-management-team (Team:obs-ux-management) |
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Public APIs missing comments
History
cc @dmlemeshko |
cesco-f
left a comment
There was a problem hiding this comment.
Changes in x-pack/solutions/observability/plugins/observability/tsconfig.json and x-pack/solutions/observability/plugins/observability/ui_tests/fixtures/generators.ts LGTM.
flash1293
left a comment
There was a problem hiding this comment.
Just adding a comma, what could go wrong?
|
Starting backport for target branches: 8.19, 9.1 https://github.com/elastic/kibana/actions/runs/16019965408 |
💔 All backports failed
Manual backportTo create the backport manually run: Questions ?Please refer to the Backport tool documentation |
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
## Summary
Adding ESLint rules to control the proper test package is used for
testing:
- platform tests should import only from `@kbn/scout`
- solution tests should import only from solution-specific scout package
(e.g. security plugins => `@kbn/scout-security`)
example:
```
ERROR
/Users/dmle/github/kibana/x-pack/solutions/observability/plugins/apm/ui_tests/parallel_tests/service_inventory/service_inventory.spec.ts
7:1 error '@kbn/scout' import is restricted from being used by a pattern.
Observability solution tests should import from '@kbn/scout-oblt' instead no-restricted-imports
✖ 1 problem (1 error, 0 warnings)
```
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 4c6ab87)
# Conflicts:
# x-pack/solutions/observability/plugins/observability/tsconfig.json
# x-pack/solutions/observability/plugins/observability/ui_tests/fixtures/generators.ts
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
## Summary
Adding ESLint rules to control the proper test package is used for
testing:
- platform tests should import only from `@kbn/scout`
- solution tests should import only from solution-specific scout package
(e.g. security plugins => `@kbn/scout-security`)
example:
```
ERROR
/Users/dmle/github/kibana/x-pack/solutions/observability/plugins/apm/ui_tests/parallel_tests/service_inventory/service_inventory.spec.ts
7:1 error '@kbn/scout' import is restricted from being used by a pattern.
Observability solution tests should import from '@kbn/scout-oblt' instead no-restricted-imports
✖ 1 problem (1 error, 0 warnings)
```
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 4c6ab87)
# Conflicts:
# x-pack/platform/plugins/shared/streams_app/tsconfig.json
# x-pack/solutions/observability/plugins/observability/tsconfig.json
# x-pack/solutions/observability/plugins/observability/ui_tests/fixtures/generators.ts
|
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
1 similar comment
|
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
…226138) # Backport This will backport the following commits from `main` to `9.1`: - [[scout] adding ESLint rules for test package imports (#225791)](#225791) <!--- Backport version: 10.0.1 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Dzmitry Lemechko","email":"dzmitry.lemechko@elastic.co"},"sourceCommit":{"committedDate":"2025-07-02T08:23:16Z","message":"[scout] adding ESLint rules for test package imports (#225791)\n\n## Summary\n\nAdding ESLint rules to control the proper test package is used for\ntesting:\n\n- platform tests should import only from `@kbn/scout`\n- solution tests should import only from solution-specific scout package\n(e.g. security plugins => `@kbn/scout-security`)\n\n\nexample: \n\n```\nERROR\n/Users/dmle/github/kibana/x-pack/solutions/observability/plugins/apm/ui_tests/parallel_tests/service_inventory/service_inventory.spec.ts\n 7:1 error '@kbn/scout' import is restricted from being used by a pattern.\nObservability solution tests should import from '@kbn/scout-oblt' instead no-restricted-imports\n\n ✖ 1 problem (1 error, 0 warnings)\n```\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"4c6ab87ddf409ca92db7f8278a851e3751c6bb99","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:obs-ux-management","backport:version","test:scout","v9.1.0","v8.19.0","v9.2.0"],"title":"[scout] adding ESLint rules for test package imports","number":225791,"url":"https://github.com/elastic/kibana/pull/225791","mergeCommit":{"message":"[scout] adding ESLint rules for test package imports (#225791)\n\n## Summary\n\nAdding ESLint rules to control the proper test package is used for\ntesting:\n\n- platform tests should import only from `@kbn/scout`\n- solution tests should import only from solution-specific scout package\n(e.g. security plugins => `@kbn/scout-security`)\n\n\nexample: \n\n```\nERROR\n/Users/dmle/github/kibana/x-pack/solutions/observability/plugins/apm/ui_tests/parallel_tests/service_inventory/service_inventory.spec.ts\n 7:1 error '@kbn/scout' import is restricted from being used by a pattern.\nObservability solution tests should import from '@kbn/scout-oblt' instead no-restricted-imports\n\n ✖ 1 problem (1 error, 0 warnings)\n```\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"4c6ab87ddf409ca92db7f8278a851e3751c6bb99"}},"sourceBranch":"main","suggestedTargetBranches":["9.1","8.19"],"targetPullRequestStates":[{"branch":"9.1","label":"v9.1.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/225791","number":225791,"mergeCommit":{"message":"[scout] adding ESLint rules for test package imports (#225791)\n\n## Summary\n\nAdding ESLint rules to control the proper test package is used for\ntesting:\n\n- platform tests should import only from `@kbn/scout`\n- solution tests should import only from solution-specific scout package\n(e.g. security plugins => `@kbn/scout-security`)\n\n\nexample: \n\n```\nERROR\n/Users/dmle/github/kibana/x-pack/solutions/observability/plugins/apm/ui_tests/parallel_tests/service_inventory/service_inventory.spec.ts\n 7:1 error '@kbn/scout' import is restricted from being used by a pattern.\nObservability solution tests should import from '@kbn/scout-oblt' instead no-restricted-imports\n\n ✖ 1 problem (1 error, 0 warnings)\n```\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"4c6ab87ddf409ca92db7f8278a851e3751c6bb99"}}]}] BACKPORT--> --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
…#226146) # Backport This will backport the following commits from `main` to `8.19`: - [[scout] adding ESLint rules for test package imports (#225791)](#225791) <!--- Backport version: 10.0.1 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Dzmitry Lemechko","email":"dzmitry.lemechko@elastic.co"},"sourceCommit":{"committedDate":"2025-07-02T08:23:16Z","message":"[scout] adding ESLint rules for test package imports (#225791)\n\n## Summary\n\nAdding ESLint rules to control the proper test package is used for\ntesting:\n\n- platform tests should import only from `@kbn/scout`\n- solution tests should import only from solution-specific scout package\n(e.g. security plugins => `@kbn/scout-security`)\n\n\nexample: \n\n```\nERROR\n/Users/dmle/github/kibana/x-pack/solutions/observability/plugins/apm/ui_tests/parallel_tests/service_inventory/service_inventory.spec.ts\n 7:1 error '@kbn/scout' import is restricted from being used by a pattern.\nObservability solution tests should import from '@kbn/scout-oblt' instead no-restricted-imports\n\n ✖ 1 problem (1 error, 0 warnings)\n```\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"4c6ab87ddf409ca92db7f8278a851e3751c6bb99","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:obs-ux-management","backport:version","test:scout","v9.1.0","v8.19.0","v9.2.0"],"title":"[scout] adding ESLint rules for test package imports","number":225791,"url":"https://github.com/elastic/kibana/pull/225791","mergeCommit":{"message":"[scout] adding ESLint rules for test package imports (#225791)\n\n## Summary\n\nAdding ESLint rules to control the proper test package is used for\ntesting:\n\n- platform tests should import only from `@kbn/scout`\n- solution tests should import only from solution-specific scout package\n(e.g. security plugins => `@kbn/scout-security`)\n\n\nexample: \n\n```\nERROR\n/Users/dmle/github/kibana/x-pack/solutions/observability/plugins/apm/ui_tests/parallel_tests/service_inventory/service_inventory.spec.ts\n 7:1 error '@kbn/scout' import is restricted from being used by a pattern.\nObservability solution tests should import from '@kbn/scout-oblt' instead no-restricted-imports\n\n ✖ 1 problem (1 error, 0 warnings)\n```\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"4c6ab87ddf409ca92db7f8278a851e3751c6bb99"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"9.1","label":"v9.1.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/226138","number":226138,"state":"OPEN"},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/225791","number":225791,"mergeCommit":{"message":"[scout] adding ESLint rules for test package imports (#225791)\n\n## Summary\n\nAdding ESLint rules to control the proper test package is used for\ntesting:\n\n- platform tests should import only from `@kbn/scout`\n- solution tests should import only from solution-specific scout package\n(e.g. security plugins => `@kbn/scout-security`)\n\n\nexample: \n\n```\nERROR\n/Users/dmle/github/kibana/x-pack/solutions/observability/plugins/apm/ui_tests/parallel_tests/service_inventory/service_inventory.spec.ts\n 7:1 error '@kbn/scout' import is restricted from being used by a pattern.\nObservability solution tests should import from '@kbn/scout-oblt' instead no-restricted-imports\n\n ✖ 1 problem (1 error, 0 warnings)\n```\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"4c6ab87ddf409ca92db7f8278a851e3751c6bb99"}}]}] BACKPORT--> --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
## Summary
Adding ESLint rules to control the proper test package is used for
testing:
- platform tests should import only from `@kbn/scout`
- solution tests should import only from solution-specific scout package
(e.g. security plugins => `@kbn/scout-security`)
example:
```
ERROR
/Users/dmle/github/kibana/x-pack/solutions/observability/plugins/apm/ui_tests/parallel_tests/service_inventory/service_inventory.spec.ts
7:1 error '@kbn/scout' import is restricted from being used by a pattern.
Observability solution tests should import from '@kbn/scout-oblt' instead no-restricted-imports
✖ 1 problem (1 error, 0 warnings)
```
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>




Summary
Adding ESLint rules to control the proper test package is used for testing:
@kbn/scout@kbn/scout-security)example: