Commit d6504834 authored by totara-thib's avatar totara-thib
Browse files

ci(jest): add a boolean to control the pass with no tests option

parent 236cf9cf
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
All notable changes to this job will be documented in this file.

## [1.2.0] - 2022-06-13
* Add --passWithNoTests option
* Add --passWithNoTests option with a variable boolean to active it

## [1.1.1] - 2022-06-13
* Add docker image tag in variable 
+1 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ On top of rolling your tests for you, it will create you a coverage report
| ---- | ----------- | ------- |
| `PROJECT_ROOT` | Path to the directory containing `package.json`  | `.` |
| `JEST_INCREMENTAL` | Run tests that only are relevant based on last commit changes | `false` |
| `PASS_WITH_NO_TESTS` | If set to true, the job will not fail if no tests are present | `true` |
| `ADDITIONAL_OPTIONS` | Additional options for your `jest` | ` ` |
| `IMAGE_TAG` | The default tag for the docker image | `18.1-alpine3.14`  |

+2 −1
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ jest:
    PROJECT_ROOT: "."
    JEST_INCREMENTAL: "false"
    ADDITIONAL_OPTIONS: ""
    PASS_WITH_NO_TESTS: "true"
    IMAGE_TAG: "18.1-alpine3.14"
  script:
    - cd ${CI_PROJECT_DIR}/${PROJECT_ROOT}
@@ -20,7 +21,7 @@ jest:
        npm install --save-dev jest-junit
      fi

    - npm run test -- --coverage --ci --reporters=default --reporters=jest-junit --passWithNoTests --lastCommit=${JEST_INCREMENTAL} ${ADDITIONAL_OPTIONS}
    - npm run test -- --coverage --ci --reporters=default --reporters=jest-junit --passWithNoTests=${PASS_WITH_NO_TESTS} --lastCommit=${JEST_INCREMENTAL} ${ADDITIONAL_OPTIONS}
  coverage: /All files[^|]*\|[^|]*\s+([\d\.]+)/
  artifacts:
    when: always