Open JanSafronov opened 4 months ago
The error during testing reads:
Test suite failed to run
packages/gallery-ui/src/services/GalleryApi.ts:6:14 - error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is
'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.
6 baseUrl: import.meta.env.VITE_GALLERY_SERVICE_URL,
~~~~~~~~~~~
packages/gallery-ui/src/services/GalleryApi.ts:26:74 - error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.
26 const socket = new HubConnectionBuilder().withUrl(`${import.meta.env.VITE_GALLERY_SERVICE_URL}/hubs/gallery?galleryId=${galleryId}`).build();
I think adding the --experimental-vm-modules
option to Jest testing command has partially resolved the issue but now there is a different error;
TypeError: Cannot read properties of undefined (reading 'VITE_GALLERY_SERVICE_URL')
4 |
5 | const baseQuery = fetchBaseQuery({
> 6 | baseUrl: import.meta.env.VITE_GALLERY_SERVICE_URL,
| ^
7 | });
8 |
9 | export const galleryApi = createApi({
at packages/gallery-ui/src/services/GalleryApi.tsx:6:30
I will just use Vitest, it seems like Jest isn't worth the setup since there are hurdles with Vite, ts and Jest..
I also want to mock getGalleryPhotos
in the galleryApi together with "Cypress" SignalR JS testing library if this is fine @Olszewskidev
I am thinking about setting up testing for ui packages, will Jest framework be good enough for lens-up @Olszewskidev? It has a few limitations with Vite so if it's ok I will configure babel for the ui packages?