You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using the fhirClient package to pull R4 resources from our internal FHIR server. The initalization of the package is done in the main.tsx (top level file) and then the client that is generated is passed down in the app.tsx.
Given that the app.tsx has the client as a prop for the fhirClient that was generated, I need to be able to fake/mock the fhirClient and then pass it in.
Details:
/Users/shanejeffery/Desktop/mckesson/cds-txp/app/node_modules/jose/dist/browser/index.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){export { compactDecrypt } from './jwe/compact/decrypt.js';
^^^^^^
SyntaxError: Unexpected token 'export'
1 | /* eslint-disable @typescript-eslint/no-var-requires */
2 | import { uiProviderWrapper } from '@app/utils/jest-wrappers';
> 3 | import { oauth2 as SMART } from 'fhirclient';
| ^
4 |
5 | import { App } from '../app';
6 |
at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1495:14)
at Object.<anonymous> (node_modules/fhirclient/lib/security/server.js:8:16)
at Object.<anonymous> (node_modules/fhirclient/lib/adapters/NodeAdapter.js:15:18)
at Object.<anonymous> (node_modules/fhirclient/lib/entry/node.js:3:23)
at Object.require (src/__tests__/app.test.tsx:3:1)
If I add that package (jose) to the transformIgnorePatterns in Jest, then it just opens up a bunch of other issues. It looks like Jest is trying to use the fhirclient package within a node environment instead of the jsdom that has been set in Jest.
Anyone been able to successfully get a test implemented with Jest with fhirclient?
Thanks!
The text was updated successfully, but these errors were encountered:
Hello.
I am using the
fhirClient
package to pull R4 resources from our internal FHIR server. The initalization of the package is done in themain.tsx
(top level file) and then the client that is generated is passed down in theapp.tsx
.Given that the
app.tsx
has theclient
as a prop for the fhirClient that was generated, I need to be able to fake/mock the fhirClient and then pass it in.Here is what I have thus far:
When running this test, I get:
If I add that package (
jose
) to thetransformIgnorePatterns
in Jest, then it just opens up a bunch of other issues. It looks like Jest is trying to use thefhirclient
package within anode
environment instead of thejsdom
that has been set in Jest.Anyone been able to successfully get a test implemented with Jest with
fhirclient
?Thanks!
The text was updated successfully, but these errors were encountered: