I have my angular project in the ASP.NET Core Angular template of Visual Studio. And I have integrated this project to Azure DevOps. Now, the issue is, at the unit testing step in the Azure pipeline, it runs dotnet test
command to run the unit tests. But I have my unit test in the angular project which is run by Karma. How can I run the angular unit tests with the same setup which I have right now?
You need to use npm task to run angular unit tests. For below example add npm task in your pipeline to run custom command:
- task: Npm@1
displayName: 'Angular Test'
inputs:
command: custom
customCommand: run test -- --watch=false --code-coverage
workingDir: $(system.defaultworkingdirectory)/angularFolder
Or you can run npm run test
command directly in a script task. For below example:
- script: |
cd $(system.defaultworkingdirectory)/angularFolder
npm test
You can check out the examples in below blog.
Build and test projects in Azure DevOps pipelines
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.