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

CLI --debug flag #31

Closed
sindresorhus opened this issue Sep 1, 2015 · 10 comments · Fixed by #101
Closed

CLI --debug flag #31

sindresorhus opened this issue Sep 1, 2015 · 10 comments · Fixed by #101
Labels

Comments

@sindresorhus
Copy link
Member

For running everything serially so it's easier to debug concurrency issues.

In the future it might do other things too to aid in debugging. Suggestions welcome.

@sindresorhus sindresorhus mentioned this issue Sep 1, 2015
3 tasks
@Qix-
Copy link
Contributor

Qix- commented Sep 1, 2015

👍

@vadimdemedes
Copy link
Contributor

Currently, ava does not have a single config store, so we have to come up with some way to share configuration between scripts. Right now, I can see 2 ways to implement this, without major code changes:

  1. ava --debug sets environment variable, so that other scripts (files) see it: process.env.AVA_DEBUG = true. Also, it will be possible to enable debug mode by AVA_DEBUG=true ava.
  2. Have a config.js with module.exports = {} and set config values there (all scripts that require('./config') will get the same object).

What do you think?

@vadimdemedes
Copy link
Contributor

Config would also be handy for #27

@Qix-
Copy link
Contributor

Qix- commented Sep 1, 2015

Do you mean for child processes? Or just for the AVA scripts in general?

@vadimdemedes
Copy link
Contributor

@Qix- Sorry, did not understand your question

@Qix-
Copy link
Contributor

Qix- commented Sep 1, 2015

I re-read your comment; I think see what you mean now.

I'd have to test, but I'd suspect that ad-hoc environment variables added to process.env would be passed down to child processes too, which means that's a plausible way of storing configuration so child AVA processes will be aware of configuration. Unless that's not how @sindresorhus plans on implementing child processes.

@vadimdemedes
Copy link
Contributor

Yes, child processes will get modified process.env object (node.js docs say so).

@sindresorhus
Copy link
Member Author

I don't understand how this is related to a --debug flag? Right now it doesn't use any child-processes, but just require's the test files.

As for sharing config with sub-processes, that's better discussed in #1. But tl;dr, child_process.fork and message passing.

@vadimdemedes
Copy link
Contributor

@sindresorhus I was talking about the ways to indicate, that user specified --debug flag and wants tests to run serially. For example, as for now, how would lib/test.js know, that cli.js has debug = true?

@sindresorhus
Copy link
Member Author

It could just read argv: process.argv.indexOf('--debug') !== -1. But more likely the CLI will pass it as an option to the lib/test.js interface.

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

Successfully merging a pull request may close this issue.

3 participants