getappmap / appmap-agent-js

This project is deprecated. Please use https://github.com/getappmap/appmap-node/ to record Node.js applications.
Other
28 stars 8 forks source link

Record functions in react apps #172

Closed lachrist closed 1 year ago

lachrist commented 1 year ago

Currently, I'm not able to record functions in react apps.

https://github.com/land-of-apps/appmap-agent-js-react

It looks like we are no longer able to intercept commonjs and native modules.

Maybe it has to do on how jest spawn test files when using jsdom:

https://github.com/facebook/jest/blob/aef5497c6685e8dd514e3f9ce9c601d03ca3cae2/packages/jest-environment-jsdom/src/index.ts#L63

Maybe the transformer overwrite Module.prototype._compile.

lachrist commented 1 year ago

The issue is that Jest does not stack transformers. Adding --transform '{}' overwrite the previous transform config field. We need to do some deeper configuration resolution to stack transformers ourselves.

lachrist commented 1 year ago

To support stacking of esm transformers we need this: https://github.com/facebook/jest/issues/13759