Complete the code to define a basic CI pipeline step that runs tests.
pipeline {
stages {
stage('Test') {
steps {
sh '[1]'
}
}
}
}The pytest command runs tests in the CI pipeline. Other options do not run tests.
Complete the code to trigger the CI pipeline on every push to the main branch.
on:
push:
branches:
- '[1]'The CI pipeline triggers on pushes to the main branch, which is the primary branch.
Fix the error in the test script command to correctly run tests in CI.
steps:
- name: Run tests
run: [1]npm run test is the correct command to run tests. npm testt is a typo.
Fill both blanks to define a test stage that runs tests only if the code is pushed to the main branch.
stages:
- name: Test
if: contains([1], '[2]')
steps:
- run: pytestThe condition checks if the branch reference github.ref contains main to run tests only on main branch pushes.
Fill all three blanks to create a dictionary comprehension that maps test names to their pass status if the test duration is less than 5 seconds.
test_results = { [1]: results[[2]]['passed'] for [1] in results if results[[2]]['duration'] [3] 5 }The comprehension uses test_name as the key and index, and filters tests with duration less than 5 seconds using <.