teleport/jest.config.js
Rafał Cieślak 6578af1efd
Connect: Remove resource cache (#21964)
* Connect: Remove resource cache

This commit refactors parts of the Electron app which still depend on
the resource cache, that is cluster sync and `tsh ssh` executed from the
command bar.

A number of adjustments has been made to executing `tsh ssh` from the
command bar, namely the logic of resolving the hostname has been moved
from the command launcher to useDocumentTerminal. The UI was also
adjusted to allow the user to reconnect to an SSH server if resolving
the hostname fails. This has a nice benefit of also allowing them to
retry if the PTY couldn't be created for some reason.

---

Before gravitational/webapps#1307, Connect was pulling all resources
from the cluster on app start and cluster login. Then it'd show them to
you in tables if you opened a new tab with cluster resources. There were
at least two problems with this approach:

1. It was slow for big clusters as pagination, filtering and sorting
   were all done client-side and blocked the main thread.
2. It wasn't possible to implement advanced search unless we copied the
   implementation from the backend to tshd.

gravitational/webapps#1307 made it so that instead of depending on that
resource cache to show resource tables, Connect would pull paginated
resources from the backend.

However, the resource tables were not the only part of the app depending
on that cache. Due to time constraints, we weren't able to refactor all
of them. We managed to refactor autocomplete (gravitational/webapps#1406)
and the remaining places are listed in #21800.

This PR refactors those remaining places to not use the cache by either
not depending on resource details or by making a call to the proxy
instead.

* Add missing license
2023-02-27 15:32:19 +00:00

18 lines
443 B
JavaScript

const config = require('@gravitational/build/jest/config');
process.env.TZ = 'UTC';
/** @type {import('@jest/types').Config.InitialOptions} */
module.exports = {
...config,
globals: {
electron: {},
},
collectCoverageFrom: [
// comment out until shared directory is finished testing
// '**/packages/design/src/**/*.jsx',
'**/packages/shared/components/**/*.jsx',
],
coverageReporters: ['text-summary', 'lcov'],
};