Skip to content

Supertest import fix not released - e2e tests fail in new projects #2202

@dioKR

Description

@dioKR

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

When creating a new NestJS project using nest new [project-name], the generated e2e test file contains an incorrect import statement that causes test failures.


Image

This appears to be the same issue reported in nestjs/nest#15657

The bug was already fixed in commit fb8c6d9
which was merged on August 19, 2025. However, the fix is not yet available in the published npm package (@nestjs/schematics@11.0.7), so newly created projects still are still affected.

In that commit, only the "src/lib/application/files/ts/test/app.e2e-specFileSuffix.ts" file was updated.
However, the same fix likely needs to be applied to the following files as well:

src/lib/application/files/js/test/app.e2e-specFileSuffix.js
src/lib/sub-app/files/ts/test/app.e2e-specFileSuffix.ts
src/lib/sub-app/files/js/test/app.e2e-specFileSuffix.js

I'd be happy to open a PR to apply the fix to these files as well, if that's helpful. Please let me know!

Minimum reproduction code

https://github.com/dioKR/nest-tmp/blob/main/test/app.e2e-spec.ts

Steps to reproduce

No response

Expected behavior

The generated e2e test files should contain correct import statements so that tests pass without modification in a newly created project.

import reqeust from 'supertest';

Package version

11.0.7

NestJS version

11.0.10

Node.js version

22.20.0

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions