Closed khoipro closed 5 years ago
I wish to integrate this package into my GitLab CI/CD. However, when displaying with GitLab CI/CD, it has a result of success.
Do you know the best way to output error to command and stop pipeline display as success?
Thanks.
Here is my sources:
Test HTML5 Validation: stage: test script: - npm run test:html5
In package.json
package.json
"scripts": { "test:html5": "node html5-lint.js" }
In html5-lint.js
html5-lint.js
const fs = require('fs') const html5Lint = require('html5-lint') console.log('Start HTML5 lint checking') fs.readFile('index.html', 'utf8', function (err, html) { if (err) { throw err } console.log('Running...') html5Lint(html, (err, results) => { results.messages.forEach(function (msg) { var type = msg.type var message = msg.message console.log('HTML5 Lint [%s]: %s', type, message) }) }) })
I resolved it by adding process.exit(0) or process.exit(1).
process.exit(0)
process.exit(1)
I wish to integrate this package into my GitLab CI/CD. However, when displaying with GitLab CI/CD, it has a result of success.
Do you know the best way to output error to command and stop pipeline display as success?
Thanks.
Here is my sources:
In
package.json
In
html5-lint.js