Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[test] merge x-pack jest config into root #41718

Closed
wants to merge 30 commits into from
Closed

Conversation

jbudz
Copy link
Member

@jbudz jbudz commented Jul 22, 2019

This merges the jest config in x-pack with the core config at src/dev, and removes any duplicated code. All jest tests are (+x-pack) run with node scripts/jest.

x-pack/scripts/jest remains for backwards compatibility.

Closes #19019
Closes #41129

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@jbudz
Copy link
Member Author

jbudz commented Aug 12, 2019

There may be one lingering path related canvas test here, but the bulk of it is ready for review. Will get that fixed shortly.

@jbudz jbudz marked this pull request as ready for review August 12, 2019 15:06
@jbudz jbudz requested review from a team as code owners August 12, 2019 15:06
@jbudz jbudz added review Team:Operations Team label for Operations Team labels Aug 12, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-operations

@jbudz jbudz added the release_note:plugin_api_changes Contains a Plugin API changes section for the breaking plugin API changes section. label Aug 12, 2019
@elasticmachine
Copy link
Contributor

💔 Build Failed

@@ -372,7 +372,7 @@ The following table outlines possible test file locations and how to invoke them

| Test runner | Test location | Runner command (working directory is kibana root) |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| Jest | `src/**/*.test.js`<br>`src/**/*.test.ts` | `node scripts/jest -t regexp [test path]` |
| Jest | `src/**/*.test.{js,ts}`<br>`x-pack(\/legacy)?/plugins/*.test.{js,ts}` | `node scripts/jest -t regexp [test path]` |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should avoid the specificity of the (\/legacy)?/plugins bit, since it's already outdated based on the roots. We should probably just select all .test.{js,ts} files in x-pack

@@ -37,6 +37,9 @@ export default {
'<rootDir>/packages',
'<rootDir>/src/test_utils',
'<rootDir>/test/functional/services/remote',
'<rootDir>/x-pack/plugins',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason we can't just list <rootDir>/x-pack/?

'^plugins/([^\/.]*)(.*)': '<rootDir>/src/legacy/core_plugins/$1/public$2',
'^ui/(.*)': '<rootDir>/src/legacy/ui/public/$1',
'^uiExports/(.*)': '<rootDir>/src/dev/jest/mocks/file_mock.js',
'^test_utils/(.*)': '<rootDir>/src/test_utils/public/$1',
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/src/dev/jest/mocks/file_mock.js',
'\\.(css|less|scss)$': '<rootDir>/src/dev/jest/mocks/style_mock.js',

'^legacy/plugins/xpack_main/(.*);': '<rootDir>/x-pack/legacy/plugins/xpack_main/public/$1',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this only match import x from 'legacy/plugins/xpack_main/...'? I don't think we have any of those.

@@ -13,7 +13,6 @@
"test": "gulp test",
"test:browser:dev": "gulp testbrowser-dev",
"test:browser": "gulp testbrowser",
"test:jest": "node scripts/jest",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should keep this? node scripts/jest x-pack?

@@ -4,5 +4,4 @@
* you may not use this file except in compliance with the Elastic License.
*/

require('@kbn/plugin-helpers').babelRegister();
require('../dev-tools/jest').runJest();
require('../../scripts/jest');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we extend process.argv to include x-pack so that tests are filtered?

Copy link
Member

@jasonrhodes jasonrhodes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is still in active development but the infra changes look fine to me.

@jbudz jbudz requested review from a team as code owners December 9, 2019 15:51
@jbudz jbudz requested a review from a team December 9, 2019 15:51
@jbudz
Copy link
Member Author

jbudz commented Dec 9, 2019

Alrighty then, new PR. sorry for the notifications :)

@jbudz jbudz closed this Dec 9, 2019
@elasticmachine
Copy link
Contributor

💔 Build Failed

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:plugin_api_changes Contains a Plugin API changes section for the breaking plugin API changes section. review Team:Operations Team label for Operations Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[test] run x-pack jest tests from root Cannot run x-pack jest tests
5 participants