Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(test): Add @mathjax/src to esmModules (#57795)

mendral-app[bot]c44715b59a7c
diff --git a/frontend/jest.config.ts b/frontend/jest.config.ts
index 5b65cf606a50..a90860b731b4 100644
--- a/frontend/jest.config.ts
+++ b/frontend/jest.config.ts
@@ -54,6 +54,7 @@ const esmModules = [
'ccount',
'longest-streak',
'markdown-table',
+ '@mathjax/src',
]
function rootDirectories(): string[] {
return ['<rootDir>/src', '<rootDir>/../products']
@@ -164,6 +165,7 @@ const config: Config = {
'^@posthog/rrweb/es/rrweb': '@posthog/rrweb/dist/rrweb.min.js',
d3: '<rootDir>/node_modules/d3/dist/d3.min.js',
'^d3-(.*)$': `d3-$1/dist/d3-$1`,
+ '^@mathjax/src/(.*)$': '<rootDir>/src/test/mocks/mathjaxMock.js',
},
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
diff --git a/frontend/src/test/mocks/mathjaxMock.js b/frontend/src/test/mocks/mathjaxMock.js
new file mode 100644
index 000000000000..ad1ea32868cd
--- /dev/null
+++ b/frontend/src/test/mocks/mathjaxMock.js
@@ -0,0 +1,7 @@
+module.exports = {
+ browserAdaptor: () => ({}),
+ RegisterHTMLHandler: () => {},
+ TeX: class {},
+ SVG: class {},
+ mathjax: { document: () => ({ convert: () => document.createElement('span') }) },
+}