-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Update jest to v24 #31825
Update jest to v24 #31825
Changes from 10 commits
a51433c
407f05f
50d304f
b720d65
6fa51a7
ceca217
4965ef2
86b04fa
ec6a293
a10c162
443a965
a220c7a
126797b
7c872e1
bdc51f4
25652e2
d15a588
1d94ac9
cf67999
b4fa793
d50fc60
a83aaf8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ let appenderMocks: Appender[]; | |
let logger: BaseLogger; | ||
|
||
const timestamp = new Date(2012, 1, 1); | ||
jest.spyOn(global, 'Date').mockImplementation(() => timestamp); | ||
jest.spyOn<any, any>(global, 'Date').mockImplementation(() => timestamp); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This spy doesn't ever seem to be restored with As an aside: it'd be awesome if there was linter rule we could add for this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 will fix. don't know why but I was sure we use |
||
|
||
beforeEach(() => { | ||
appenderMocks = [{ append: jest.fn() }, { append: jest.fn() }]; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,10 +27,10 @@ const timestamp = new Date(Date.UTC(2012, 1, 1)); | |
const mockConsoleLog = jest.spyOn(global.console, 'log').mockImplementation(() => { | ||
// noop | ||
}); | ||
jest.spyOn(global, 'Date').mockImplementation(() => timestamp); | ||
jest.spyOn<any, any>(global, 'Date').mockImplementation(() => timestamp); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above about |
||
|
||
import { createWriteStream } from 'fs'; | ||
const mockCreateWriteStream = createWriteStream as jest.Mock<typeof createWriteStream>; | ||
const mockCreateWriteStream = (createWriteStream as unknown) as jest.Mock<typeof createWriteStream>; | ||
|
||
import { LoggingConfig, LoggingService } from '.'; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,9 +40,9 @@ import { logger } from '../logging/__mocks__'; | |
const env = new Env('.', getEnvOptions()); | ||
const config$ = new BehaviorSubject({} as Config); | ||
|
||
const mockProcessExit = jest.spyOn(global.process, 'exit').mockImplementation(() => { | ||
// noop | ||
}); | ||
const mockProcessExit = jest | ||
.spyOn(global.process, 'exit') | ||
.mockImplementation(() => undefined as never); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also missing a restore. |
||
|
||
const mockConsoleError = jest.spyOn(console, 'error').mockImplementation(() => { | ||
// noop | ||
|
@@ -178,7 +178,7 @@ test('fails and stops services if initial logger upgrade fails', async () => { | |
|
||
test('stops services if consequent logger upgrade fails', async () => { | ||
const onShutdown = new BehaviorSubject<string | null>(null); | ||
const mockOnShutdown = jest.fn(() => { | ||
const mockOnShutdown = jest.fn<any, any>(() => { | ||
onShutdown.next('completed'); | ||
onShutdown.complete(); | ||
}); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,7 +46,7 @@ | |
"@types/expect.js": "^0.3.29", | ||
"@types/graphql": "^0.13.1", | ||
"@types/history": "^4.6.2", | ||
"@types/jest": "^23.3.1", | ||
"@types/jest": "^24.0.6", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @epixa why we need to have another |
||
"@types/joi": "^13.4.2", | ||
"@types/jsonwebtoken": "^7.2.7", | ||
"@types/lodash": "^3.10.1", | ||
|
@@ -99,8 +99,8 @@ | |
"gulp-mocha": "2.2.0", | ||
"gulp-multi-process": "^1.3.1", | ||
"hapi": "^17.5.3", | ||
"jest": "^23.6.0", | ||
"jest-cli": "^23.6.0", | ||
"jest": "^24.1.0", | ||
"jest-cli": "^24.1.0", | ||
"jest-styled-components": "^6.2.2", | ||
"jsdom": "^12.0.0", | ||
"mocha": "3.3.0", | ||
|
@@ -147,6 +147,7 @@ | |
"@scant/router": "^0.1.0", | ||
"@slack/client": "^4.8.0", | ||
"@turf/boolean-contains": "6.0.1", | ||
"@types/jest": "^24.0.6", | ||
"@types/json-stable-stringify": "^1.0.32", | ||
"angular-resource": "1.4.9", | ||
"angular-sanitize": "1.6.5", | ||
|
@@ -202,6 +203,8 @@ | |
"inline-style": "^2.0.0", | ||
"intl": "^1.2.5", | ||
"io-ts": "^1.4.2", | ||
"jest": "^24.1.0", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why packages are duplicated in "devDependencies" and "dependencies"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably a mistake. I would be surprised if we wanted to ship There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sometimes it happens. Contentful did it to run their functional tests 😅 |
||
"jest-cli": "^24.1.0", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question/issue: why do we need There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. seems like a mistake when updated version via yarn cli. will fix now |
||
"joi": "^13.5.2", | ||
"jquery": "^3.3.1", | ||
"json-stable-stringify": "^1.0.1", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: how about updating
babel-jest
to24.1.0
here and inx-pack
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
babel-jest@v24
usesbabel@v7
which require@kbn/babel-preset/node_preset
update. seems like quite a bit taskThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will be done in #32326