While writing some test suites for some ES6 modules, I discovered that Jest v26.6 runs into errors when trying to do some cyclic imports.
The problem can be reduced to the following:
ClassA.mjs
import {B} from './ClassB.mjs';
class A {
constructor()
{
//...
}
}
ClassB.mjs
import {A} from './ClassA.mjs';
class B extends A {
constructor()
{
super();
// ...
}
}
Cyclic.test.js
import {B} from "./ClassB.mjs";
describe('Cyclic', () => {
test('Cyclic', () => {
// ...
});
});
Jest exits with a "Maximum call stack size exceeded" error message, at different places of its source, depending on the imports of the test.
Are there any solutions to this, any known workarounds?
Thanks in advance.