The error:
[Nest] 163363 - 10/03/2022, 11:59:37 AM LOG [NestFactory] Starting Nest application...
[Nest] 163363 - 10/03/2022, 11:59:37 AM ERROR [ExceptionHandler]
TypeError
at Reflect.getMetadata (/home/mszan/api/node_modules/reflect-metadata/Reflect.js:354:23)
...
The app.e2e-spec.ts:
describe('app - e2e', () => {
let app: INestApplication;
beforeAll(async () => {
const moduleRef: TestingModule = await Test.createTestingModule({
...appModuleMetadata,
imports: appModuleMetadata.imports.map((x) => {
if (x == CommonModule) {
return CommonModuleMock;
}
return x;
}),
}).compile();
app = moduleRef.createNestApplication();
await app.init();
});
});
The CommonModule contains a provider that imports fs and path packages. When I remove these imports, the tests work.
As you can see, I tried replacing CommonModule with CommonModuleMock that does not contain mentioned imports but the tests still fail.
Nest version is 9.0.11. Jest is 29.0.3. Supertest is 6.2.4. Node is 16.17.0.
What are my options?