Commit Graph

6 Commits

Author SHA1 Message Date
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