Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exit with a special code for tool/browser failure #1976

Open
zzo opened this issue Mar 7, 2016 · 4 comments
Open

Exit with a special code for tool/browser failure #1976

zzo opened this issue Mar 7, 2016 · 4 comments
Labels

Comments

@zzo
Copy link
Contributor

zzo commented Mar 7, 2016

Expected behavior

If karma tests fail due to browser issue karma single run should exit with an exit code to differentiate between a 'tool failure' vs. a 'test failure'.
Would like karma to 'exit(100)' to indicate this type of failure or the error code must be configurable for these situations.

Actual behavior

Karma always exits with a '1' status whenever anythinng goes wrong, test failure or browser failure

Enviroment Details

  • Karma version (output of karma --version):
  • Relevant part of your karma.config.js file
@zzo
Copy link
Contributor Author

zzo commented Mar 7, 2016

Here is a list of potential errors and suggested exit codes to align with protractor for consistent error reporting:

Error code / Error category
1 Actual test failure
100 Installation corruption / Node / node_modules issues (exception when bootstrapping the tool)
105 Fail to parse config file
110 Plugin error (could be almost anything in karma-land if a plugin fails)
120 Failure during startup/teardown
130 Requested a browser that’s not available
135 Unable to start browser
140 Unable to connect to browser
150 Test framework exception (internal test harness error)
160 Fail to parse tested files
170 Disconnect from browser
180 Test timeout
199 Anything not listed above

@Moumi
Copy link
Contributor

Moumi commented Mar 9, 2016

Where would you suggest to change/add these exit codes? I have seen this myself and it is indeed, as you say, not useful to use one exit code for all failures/errors. I would love to work on this, but I would like to know the correct and most useful place to set the exit codes. If it is possible to help me figure this out, I'll start working on it!

@dignifiedquire
Copy link
Member

If we do this I would like to adhere to standard exit codes defined in sysexits.h (at least for those that match)

#define EX_OK       0   /* successful termination */

#define EX__BASE    64  /* base value for error messages */

#define EX_USAGE    64  /* command line usage error */
#define EX_DATAERR  65  /* data format error */
#define EX_NOINPUT  66  /* cannot open input */
#define EX_NOUSER   67  /* addressee unknown */
#define EX_NOHOST   68  /* host name unknown */
#define EX_UNAVAILABLE  69  /* service unavailable */
#define EX_SOFTWARE 70  /* internal software error */
#define EX_OSERR    71  /* system error (e.g., can't fork) */
#define EX_OSFILE   72  /* critical OS file missing */
#define EX_CANTCREAT    73  /* can't create (user) output file */
#define EX_IOERR    74  /* input/output error */
#define EX_TEMPFAIL 75  /* temp failure; user is invited to retry */
#define EX_PROTOCOL 76  /* remote error in protocol */
#define EX_NOPERM   77  /* permission denied */
#define EX_CONFIG   78  /* configuration error */

#define EX__MAX 78  /* maximum listed value */

#endif /* !_SYSEXITS_H_ */
Code Error (Karma) Error (sysexits.h)
1 Actual test failure
64 Invalid cli args EX_USAGE
78 Fail to parse config file EX_CONFIG
100 Installation corruption
101 Plugin error (could be almost anything in karma-land if a plugin fails)
101 Failure during startup/teardown
102 Requested a browser that’s not available
103 Unable to start browser
104 Unable to connect to browser
105 Test framework exception (internal test harness error)
106 Fail to parse tested files
107 Disconnect from browser
108 Test timeout
126 Catch All

We should not be using

@dignifiedquire
Copy link
Member

@Moumi thanks for the offer but this is quite intricate and will involve a good amount of changes inside the code base so I'm not ready to commit to say we are doing this. Please take a look at the help wanted label for tasks that are ready to be worked on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants