腾讯云
开发者社区
文档
建议反馈
控制台
登录/注册
首页
学习
活动
专区
圈层
工具
MCP广场
文章/答案/技术大牛
搜索
搜索
关闭
发布
文章
问答
(9999+)
视频
沙龙
1
回答
使用
jest
/sinon模拟require()d导入对象
、
、
这是我的密码: throw new Error('username is undefined'); const endpoint: string
浏览 2
提问于2017-10-06
得票数 0
1
回答
Jest
-
mock
`
config
`
模块
、
我正在编写一个单元测试,我想在其中模拟调用
config
时返回的值。在
模块
中,我多次调用
config
,并希望模拟其中一次调用的返回值: import
config
from '
config
'; const ENDPOINTS: (string | undefined)[] =
config
.get('AWS
浏览 11
提问于2021-07-29
得票数 0
回答已采纳
2
回答
有条件地运行带有或不带嘲笑的模拟测试
、
、
、
import
config
from '
config
';
jest
.
mock
('api/companies');} 在网络上测试的惯例
浏览 0
提问于2017-10-04
得票数 3
1
回答
嘲弄一个物体
、
、
我需要模拟一个对象,
config
.js,而不是正常地模拟一个函数。我有- foo: 'bar'我试过-
jest
.
mock
('./
config
'); foo:
浏览 0
提问于2018-05-14
得票数 12
1
回答
我怎样才能让webpack的外部性成为笑柄呢?
、
我的
jest
测试在import
config
from "
config
"上失败了,错误找不到
模块
,配置是webpack的外部设置,如下所示:customConfig = { externals: {
config
: { name: "Something",apiURL: "loc
浏览 4
提问于2021-02-11
得票数 1
回答已采纳
1
回答
JEST
找不到
模块
“类型记录-cookie”
、
、
、
我试图在使用VITE + TS创建的项目中运行一些测试,并得到以下错误:
模块
typescript-cookie是唯一一个没有找到的
模块
。如果删除这个
模块
,所有测试都能正常工作!我的
jest
.
config
.ts testEnvironment: '
jest
-environment-jsdom', coverageDirectory:
浏览 10
提问于2022-06-21
得票数 1
2
回答
从默认导入中
Jest
模拟异步函数
、
、
、
、
}let getScene = null;
jest
.
mock
('./
config
', () => configureEnvironmentMock);
jest</
浏览 0
提问于2018-09-21
得票数 5
回答已采纳
3
回答
如何手动初始化next.js应用程序(用于测试目的)?
、
/
config
" const response = await fetch(API_URL + ATTACKS_ENDPOINT, headers) export const API_URL= publicRun
浏览 22
提问于2020-02-27
得票数 2
3
回答
尝试在
Jest
测试中呈现react-native-reanimated节点时出现"TypeError“
、
、
当尝试用
Jest
呈现我的应用程序以进行一些集成测试时,我得到了以下错误: TypeError: Cannot read property 'createNode' of undefined
浏览 1
提问于2020-02-14
得票数 2
1
回答
每个测试的
Jest
mock
值
、
、
、
、
它存储在'
config
.js‘中,如下所示: GOOGLE_ANALYTICS_TRACKING_ID: process.env.GOOGLE_ANALYTICS_TRACKING_ID在它里面,我这样导入
config
:我的测试是这样的:
jest</
浏览 1
提问于2018-10-22
得票数 3
6
回答
如何在单个测试的基础上更改模拟实现?
、
/myModule'); myMockedModule.b =
jest
.fn(() => true);
jest
.
mock
('../myModule’),() => {返回{ a:
jest
.fn(() => true,b: <e
浏览 8
提问于2018-02-14
得票数 210
回答已采纳
0
回答
使用fetch-
mock
设置
jest
模拟
、
、
、
、
我不能像其他函数(例如
jest
.
mock
('../../../../_helpers/alerts');)那样
jest
.
mock
整个
模块
,因为其余的函数也是从该
模块
中使用的。addFundingSource = () => {} let
conf
浏览 9
提问于2017-11-27
得票数 0
1
回答
如何在
Jest
中正确地模拟fs.readFileSync()?
、
、
、
、
我使用fs
模块
将html字符串导入到我的
模块
中,如下所示:const htmlString = fs.readFileSync("../utils/htmlString.html").toString();const fs = require('fs');
jest
.
mock
("fs", ()
浏览 29
提问于2022-01-18
得票数 0
回答已采纳
1
回答
在
Jest
中,如何在每个describe块之前运行一段代码来进行模拟?
、
有成百上千的
jest
测试文件,在每个单元测试文件中可能有多个describe块。 是否有配置或方法可以在每个describe块之前自动运行代码块来执行模拟和设置?
浏览 10
提问于2021-02-24
得票数 0
1
回答
在逐个测试的基础上开玩笑模拟类方法
、
、
、
/common');const
config
= common.getConfig(); //
config
.real is used inside this function我试图模拟Common,并为每个
Jest
/common.js');
jest
.
mock
('./../
浏览 2
提问于2019-03-15
得票数 4
回答已采纳
2
回答
在
Jest
中,如何仅在特定的测试中模拟外部
模块
?
、
、
、
我在TypeScript中使用
Jest
(使用ts-
jest
)。/test-subject'; // I don't want the
mock</
浏览 0
提问于2019-06-04
得票数 6
4
回答
使用
Jest
模拟导入到vue组件中的
模块
、
、
、
'vue';import OrdersService from '@/services/orders.service';
jest
.
mock
('@/services/orders.service', () =>
jest
.fn());
浏览 2
提问于2018-10-01
得票数 7
1
回答
Jest
中的模拟导入函数
、
、
、
from "utils/date";
jest
.
mock
(
jest
.requireActual('utils/date')),
浏览 0
提问于2021-10-14
得票数 2
回答已采纳
1
回答
模拟电子/远程
模块
、
、
、
、
通过这一更新,remote从电子转移到了新的
模块
@electron/remote。在
jest
.
config
.js中,我有电子
模块
模拟映射:electron: '<rootDir>/tests/
mock
/electron.
mock
.ts'const mockIpcRenderer= { send:
jest
.fn()const
浏览 4
提问于2022-08-12
得票数 2
1
回答
如何模拟axios配置
模块
?
、
、
、
我有一个配置axios的
模块
:import axios from 'axios'; }); 以及一个
模块
,该
模块
使用它进行api调用: // stor
浏览 3
提问于2020-12-18
得票数 2
回答已采纳
点击加载更多
相关
资讯
基于Jest Mock API对业务逻辑集成测试附源码
Python3的单元测试模块mock与性能测试模块cProfile
携程租车React Native单元测试实践
前端单元测试入门
流利说前端单元测试实践
热门
标签
更多标签
云服务器
ICP备案
对象存储
云点播
实时音视频
活动推荐
运营活动
广告
关闭
领券