Skip to content

Incorrect exit code when build fails #27

@RodolfoSilva

Description

@RodolfoSilva

@thetutlage

When an error happens during the build execution, the command send the incorrect exit code.

If you ar using a CI to release your app you will get a false positive, and will send a bad release to the server.

Package version

"devDependencies": {
  "@adonisjs/assembler": "^5.0.0",
  "adonis-preset-ts": "^2.1.0",
  "eslint": "^7.29.0",
  "eslint-config-prettier": "^8.3.0",
  "eslint-plugin-adonis": "^1.3.2",
  "eslint-plugin-prettier": "^3.4.0",
  "pino-pretty": "^5.0.2",
  "prettier": "^2.3.1",
  "typescript": "~4.2",
  "youch": "^2.2.2",
  "youch-terminal": "^1.1.1"
},
"dependencies": {
  "@adonisjs/core": "^5.1.0",
  "@adonisjs/repl": "^3.0.0",
  "proxy-addr": "^2.0.7",
  "reflect-metadata": "^0.1.13",
  "source-map-support": "^0.5.19"
}

Node.js and npm version

Node.js: v14.17.1
npm: 6.14.12

Sample Code (to reproduce the issue)

Create a new project

npm init adonis-ts-app blog
// API Server
// blog
// y
// y

Create a new controller with some error:

// import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'

export default class PagesController {
    public index() {
        var value = void 0;

        this.doNothing(value); // Argument of type 'undefined' is not assignable to parameter of type 'string'.

        return "Hello World";
    }

    private doNothing(value: string) {
        console.log(value)
    }
}

Run the command

cd blog
yarn build
echo $? # should be != 0

The result of echo will be 0 for failure.

image

image

BONUS (a sample repo to reproduce the issue)

You can clone my repository with the example of error during yarn build.

https://github.com/RodolfoSilva/demo-adonisjs/tree/bug/build-invalid-exit-code

git clone git@github.com:RodolfoSilva/demo-adonisjs.git
cd demo-adonisjs
git checkout bug/build-invalid-exit-code
yarn install
yarn build
echo $? # should be != 0

Metadata

Metadata

Assignees

Labels

Type: BugThe issue has indentified a bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions