-
Notifications
You must be signed in to change notification settings - Fork 16
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
Tests exit with error code 0 #9
Comments
Thanks — great feedback. The error code is clearly an issue to be fixed. Unsure if the CLI should be part of Baretest. I'm personally organizing the tests as described on the docs and enjoy the flexibility it offers. I can comment/uncomment tests as needed. Or I can put the tests into an array and run the desired slices from it. I can create multiple Baretest instances with a desired name. And seems you can also do a CLI quite easily on top of the core. The code you did makes a good new project. I'm guessing it needs some work though since people have different needs. There needs to be configuration options, dependency to Thanks! |
Hi @piuccio, I love the minimalistic approach of Baretest. It makes it quite easy to build on top of it. Regarding your problem with all tests having the same name: maybe this comment is helpful. |
Setting a non-zero exit code is absolutely necessary for being able to use A workaround for this would be setting the exit code in the test code:
But cluttering all tests by this should prevented by adding this feature to a single place in |
About the test runner - a workaround is to: 1: include a test-executiong statement at the end of each file (test suite): if (module === require.main) test.run()
else module.exports = test 2: include an (async () => {
await require('./test1.test').run()
await require('./test2.test').run()
})() Having the following files:
You can execute all tests by |
I just converted from nodeunit to baretest and here's my feedback:
Failing tests still exit with error code 0
node test
will report that the test fails and highlight it in red, but the exit code is0
, so any CI will mark the build as success and carry on as if nothing happens.Try this
node test && echo "SUCCESS!!!"
.Annoying to split tests in multiple files
The example about organizing multiple tests is a bit too minimal.
First of all, you'll have to remember to add your new test file inside that test index, so you risk forgetting adding one.
Second, all tests are called
My App
which doesn't help that much when you're trying to fix a broken test.I think it should also prevent people from making mistakes. It's a test tool after all.
I think it would be nice to have a
baretest-cli
or something else to better manage tests split in multiple files.Here's what I ended up using:
And inside
test/index.js
So any file that ends with
.test.js
is automatically included and gets a different test name. Also checks the return value oftest.run()
.The text was updated successfully, but these errors were encountered: