pnp/cli-microsoft365

Update the `azuredevops pipeline add` and `github workflow add` with option to scaffold running tests step

Open

#6,497 opened on Nov 18, 2024

View on GitHub
 (5 comments) (0 reactions) (0 assignees)TypeScript (399 forks)auto 404
enhancementhelp wantedkeep-open

Repository metrics

Stars
 (1,390 stars)
PR merge metrics
 (PR metrics pending)

Description

Currently the spfx project azuredevops pipeline add and spfx project github workflow add will scaffold a perfectly good workflow which builds, packages and deploys the SPFx project. One thing which is missing is running tests. This is also a usual thing we do in our deployment pipelines which is a good practice to include as a safety check before something will get deployed. Of course, if we have tests in our SPFx project 😜.

So my idea is to a new option -t, --runTests - flag, when included in the command it will also scaffold a step that will run gulp test

for Azure DevOps it should add a step like

- task: Gulp@0
            displayName: Gulp test
            inputs:
              targets: test

before the bundle task.

and for GitHub workflow it could be something like

- name: Bundle & Package
        run: |
          gulp test

Contributor guide