jest-typeorm:以及如何使用Jest和TypeORM测试您的代码

时间:2021-05-02 09:33:34
【文件属性】:
文件名称:jest-typeorm:以及如何使用Jest和TypeORM测试您的代码
文件大小:146KB
文件格式:ZIP
更新时间:2021-05-02 09:33:34
TypeScript 大家好! 因此,今天,我将向您展示如何配置代码以使用TypeORM和Jest进行测试。 模组 首先,让我们在节点环境中安装一些模块。 我正在使用毛线: yarn add jest ts-jest @types/jest -D yarn add typeorm typescript pg 然后,让我们创建tsconfig文件: yarn tsc --init 开玩笑的配置 好的,现在我们需要配置jest.config.js,并且有我的conigs: module . exports = { clearMocks : true , maxWorkers : 1 , preset : 'ts-jest' , testEnvironment : 'node' , testMatch : [ '**/__tests__/**/*.[jt]s?(x)' ,
【文件预览】:
jest-typeorm-master
----yarn.lock(179KB)
----src()
--------app.ts(0B)
--------connection.ts(509B)
----tsconfig.json(6KB)
----jest.config.js(326B)
----__tests__()
--------user.test.ts(319B)
----README.md(3KB)
----yarn-error.log(183KB)
----ormconfig.js(441B)
----.gitignore(12B)
----package.json(363B)

网友评论