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
{{ message }}
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.
@jdalton I wrote this tiny wrapper around the main grpc library. I get the following with ts-jest. If I skip the entrypoint lib/index.jshere and instead import from lib/main.js, I can get tests to work provided I enable babel in the flow.
Do you know what might be happening? I am going to be using this wrapper in other projects, which use jest for their test setup, and I won't have the privilege of using main.js there, as the whole point of esm is to be able to use it from the entrypoint index.js.
❯ npm test
> [email protected] test /Users/charandas/serve/opensource/grpc-esm-repro
> npm run jest
> [email protected] jest /Users/charandas/serve/opensource/grpc-esm-repro
> jest
FAIL test/e2e.spec.ts
● Test suite failed to run
Module did not self-register.
at Runtime.requireModule (node_modules/jest-runtime/build/index.js:356:31)
at Object.<anonymous> (node_modules/grpc/src/grpc_extension.js:32:13)
Test Suites: 1 failed, 1 total
The text was updated successfully, but these errors were encountered:
charandas
changed the title
Possible regression with native modules in ts-jest, but not in pure jest environment
Possible regression with native modules in ts-jest
Mar 26, 2019
I found the issue. This is related to the fact that Jest stores native modules on the primary module cache (not its own internal cache). We were deferring to Jest's cache within esm so missed the cache of the native module. I'll tweak things a bit to fix it.
@jdalton I wrote this tiny wrapper around the main grpc library. I get the following with
ts-jest
. If I skip the entrypointlib/index.js
here and instead import fromlib/main.js
, I can get tests to work provided I enable babel in the flow.Do you know what might be happening? I am going to be using this wrapper in other projects, which use
jest
for their test setup, and I won't have the privilege of usingmain.js
there, as the whole point of esm is to be able to use it from the entrypointindex.js
.The text was updated successfully, but these errors were encountered: