Skip to content

Create .exdoc file after warning about using an existing directory #1713

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

Merged

Conversation

viniciusmuller
Copy link
Contributor

@viniciusmuller viniciusmuller commented May 31, 2023

Currently, if an user tries to set --output to a directory that already contains files, ex_doc will emit a warning about that and create the files anyway, but it never creates the .exdoc file, meaning every time mix docs is run on that directory it will display the same warnings.

This pull requests calls the create callback after emitting the warning, so that in subsequent invocations no warnings will be emitted.

@josevalim
Copy link
Member

Is this something we could add a test on? Do we test the warning is emitted? If so, can we test the warning is not emitted on the second run? thank you ❤️

@viniciusmuller
Copy link
Contributor Author

I've added this check to the tests that I've added when implementing this feature, I think there's no reason to duplicate the entire test just to test this property.

@viniciusmuller
Copy link
Contributor Author

Not sure why this test failing, I've just ran the test suite locally 15 times in a row and it passed them all consistently 🤔

@josevalim
Copy link
Member

You are capturing output from other tests that are running concurrently. You may need to mark those cases as async: false (or move those particular tests to another module with async: false).

@josevalim
Copy link
Member

@wojtekmach is there a better test structure we could use here?


assert ExUnit.CaptureIO.capture_io(:stderr, fn ->
generate_docs(tmp_dir)
end) =~ ""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any string would pass this assertion be we want to make sure we didn't print any warnings!

Suggested change
end) =~ ""
end) == ""

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad here, forgot to change the operator

@wojtekmach wojtekmach merged commit 898b333 into elixir-lang:main Jun 1, 2023
@wojtekmach
Copy link
Member

Thank you!

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

Successfully merging this pull request may close these issues.

3 participants