What problem does this feature solve?
Allow auto-mocking modules that cannot be safely evaluated, e.g access browsers globals in module root.
Although, it can be fixed with proper testEnvironment, it is a compromise and also Vitest seems to solve it properly.
What does the proposed API look like?
No API change, just allow to rs.mock('I-will-call-DOM-immediately', {mock: true}) without evaluating it.
What problem does this feature solve?
Allow auto-mocking modules that cannot be safely evaluated, e.g access browsers globals in module root.
Although, it can be fixed with proper testEnvironment, it is a compromise and also Vitest seems to solve it properly.
What does the proposed API look like?
No API change, just allow to
rs.mock('I-will-call-DOM-immediately', {mock: true})without evaluating it.