I have a pretty standard Next.js (12.x) React (18.x) project with Jest (28.x) for testing. My tests e.g. __tests__/Product.test.tsx will run just fine, but now I have some utils I'd like to reuse across tests and tried this:
__tests__/util/my-test-helper.ts
export function setupSomeThing() {
return { foo: jest.fn() };
}
and then import that function in my tests. But the test runner complains with:
FAIL __tests__/util/my-test-helper.ts * Test suite failed to run Your test suite must contain at least one test.
How can I prevent this issue? The Next.js testing documentation seems to have no instruction for this case.
What is the convention or solution (or workaround) for Next.js Jest tests?