Move RenderHost initialisation to Jest

Summary:
This diff moves RenderHost initialisation to jest, which is thereby treated as just another 'Host' like flipper-ui, the electron app etc. A benefit is that it provides a mocked flipperServer by default that can be used to mock or intercept requests. See LaunchEmulator.spec as example.

Also made the jest setup scripts strongly typed by converting them to TS.

This change allows the test stub configuration, which was OS dependent, out of flipper-ui-core.

Reviewed By: nikoant

Differential Revision: D32668632

fbshipit-source-id: fac0c09812b000fd7d1acb75010c35573087c99f
This commit is contained in:
Michel Weststrate
2021-12-08 04:25:28 -08:00
committed by Facebook GitHub Bot
parent e7f841b6d2
commit f9b72ac69e
14 changed files with 237 additions and 270 deletions

View File

@@ -12,8 +12,8 @@ module.exports = {
'^.*__tests__(/|\\\\).*\\.tsx?$': 'ts-jest',
'\\.(js|tsx?)$': '<rootDir>/scripts/jest-transform.js',
},
setupFiles: ['<rootDir>/scripts/jest-setup.js'],
setupFilesAfterEnv: ['<rootDir>/scripts/jest-setup-after.js'],
setupFiles: ['<rootDir>/scripts/jest-setup.ts'],
setupFilesAfterEnv: ['<rootDir>/scripts/jest-setup-after.ts'],
moduleNameMapper: {
'^flipper$': '<rootDir>/app/src',
'^flipper-plugin$': '<rootDir>/flipper-plugin/src',