Commit Graph

15 Commits

Author SHA1 Message Date
Lorenzo Blasa
6430403da0 Jest update v26.6.3 -> v29.5.1
Summary:
^

Basically, update Jest and fix any raised issues. Mainly:
- Update necessary dependencies
- Update snapshots
- `useFakeTimers` caused a few issues which meant that the way we hook into the performance object had to be tweaked. The main code change is: `//fbsource/xplat/sonar/desktop/scripts/jest-setup-after.tsx`
- `mocked` -> `jest.mocked`

Changelog: Update Jest to v29.5.1

Reviewed By: antonk52

Differential Revision: D46319818

fbshipit-source-id: d218ca8f7e43abac6b00844953ddeb7f4e1010a2
2023-05-31 14:19:29 -07:00
Andrey Goncharov
423a8d1935 Revamp newScript detailed view
Summary: Project: https://docs.google.com/document/d/1SbFrpvfIShX5npANNa1AkgHliR1M-VMLW5Q9RhREt94/edit#

Reviewed By: antonk52

Differential Revision: D45353402

fbshipit-source-id: 88cc26f9886fd7b2cdcd5ca3d021790d8669c140
2023-04-28 12:19:45 -07:00
Andrey Goncharov
5e818edc2f Expose text report for unit test code coverage
Summary: At the request of msys

Reviewed By: lblasa

Differential Revision: D38740940

fbshipit-source-id: 25722144037ce404ef7572e9553037e7344c6955
2022-08-17 04:37:52 -07:00
Andrey Goncharov
ef5fa275a3 Use AbstractClient from flipper-frontend-core in fliper-ui-core
Summary: This stack attempts to start using flipper-frontend-core from flipper-ui-core. Currently, flipper-frontend-core contains lots of copy-pasted code from flipper-ui-core.

Reviewed By: lblasa

Differential Revision: D37139198

fbshipit-source-id: 042db7492c550e10ea72c32fd15001c141bf53f9
2022-06-20 12:18:40 -07:00
Anton Kastritskiy
071bcaff96 Rename second batch for '.ts' files to '.tsx' in scripts dir
Summary: Rename first batch for '.ts' files to '.tsx'

Reviewed By: passy

Differential Revision: D33843246

fbshipit-source-id: eb8080db8cc3ef07820339bf8deafa208432de7c
2022-01-31 02:57:54 -08:00
Andres Suarez
79023ee190 Update copyright headers from Facebook to Meta
Reviewed By: bhamodi

Differential Revision: D33331422

fbshipit-source-id: 016e8dcc0c0c7f1fc353a348b54fda0d5e2ddc01
2021-12-27 14:31:45 -08:00
Michel Weststrate
f9b72ac69e 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
2021-12-08 04:30:55 -08:00
Michel Weststrate
c3ff0ff355 Set up Flipper decapitated packages
Summary:
This diff introduces the packages necessary for Flipper decapitated.

* flipper-common: utilities & types shared between client, server, flipper-plugin
* flipper-server-core: all device & client management goes in here. Basically flipper's backend
* flipper-ui-core: all UI goes in here, as far as it doesn't depend on Electron
* desktop: the Electron app, will load server-core and ui-core, and glue them together, providing implementations for some electron specific stuff like dialgos
* flipper-server: A node process hosting flipper-server-core, that can be connected to over websockets. And probably can serve a browser version of the UI as well.
* flipper-ui-browser: thin wrapper around flipper-ui-core, providing some browser specific behavior / stubs.
* flipper-dump: (might remove later), but want to hack a quick and dirt flipper dump in here, as alternative way to test flipper-server-core.

This diff just creates the packages, but doesn't move any code, so it can be summarized as:

restoftheowl

Reviewed By: nikoant

Differential Revision: D30218646

fbshipit-source-id: 735598a1261a98e584f52504b5eba01ec0afa162
2021-10-08 01:33:03 -07:00
Michel Weststrate
a78b6124d7 Add option to jest to run tests only locally, or on linux (#2609)
Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/2609

Make it possible to mark some tests to run on non-CI, or unix only

Reviewed By: nikoant

Differential Revision: D29813506

fbshipit-source-id: 140f8a4eaed5af3282ab9d139b46a52818be0934
2021-07-21 05:43:11 -07:00
Anton Nikolaev
32f276b499 Configure jest to automatically pick changes in typescript modules without need to compile them using tsc
Summary: Right now, if you are changing something in one of the modules, e.g. in "flipper-plugin", you'll need to compile the changed module using `tsc` before running tests, otherwise `jest` won't pick up the changes. `yarn test` has a step to run `tsc` before tests, however when tests are started simply by `jest` command, e.g. by VSCode plugin, then `tsc` is not automatically called before tests. This diff makes things easier by configuring `jest` to automatically transpile imported modules. This means simply running `jest` command will automatically pick up and automatically transpile all the changes.

Reviewed By: passy

Differential Revision: D28310318

fbshipit-source-id: 77e9b91daa59a46ce64b1b70eb9a998d7b72de00
2021-05-12 07:49:13 -07:00
Anton Nikolaev
f468f0e07d Produce tsc typings for "flipper" package
Summary: This diffs refactors tsc projects structure and structure of our custom typings to allow producing typescript typings for "flipper" package. In next diffs I'm going to use the produced typings to check compatibility of plugins with certain versions of Flipper, e.g. to check whether plugin is compatible with current "stable" and "insiders" version.

Reviewed By: passy

Differential Revision: D26997158

fbshipit-source-id: a0416c7139bf08ec9d175730da4c4c2a8768eeb7
2021-03-17 14:03:38 -07:00
Michel Weststrate
744fe01922 Some renames
Summary:
Some non-semantic changes. Mostly an earlier rename that was accidentally done only locally rather than across the codebase

Also support `.spec` test extension, which is more idiomatic Jest, since we don't use the `.node` and `.electron` distinction anymore anyway.

Reviewed By: jknoxville

Differential Revision: D22976438

fbshipit-source-id: f3abedb36cbac1e835295177117ccbca492a67a1
2020-08-20 13:32:47 -07:00
Michel Weststrate
2383dc85f8 Initialized flipper-plugin library
Summary: Set up an initial library which can (should) be used by plugins in the future.

Reviewed By: jknoxville

Differential Revision: D22019554

fbshipit-source-id: 502b14b34b2c9c117cea377ab6ebbf150e6faee9
2020-07-01 09:12:35 -07:00
Anton Nikolaev
018c1f828c Fix jest auto-mocks hoisting on Windows
Summary: ts-jest transformation was not applied on Windows because of wrong pattern in jest.config. Because of this jest.mock calls was not hoisted to the top and were applied after imports.

Reviewed By: mweststrate

Differential Revision: D21379004

fbshipit-source-id: ec52f98228c5d9e58c0832f2ad201a36d6c8534e
2020-05-04 04:49:21 -07:00
Michel Weststrate
5db7820820 Add support for Jest runner
Summary:
This diff adds compatibility with https://marketplace.visualstudio.com/items?itemName=Orta.vscode-jest and makes sure the `yarn jest` command works without further arguments by defaulting to the unit test setup.

This makes tests runnable from VSCode, highlights which tests passed, and show errors inline (and coverage as well if desired), and will report failing tests in the problems panel.

{F235815220}

The debugger can be started right from the code pane as well by clicking the tiny 'debug'

{F235815208}

Currently set up the defaults to not start tests after startup, as it can be CPU hogging, so simply run the command CMD+SHIFT+P 'start jest runner' instead.

Reviewed By: passy

Differential Revision: D21325241

fbshipit-source-id: 7b87297a710a18bbac394110dc2006218ccc7d86
2020-04-30 06:32:34 -07:00