extend-test-results-json-with-gitlab-ci-vars

1.1.0 • Public • Published

extend-test-results-json-with-gitlab-ci-vars

Extends JSON of the test results with GitLab CI environment variables

NPM

Build status semantic-release js-standard-style

When running GitLab CI with Mocha json reporter you get back just the test results. You can save the test results into a json file, for example

mocha --reporter json > example.json

If you run these tests on GitLab CI, you might want to include the build information, like commit id, branch name, etc. This module adds the GitLab CI variables to the given JSON file and outputs the result to the console.

npm i -D extend-test-results-json-with-gitlab-ci-vars
mocha --reporter json > example.json
add-gitlab-ci-vars example.json > out.json

out.json will have all variables in property ci.

Note: variable CI_BUILD_TOKEN is not included, to avoid leaking it.

Small print

Author: Gleb Bahmutov <gleb.bahmutov@gmail.com> © 2016

License: MIT - do anything with the code, but don't blame me if it does not work.

Support: if you find any problems with this module, email / tweet / open issue on Github

MIT License

Copyright (c) 2016 Gleb Bahmutov <gleb.bahmutov@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Package Sidebar

Install

npm i extend-test-results-json-with-gitlab-ci-vars

Weekly Downloads

1

Version

1.1.0

License

MIT

Last publish

Collaborators

  • bahmutov