unit-testing 相关问题

单元测试是一种方法,通过该方法测试各个源代码单元以确定它们是否适合使用。

如何配置任何logic代理代码的单元测试?

您如何配置单元测试框架来帮助开发任何列表代理的一部分? 要具有适当的测试驱动的发展节奏,我需要能够在几个seco中进行所有测试...

回答 2 投票 0





Rtestthat:如何忽略预期结果中的类(错误“类别不同”)

如何忽略测试单元测试中的类属性? 目前,由于不同的类别,测试失败了: 图书馆(testthat) testthat(“饮料味道很好”,{ 值<- c("COFFEE", ...

回答 1 投票 0


ASTRO 5.0.2 with vitest:getViteConfig和容器失败的缩影

我刚刚将我的Astro站点升级到5.0.2,但是根据Docs,我使用以下vitest config(项目的根): /// <reference types="vitest/config" /> import { getViteConfig } from 'astro/config'; export default getViteConfig({ test: { <-- Syntax highlighting complains here that this does not exist. include: ['./tests/*.{test,spec}.?(c|m)[jt]s?(x)'], reporters: [ 'default', ['junit', { suiteName: 'UI tests' }] ], } }); ,然后我有一个模拟组件: --- const { title, date } = Astro.props; --- <div> <h1>{title}</h1> <p>{date}</p> </div> 我试图运行以下测试: import { experimental_AstroContainer as AstroContainer } from 'astro/container'; import { expect, test } from 'vitest'; import Card from '../src/components/Card.astro'; test('Card with slots', async () => { const container = await AstroContainer.create(); const result = await container.renderToString(Card, { props: {title: "Title", date: "20 Aug 2024"} }); //expect(result).toContain('This is a card'); //expect(result).toContain('Card content'); }); 现在,如果我使用上述配置运行,我会得到: Vitest caught 2 unhandled errors during the test run. This might cause false positive tests. Resolve unhandled errors to make sure your tests are not affected. 我可以用普通的vitest运行,但是我得到了: defineConfigthoughought我看不到任何错误。我知道,对于Error: Failed to parse source for import analysis because the content contains invalid JS syntax. If you are using JSX, make sure to name the file with the .jsx or .tsx extension. ,有一个问题,但这已经结束了。 versions: Astro:5.0.2 vitest:“^2.1.8” 任何想法? i有相同的语法突出显示问题,并且getViteConfig脚本还报告了此文件中的错误。 测试还将Astro升级到5.2.5.之后,还停止了正确的运行。 我为修复它做了什么是使用命令更新2.1.3到3.0.5的依赖性: astro check

回答 1 投票 0


如何为QueryMultipliplyNc

i我试图为我的dataAccess方法编写测试用例,其中包含QueryMultipleAsync,但显示出错误的错误: 错误 : 信息:  system.notsupportedException:不支持的表达:gr ...

回答 1 投票 0


看,我的一个依赖项之一无法与Jest一起使用,也许会导致使用打字稿。有人知道我该如何解决?我允许有关我项目的所有必要信息,包括上面的终端错误。谢谢 file file im测试:

回答 1 投票 0


角5服务无法通过(nullinjectorerror:没有httpclient的提供商!)

我在运行单元测试时不断遇到以下错误 错误:staticinjectorerror(dynamictestModule)[apiservice-> httpclient]: staticinjectorerror(平台:核心)[apiservice->

回答 3 投票 0





无法用Unitest Patch

我正在尝试断言所有通过

回答 1 投票 0


最新问题
© www.soinside.com 2019 - 2025. All rights reserved.