Closed
Description
I'm submitting a...
[ ] Regression
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
When a first sub-application is added to the repository and it's automatically converted to the monorepo mode, a jest-e2e.json
file is moved to the apps/[application]/test
directory. However, a moduleNameMapper
section for existing libraries is not changed, which breaks imports when e2e tests are executed.
Expected behavior
A Nest CLI should update moduleNameMapper
section when it's moving the jest-e2e.json
file, especially when entries that exist there were created by the CLI and were not modified by the user in any way.
Minimal reproduction of the problem with instructions
- Generate a new Nest application
nest generate application app
- Add a new library
cd app
nest generate library lib
- src/app.module.ts
import { LibModule } from '@app/lib';
import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
@Module({
imports: [LibModule],
controllers: [AppController],
providers: [AppService],
})
export class AppModule {}
- Add a first sub-application
nest generate sub-app app2
- Run e2e tests
yarn test:e2e
$ jest --config ./apps/app/test/jest-e2e.json
FAIL apps/app/test/app.e2e-spec.ts
● Test suite failed to run
Configuration error:
Could not locate module @app/lib mapped as:
/tmp/test-repo/app/apps/app/libs/lib/src.
Please check your configuration for these entries:
{
"moduleNameMapper": {
"/@app\/lib/": "/tmp/test-repo/app/apps/app/libs/lib/src"
},
"resolver": undefined
}
> 1 | import { LibModule } from '@app/lib';
What is the motivation / use case for changing the behavior?
Environment
Nest version: 7.5.1
For Tooling issues:
- Node version: v12.16.3
- Platform: Linux
Others:
Metadata
Metadata
Assignees
Labels
No labels