This repository was archived by the owner on Jan 15, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 86
chore: Wire up yeoman unit tests in CI/CD pipelines #1152
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
53c3f69
Adding npm test step to CI/CD pipeline templates.
peterinnesmsft 4340c69
Add comment to generator-bot-adaptive to trigger pipeline.
peterinnesmsft 6aaf8a0
Restoring dependencies in npm-test-steps.yml.
peterinnesmsft b1a2d2d
Updating npm-test-steps.yml to simply run 'yarn run test' due to diff…
peterinnesmsft 8649074
Updating npm-test-steps.yml to manually check for presence of test sc…
peterinnesmsft b7ceeb6
Removing comment from generator-bot-adaptive; update step name for de…
peterinnesmsft File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| steps: | ||
| # You are probably wondering "Why not just run 'yarn exec npm run --if-present test'?". | ||
| # On Azure Pipelines, yarn install by default restores modules to a global node_modules cache | ||
| # instead of a local package cache. When running the npm CLI, it is unable to resolve required | ||
| # dependencies as a result, whereas yarn run <script> can do so successfully. However, | ||
| # yarn does not yet have an --if-present condition - the immediate step below simulates this | ||
| # by manually reading the package.json and checking for the presence of $.scripts.test in the JSON. | ||
| - powershell: | | ||
| if (Test-Path -Path package.json) { | ||
| $package = Get-Content package.json | ConvertFrom-Json | ||
| $result = $package.scripts -and $package.scripts.test | ||
| Write-Host "##vso[task.setvariable variable=NpmRunTest;]$result" | ||
| } else { | ||
| Write-Host "Missing package.json" | ||
| exit 1 | ||
| } | ||
| displayName: 'Determine if test script is present' | ||
| name: SetNpmRunTest | ||
| workingDirectory: '$(WorkingDirectory)' | ||
|
|
||
| - script: | | ||
| yarn run test | ||
| condition: eq(variables.NpmRunTest, true) | ||
| continueOnError: true | ||
| displayName: 'Run test if it exists' | ||
| workingDirectory: '$(WorkingDirectory)' | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.