Skip to content

Suites not NodeNext ready? #872

@omermorad

Description

@omermorad

Discussed in #811

Originally posted by QozbroQqn August 29, 2025
Hi,

unsure if this is suites related.

We have to migrate from commonjs to nodenext. We use nestjs 11 with Prisma 6.15. Afaik Prisma changed "something" and now the IDE (PhpStorm) isnt able to resolve the right type anymore. For example this test:

    // ...

    it('returns AccountModels as array', async () => {
      expect.assertions(2);

      const { prismaService, repository } = await mockSolitary();
      const { accounts } = prismaAccountMockProxy;
      await prismaService.account.findMany.mockResolvedValue(accounts); // <--- TS2349 here

      const result = await repository.findMany();

      expect(result).toBe(accounts);
      expect(Array.isArray(result)).toBe(true);
    });

    // ...

   const mockSolitary = async () => {
     const { unit, unitRef } = await TestBed.solitary(AccountRepository).compile();
  
     return {
       prismaService: unitRef.get(PrismaService),
       repository: unit,
     };
   };

The exact TS2349 error if I hover mockResolvedValue:

TS2349: This expression is not callable.
Type
  StubbedMember<AccountDelegate<DefaultArgs, {
      omit: GlobalOmitConfig | undefined;
  }>>
has no call signatures.

If we switch back to commonjs and remove verbatimModuleSyntax from tsoncfig, the error is gone. The type is correct (hovering mockResolvedValue:

mockResolvedValue(
    value: Awaited<ReturnType<T>>,
): PrismaService["account"] extends ((...args: any[]) => infer ReturnValue) ? Stub<ReturnValue, ArgsType<PrismaService["account"]>> : StubbedMember<PrismaService["account"]>

The reason is that the type of findMany is not resolved. With commonjs I see (hovering findMany):

Find zero or more Accounts that matches the filter. Note, that providing undefined is treated as the value not being there.

and with nodenext I see just nothing.

Resolved types for prismaService and account are the same for commonjs or nodenext.

  • With commonjs: prismaService is of Type Mocked<PrismaService>.
  • With nodenext: prismaService is of Type StubbedInstance<PrismaService>.

I am working on this the whole day now and I really need some help :)


Edit:
tests are all green btw

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions