我正在使用 xUnit 和 Moq 编写测试用例。
我正在尝试模拟 HttpClient 的 PostAsync(),但出现错误。
下面是用于模拟的代码:
public TestADLS_Operations()
{
var mockClient = new Mock<HttpClient>();
mockClient.Setup(repo => repo.PostAsync(It.IsAny<string>(), It.IsAny<HttpContent>())).Returns(() => Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK)));
this._iADLS_Operations = new ADLS_Operations(mockClient.Object);
}
Run Code Online (Sandbox Code Playgroud)
错误:
不支持的表达式:repo => repo.PostAsync(It.IsAny(), It.IsAny()) 不可覆盖的成员(此处:HttpClient.PostAsync)不能在设置/验证表达式中使用。
截屏:
在 Azure DevOps 中,管道在 npm run 构建步骤失败,间接依赖项之一出现错误(请检查下面的第 18 行)。错误是jest-worker/build/index.js:110 _ending; SyntaxError: Unexpected token ";"
是pipeline.yaml这样的:
trigger:
- master
pool:
vmImage: ubuntu-latest
steps:
- task: NodeTool@0
inputs:
versionSpec: '10.x'
displayName: 'Install Node.js'
- script: |
npm install
displayName: 'npm install '
- script: |
npm run build
displayName: 'npm run build'
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: 'build'
includeRootFolder: true
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
replaceExistingArchive: true
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
Run Code Online (Sandbox Code Playgroud) TLDR:如何以编程方式访问给定网页的可访问性树?是否有任何内部 API 可以通过 JavaScript 调用来查看辅助功能树?
我正在构建一个测试套件来检查网页内可访问性的正确性。目前,我们通过比较 DOM 并检查某些属性是否存在且正确来做到这一点。我想不再使用 DOM,因为它会带来大量需要遍历的额外数据,而只检查 a11y 树的正确性。这棵树可以在大多数现代网络浏览器的开发工具/检查器中找到,但我不知道如何用代码检查它。通过我的研究,我发现有一个新的 AOM(可访问性对象模型)正在被建议,但尚未实现。我还发现“puppeteer”包能够访问它。有什么办法可以直接访问吗?
我已安装Service Fabric,虽然安装了集群资源管理器,但我注意到尚未创建标准的SFDevCluster文件夹
本地集群管理器中的错误消息无用 - 重置集群时出错.
然后,我深入研究了PowerShell方面并得到了以下消息.
我没有想法而且非常沮丧!这已经在其他机器上安装了其他时间的负载而没有任何问题.
我已经多次卸载并重新安装.
我已将Service Fabric添加到Visual Studio中.
PS C:\program files\microsoft sdks\service fabric\clustersetup> .\DevClusterSetup.ps1
A parameter cannot be found that matches parameter name 'Refresh'.
Get-Module : A parameter cannot be found that matches parameter name 'Refresh'.
At C:\program files\microsoft sdks\service fabric\clustersetup\DevClusterSetup.ps1:54 char:35
+ Get-Module -ListAvailable -Refresh <<<< --quiet *>$null
+ CategoryInfo : InvalidArgument: (:) [Get-Module], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.GetModuleCommand
PS C:\program files\microsoft sdks\service fabric\clustersetup>
Run Code Online (Sandbox Code Playgroud)
我甚至试图将我的Service Fabric文件复制到机器上,但这也无效.
有没有人有这样的事情?请注意,这些问题发生在Visual Studio(2017)之外.
保罗
每次打开 Visual Studio Code 时,都会收到一条通知:
This workspace has extension recommendations.
Run Code Online (Sandbox Code Playgroud)
如何关闭扩展推荐?
我想使用酶在我的 React 项目中使用 TypeScript 执行单元测试。
我使用了有关将测试添加到 create-react-app 的文档 - 运行测试
我在 /src 中创建了一个 setupTests.ts 文件
setupTests.ts
import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
configure({ adapter: new Adapter() });
Run Code Online (Sandbox Code Playgroud)
我写了一个测试
App.test.ts
import React from 'react';
import { shallow } from 'enzyme';
import App from './App';
it('renders without crashing', () => {
shallow(<App />);
});
Run Code Online (Sandbox Code Playgroud)
如果我在 setupTests.ts 中注释配置适配器的行,则使用 react-dom 的测试工作正常
setupTests.ts
import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
// configure({ adapter: new Adapter() });
Run Code Online (Sandbox Code Playgroud)
App.test.ts …
我有一个 React/TypeScript 项目,我试图检测用户是否启用了 Mac OS 的任何高对比度辅助功能设置:反转颜色、使用灰度、区分无颜色、增加对比度或增加显示对比度设置。
我想使用 JavaScript/TypeScript 检测这些。
到目前为止,我只能检测到Invert colors。
如何检测用户是否启用了任何其他 Mac OS 辅助功能设置?
更多信息:
使Jest通过以下测试的最佳方法是什么:
test('example', () => {
expect(0).toEqual(-0);
});
Run Code Online (Sandbox Code Playgroud)
我不想区分负零和正零。
也许我应该使用其他功能代替.toEqual?或者我应该像这样替换所有块:
expect(a).toEqual(b);
Run Code Online (Sandbox Code Playgroud)
至
expect(a === 0 ? +0 : a).toEqual(b === 0 ? +0 : b);
Run Code Online (Sandbox Code Playgroud)
?
将群集部署到Azure时遇到问题.一切都在本地工作,但在部署到Azure时,我尝试调用其中一个服务时出错.
在Azure中,服务结构是6.1.480.9494,并且无法升级.但我的本地版本是6.2.262.94946天前发布的.
我是否因为版本不同而收到此错误?
无法将"System .__ ComObject"类型的COM对象强制转换为接口类型"IFabricTestManagementClient4".此操作失败,因为对于具有IID"{B96AA7D4-ACC0-4814-89DC-561B0CBB6028}"的接口的COM组件的QueryInterface调用由于以下错误而失败:不支持此类接口(HRESULT异常:0x80004002(E_NOINTERFACE)) .
有人知道为什么我的反应组件开发工具看起来像这样吗?在最近的 React 开发工具主要更新之前,我可以看到所有组件的名称,但现在它看起来像这样。 开发工具视图组件名称都被缩小了!
javascript ×3
reactjs ×3
unit-testing ×2
.net ×1
api ×1
azure ×1
azure-devops ×1
c# ×1
enzyme ×1
jestjs ×1
macos ×1
minify ×1
moq ×1
node.js ×1
npm-build ×1
safari ×1
typescript ×1
xunit ×1