我有一个通过Jest进行工作测试的nestjs monorepo应用程序。这与全局单元测试有关,全局单元测试从package.json中的nestjs CLI创建的配置中获取配置。
我的storage.service.ts在其方法之一中使用了jimp来调整图像的大小。
它具有依赖于@jimp/gif的@jimp/types依赖关系,而gifwrap依赖于这个依赖关系。
对于在我的控制台中运行的每个测试,我都会看到这个错误:
ReferenceError: You are trying to `import` a file after the Jest environment has been
我有两个警告,当启动角度12应用程序NX。我确信在NX Monorepo 12.3.4上发射角12应用程序时没有出现这些警告,所以它们出现在NX Monorepo 12.3.5中。
问题是我是犯了什么错误,还是这个NX问题,或者我该如何解决这个问题?
Option "hmrWarning" is deprecated: No longer has an effect.
Option "servePathDefaultWarning" is deprecated: No longer has an effect.
package.json
{
"nam
我尝试为我的简单的e2e后端服务介绍NestJS测试。我正在提供一个自定义userService和一个带有sinon的自定义UserRepository。
这是我的user.e2e-spec.ts文件:
import * as request from 'supertest';
import * as sinon from 'sinon';
import { Test } from '@nestjs/testing';
import { INestApplication } from '@nestjs/common';
impor
我一直在做一个,并且遇到了一个恼人的问题,在这个问题上,jest无法解决相对于根dir的导入问题。
Cannot find module '~lib/dates' from 'utils.ts'
这是导入在组件/ utils中的样子。
import { abc } from '~lib/dates'; // this fails to run
如果我将其更改为相对路径,jest测试运行将按预期运行。
import { abc } from '../../lib/dates'; // this runs as expect
我正在尝试设置一个monorepo,使用管理monorepo,使用作为我的测试框架,使用作为我的测试运行器。当我尝试启动wallaby时,我在wallaby控制台中得到错误[Error] Automatic Jest configuration error: Module jest-cli is not found in '.'.。
我对rush和它的monorepo方法的理解是,根没有package.json -只有实际的库/应用程序有一个package.json文件。如果是这种情况,如何在根级别添加jest-cli?我在全球范围内安装了jest-cli。
我需要做什么才能让
我在nestJs微服务中进行了一些e2E测试(使用Redis作为传输工具)。一切都进行得很顺利,除了这个过程永远不会结束。
这是显示在控制台上的消息。
Ran all test suites.
Jest did not exit one second after the test run has completed.
This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with `--detectOpenH
我有一个码头文件:
FROM node:14.15.0 as build
WORKDIR /node-app
COPY package*.json /node-app/
RUN npm set progress=false && npm config set depth 0 && npm cache clean --force
RUN npm install
COPY . .
RUN npm run build
FROM node:14.15
WORKDIR /node-app
COPY package.json /node-app/
RUN npm
我正在尝试在NestJS项目中设置E2E测试,但是,jest输出如下所示:
Jest did not exit one second after the test run has completed
经过大量阅读,这是因为有一些资源尚未释放,经过一些调试后,发现有一个由ioredis创建的到redis的开放连接,该连接由bull使用,NestJS使用该连接进行任务队列处理。问题是我在测试代码中没有对连接的引用,那么我如何关闭它呢?我在afterAll jest的钩子中拆卸Nest应用程序,如下所示:
afterAll(async () => {
await app.close
我正在迁移一些节点包,这已经成为一个相当令人头疼的问题。
目前,我的package.json就是这样的:
{
//These are the updated dependencies and Jest configurations
"dependencies": {
"@google-cloud/logging-winston": "^4.0.2",
"@google-cloud/secret-manager": "^3.2.3",
"@google-cloud/storag
我正在尝试使用@nest-modules/mailer。我创建了一个模块"example.module.ts“和服务"example.service.ts”。我按照文档中的说明在app.module.ts中加载了邮件模块。当我把它注入到ExampleService中时,nest抛出了这个错误: [ExceptionHandler] Nest can't resolve dependencies of the ExampleService (?). Please make sure that the argument at index [0] is available
我正在将Nestjs中的mssql与Typeorm连接起来,并获得错误Nest can't resolve dependencies of the EmployeeRepository
我的app.module.ts文件:
import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import config from '.
npm run start运行正常,但npm run start: dev抛出此错误: 7:14:22 PM - Found 0 errors. Watching for file changes.
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module 'src/models/note.model'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Modul
创建一个,API服务器,但是当我运行命令npm时,我会出错。我的节点版本是v16.17.1,npm版本是8.19.2。
╰─ npx create-mf-app ─╯
? Pick the name of your app: server
? Project Type: API Server
? Port number: 8080
? Template: nestjs-auth
Your 'server
我在nestjs框架上用jest编写了许多e2e测试,在这个项目中我们使用了和。
在编写了多个测试之后,当我运行npm run test:e2e时,我将面临以下错误。
● Test suite failed to run
MongoPoolClosedError: Attempted to check out a connection from closed connection po
● Test suite failed to run
MongoPoolClosedError: Attempted to check out a connection from clo
我正在尝试设置monorepo来同时运行它的所有Jest测试。在每个包中,我都使用让Babel转换从其他包导入的代码,而不像中描述的那样从create app中弹出代码。
当从每个包文件夹运行时,react-app-rewired test会成功,但是当从monorepo的根文件夹运行时,我会得到以下错误
Directory /Users/Me/go/src/gitlab.com/my-org/front-end/src in the roots[0] option was not found.
在我的src文件夹( monorepo根目录)中没有front-end文件夹,我不知道为什么Jes