(frontend) mock saxen in jest config

ui-kit 0.28.0 pulls in read-excel-file, whose CommonJS build requires
saxen, an ESM-only package that jest cannot parse. No unit test parses
spreadsheets, so a stub parser is enough, following the pretty-bytes
precedent.
This commit is contained in:
Nathan Vasse
2026-07-28 11:43:12 +02:00
parent ab8e0ebc39
commit c45b0943c5
2 changed files with 11 additions and 0 deletions
@@ -0,0 +1,10 @@
// saxen is ESM-only, which Jest cannot parse from read-excel-file's CJS
// build (pulled in by ui-kit). No unit test parses spreadsheets, so a
// stub Parser is enough.
module.exports = {
Parser: class Parser {
on() {}
parse() {}
stop() {}
},
};
+1
View File
@@ -12,6 +12,7 @@ const config: Config = {
"\\.(css|less|scss|sass|svg|png|jpg|jpeg|gif)$":
"<rootDir>/__mocks__/fileMock.js",
"^pretty-bytes$": "<rootDir>/__mocks__/pretty-bytes.js",
"^saxen$": "<rootDir>/__mocks__/saxen.js",
// Then handle path aliases
...pathsToModuleNameMapper(tsconfig.compilerOptions.paths || {}, {
prefix: "<rootDir>/",