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

Using a rerun file does not work when there is a trailing newline #657

Closed
CodyRay opened this issue Oct 20, 2016 · 4 comments
Closed

Using a rerun file does not work when there is a trailing newline #657

CodyRay opened this issue Oct 20, 2016 · 4 comments

Comments

@CodyRay
Copy link
Contributor

CodyRay commented Oct 20, 2016

I opened up a file created by the rerun formatted in vim and saving it (causing a new line character to be appended to the file). Once the newline is present, it seems to be silently ignored by cucumberjs.

Steps to reproduce: (v1.3.1)

  1. Run cucumber with a rerun formatted and at least one failing test
  2. Open the rerun file (in vim)
  3. Save the file
    • observe that there is now an extra new line character
  4. Run cucumber with the rerun file

Expected result: Only the failing test is run again

Actual result: The rerun file seems to be skipped without an error or warning; all tests are run

@charlierudolph
Copy link
Member

This was actually the cause of a bug when I initially implemented rerun. An extra newline in the file causes every feature to be loaded (this is because empty string gets treated as if its cwd and each directory get expanded to all recursive features).

Since this doesn't seem right, I think we should probably do two things.

  1. trim trailing whitespace from the rerun file to prevent your specific use case
  2. throw an error if any feature path is an empty string (to prevent this odd case from causing any other bugs in the future)

If you'd like to just tackle number 1, I'm happy to point you in the right direction. 2 should be tackled separately whether you'd like to tackle it or not.

@CodyRay
Copy link
Contributor Author

CodyRay commented Oct 21, 2016

I can take a shot at 1. If you could point me at where the relevant parsing happens that would be very helpful

@charlierudolph
Copy link
Member

Here is where rerun files (files which start with a @) are read.
Please add a failing feature test here first.
The test should could be very similar to the last four lines of multiple scenarios failing scenario. The first step would need to be changed to something like

Given a file named '@rerun.txt' with:
  # File content with an extra newline

charlierudolph pushed a commit that referenced this issue Nov 23, 2016
Fixes #657. This prevents all the tests from running when there is a trailing
newline in the @rerun file.
@lock
Copy link

lock bot commented Oct 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants