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

self-executable tests #3

Closed
azu opened this issue Jun 5, 2017 · 3 comments
Closed

self-executable tests #3

azu opened this issue Jun 5, 2017 · 3 comments

Comments

@azu
Copy link

azu commented Jun 5, 2017

Is there any chance I could run the test as node scripts like tape?

Currenly, node examples/simple-fail.js not throw error.

image

For example, It may help to

  • create testing framework for testing framework
  • debug test because it is just a node script
  • improve portability
@kt3k
Copy link
Owner

kt3k commented Jun 5, 2017

@azu
Thanks for the feedback!

You can do execute the kocha test cases by yourself by running the following code after all test suites/cases are registered.

const getRunner = require('kocha').getRunner
let failed = false
const runner = getRunner()
const Reporter = require('kocha/src/reporters/spec')
new Reporter(runner)
runner.on('fail', () => { failed = true })
runner.on('end', () => process.exit(failed))
runner.run()

I added examples for these use cases in examples dir. 96021a3

The run script example:self-exec-fail shows how to use power-assert in that case.

I haven't heard of js-reporters. It seems like a decent approach to separating test runners from the reporters! 👍

@azu
Copy link
Author

azu commented Jun 5, 2017

Thanks!

@kt3k
Copy link
Owner

kt3k commented Jun 9, 2017

For the moment, getRunner is not a part of public api and could be broken at some time. If you build something on top of kocha, please let me know ;) I hope we can collaborate.

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

No branches or pull requests

2 participants