test: only collect .js files as tests - #360
Merged
Merged
Conversation
Some tests write scratch directories next to themselves. express-fileupload-temp uses './tmp', which resolves against the working directory, so running it directly from its own folder leaves a tmp directory behind that is gitignored and therefore sticks around. The runner reads every entry of a category folder as a test file, so a leftover directory makes readFileSync throw EISDIR and takes the whole category with it. Filter to .js entries.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The runner reads every entry of a category folder and passes it to
readFileSync, so anything in there that is not a file takes the whole category down withEISDIR: illegal operation on a directory, read.That is easy to end up with.
tests/middlewares/express-fileupload-temp.jswrites to./tmp, which resolves against the working directory rather than the test file, so running that test directly from its own folder leavestests/tests/middlewares/tmp/behind. It is covered by thetmp/line in.gitignore, so it never shows up ingit statusand stays there.I hit it with a directory left over from February, which made the whole
middlewarescategory fail before a single test in it ran.Filtering to
.jsentries is enough.