Merged
Conversation
added 8 commits
September 6, 2018 17:38
…#22694 and break with jest 23
aec3f1a to
80d2c44
Compare
Contributor
💚 Build Succeeded |
Contributor
|
ack: started to look into this one, if don't finish today will continue on Monday (I'm on "Support Duty" on Monday though, but we'll see). |
azasypkin
approved these changes
Sep 7, 2018
Contributor
azasypkin
left a comment
There was a problem hiding this comment.
Okay, review was easier than I thought initially. I really wanted Jest's new mock.returnResults, so thanks a lot for upgrading it!
There is a chance that this PR will conflict with other PRs that are going to be merged today and won't be rebased on the latest master, so we probably need an announcement :)
| // We need to always provide a limit and not rely on the default | ||
| if (!limit) { | ||
| throw '`getIndices()` was called without the required `limit` parameter.'; | ||
| throw new Error('`getIndices()` was called without the required `limit` parameter.'); |
spalger
pushed a commit
to spalger/kibana
that referenced
this pull request
Sep 8, 2018
I'd really like to upgrade to Typescript 3 for its `unknown` type, but we need to upgrade to `jest@23` to support a recent version of `ts-jest@23`. The [jest changelog](https://github.com/facebook/jest/blob/master/CHANGELOG.md) breaks down the breaking changes in 23.x, but I found it to be slightly incomplete so I've broken down the changes that actually caused breaks for us here, and addressed each in individual commits to make review a little easier: - the `testURL` config default was changed from `about:blank` to `http://localhost` - this cause some XHR requests powered by JSdom to start failing. It seems these requests just do nothing in master but start to fail when JSdom is initialized with an actual URL... I think we would ideally stop sending meaningless XHR requests in the tests, but it was a lot easier to just set the config to `about:blank` for now, and we can worry about cleanup later if necessary - `expect(...).toThrow()` only passes if an actual error was thrown. - In two places in the index pattern code we were throwing strings, which broke the assertions. Fortunately/Unfortunately the errors are not being consumed by anything, so I was able to wrap them in `new Error()` without causing any issues. - snapshots of mock functions now include a `results` array, detailing the return values of the function - React fragments are now serialized as `<React.Fragment>` instead of `<UNDEFINED>` - undefined props in React components are now stripped from snapshots - minor changes to the ordering of mocks, imports resolution, and before hooks caused the uiSettings API tests to start breaking, but I'm replacing them with totally new tests in elastic#22694 so I just deleted them here - mocks created with `jest.spyOn()` that are restored now have their `mock.calls` reset, so some of the kbn-pm tests stated failing. This was fixed by restoring them with `jest.restoreAllMocks()` rather than trying to do it before the assertions
Contributor
💚 Build Succeeded |
spalger
pushed a commit
that referenced
this pull request
Sep 8, 2018
I'd really like to upgrade to Typescript 3 for its `unknown` type, but we need to upgrade to `jest@23` to support a recent version of `ts-jest@23`. The [jest changelog](https://github.com/facebook/jest/blob/master/CHANGELOG.md) breaks down the breaking changes in 23.x, but I found it to be slightly incomplete so I've broken down the changes that actually caused breaks for us here, and addressed each in individual commits to make review a little easier: - the `testURL` config default was changed from `about:blank` to `http://localhost` - this cause some XHR requests powered by JSdom to start failing. It seems these requests just do nothing in master but start to fail when JSdom is initialized with an actual URL... I think we would ideally stop sending meaningless XHR requests in the tests, but it was a lot easier to just set the config to `about:blank` for now, and we can worry about cleanup later if necessary - `expect(...).toThrow()` only passes if an actual error was thrown. - In two places in the index pattern code we were throwing strings, which broke the assertions. Fortunately/Unfortunately the errors are not being consumed by anything, so I was able to wrap them in `new Error()` without causing any issues. - snapshots of mock functions now include a `results` array, detailing the return values of the function - React fragments are now serialized as `<React.Fragment>` instead of `<UNDEFINED>` - undefined props in React components are now stripped from snapshots - minor changes to the ordering of mocks, imports resolution, and before hooks caused the uiSettings API tests to start breaking, but I'm replacing them with totally new tests in #22694 so I just deleted them here - mocks created with `jest.spyOn()` that are restored now have their `mock.calls` reset, so some of the kbn-pm tests stated failing. This was fixed by restoring them with `jest.restoreAllMocks()` rather than trying to do it before the assertions
Contributor
Author
|
6.x/6.5: 9a7fa9a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I'd really like to upgrade to Typescript 3 for its
unknowntype, but we need to upgrade tojest@23to support a recent version ofts-jest@23.The jest changelog breaks down the breaking changes in 23.x, but I found it to be slightly incomplete so I've broken down the changes that actually caused breaks for us here, and addressed each in individual commits to make review a little easier:
testURLconfig default was changed fromabout:blanktohttp://localhostabout:blankfor now, and we can worry about cleanup later if necessaryexpect(...).toThrow()only passes if an actual error was thrown.new Error()without causing any issues.resultsarray, detailing the return values of the function<React.Fragment>instead of<UNDEFINED>jest.spyOn()that are restored now have theirmock.callsreset, so some of the kbn-pm tests stated failing. This was fixed by restoring them withjest.restoreAllMocks()rather than trying to do it before the assertions