Commit 10509088 authored by Mathis Goichon's avatar Mathis Goichon
Browse files

fix(jest): revert junit_test_report as file name

parent 584e8801
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -60,12 +60,12 @@ This job is bound to the `build` stage, and uses the following variables:
| `NODE_BUILD_ARGS`             | npm [run script](https://docs.npmjs.com/cli/v8/commands/npm-run-script) arguments <br/> yarn [run script](https://classic.yarnpkg.com/en/docs/cli/run) arguments  | `run build --prod`    |
| `NODE_TEST_ARGS`              | npm [test](https://docs.npmjs.com/cli/v8/commands/npm-test) arguments <br/> yarn [test](https://classic.yarnpkg.com/en/docs/cli/test) arguments                   | `test -- --coverage`  |

The job generates a unit test report that you will find here: `NODE_PROJECT_DIR/reports/junit_test_report.xml`.
The job generates a unit test report that you will find here: `NODE_PROJECT_DIR/reports/unit_test_report.xml`.

#### Unit testing with Jest

If you're using [Jest](https://jestjs.io/) as unit testing framework, you'll have to make the following configuration in
order to [integrate your unit tests results to GitLab](https://docs.gitlab.com/ee/ci/junit_test_reports.html) (and optionally to SonarQube).
order to [integrate your unit tests results to GitLab](https://docs.gitlab.com/ee/ci/unit_test_reports.html) (and optionally to SonarQube).

##### Coverage

@@ -100,7 +100,7 @@ Then update your `jest.config.js` or `package.json` as follows:
            "jest-junit",
            {
                "outputDirectory": "reports",
                "outputName": "junit_test_report.xml"
                "outputName": "unit_test_report.xml"
            }
        ]
    ]
@@ -129,7 +129,7 @@ Then update your `jest.config.js` or `package.json` as follows:
            "jest-junit",
            {
                "outputDirectory": "reports",
                "outputName": "junit_test_report.xml"
                "outputName": "unit_test_report.xml"
            }
        ],
        [
@@ -147,7 +147,7 @@ Then update your `jest.config.js` or `package.json` as follows:
#### Unit testing with Mocha

If you're using [Mocha](https://mochajs.org/) as unit testing framework, you'll have to make the following configuration in
order to [integrate your unit tests results to GitLab](https://docs.gitlab.com/ee/ci/junit_test_reports.html) (and optionally to SonarQube).
order to [integrate your unit tests results to GitLab](https://docs.gitlab.com/ee/ci/unit_test_reports.html) (and optionally to SonarQube).

##### Coverage

@@ -183,7 +183,7 @@ Then update your `package.json` as follows:
```js
"scripts": {
  "test": "npm run mocha",
  "mocha": "nyc mocha app/tests/*.test.js --reporter spec --reporter mocha-junit-reporter --reporter-options mochaFile=./reports/junit_test_report.xml",
  "mocha": "nyc mocha app/tests/*.test.js --reporter spec --reporter mocha-junit-reporter --reporter-options mochaFile=./reports/unit_test_report.xml",
}
```

+1 −1
Original line number Diff line number Diff line
@@ -297,7 +297,7 @@ node-build:
  coverage: '/^All files\s*\|\s*(\d+(?:\.\d+)?)/'
  artifacts:
    reports:
      junit: $NODE_PROJECT_DIR/reports/junit_test_report.xml
      junit: $NODE_PROJECT_DIR/reports/unit_test_report.xml
    when: always
    name: "$CI_JOB_NAME artifacts from $CI_PROJECT_NAME on $CI_COMMIT_REF_SLUG"
    paths: