Skip to content

Conversation

@wmertens
Copy link

Fixes #1511

This also introduces a slight change in semantics: package.json and **/*.snap are always considered source files, since they are part of how AVA works and not of the application source files. If that is undesirable, they can be put in the ignore list.

Copy link
Member

@novemberborn novemberborn left a comment

Choose a reason for hiding this comment

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

Thanks for this PR @wmertens!

Fixes #1511

😀

This also introduces a slight change in semantics: package.json and **/*.snap are always considered source files, since they are part of how AVA works and not of the application source files.

👍

We need a test to confirm these files can still be ignored.

https://github.com/avajs/ava/blob/master/docs/recipes/watch-mode.md#source-files-and-test-files needs to be updated so it's clear that package.json and **/*.snap files are always watched, even if source is configured, unless explicitly ignored.

lib/ava-files.js Outdated
}

paths = paths.concat(this.files);
paths.push(...this.files);
Copy link
Member

Choose a reason for hiding this comment

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

We're targeting Node.js 4, which means spread isn't available 😞

Copy link
Author

Choose a reason for hiding this comment

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

ok fixed

Also, always mark `package.json` as source. If either of these is undesirable, they can be put in the ignore list.
@wmertens
Copy link
Author

Addressed your comments, but I'm not sure how to test the ignore pattern…

Copy link
Member

@novemberborn novemberborn left a comment

Choose a reason for hiding this comment

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

I'm not sure how to test the ignore pattern…

There's a few integration tests in test/cli: https://github.com/avajs/ava/blob/03149d79a67f52c4f580ef54da84856eb3dd3fd5/test/cli.js#L261:L363

This test would be very similar I think.

In AVA there's a distinction between *source files* and *test files*. As you can imagine the *test files* contain your tests. *Source files* are all other files that are needed for the tests to run, be it your source code or test fixtures.

By default AVA watches for changes to the test files, snapshot files, `package.json`, and any other `.js` files. It'll ignore files in [certain directories](https://github.com/novemberborn/ignore-by-default/blob/master/index.js) as provided by the [`ignore-by-default`] package.
By default AVA watches for changes to the test files and any `.js` files. It'll ignore files in [certain directories](https://github.com/novemberborn/ignore-by-default/blob/master/index.js) as provided by the [`ignore-by-default`] package. It also always watches `package.json` an snapshot files (even when you specify other source patterns), unless they are specifically ignored.
Copy link
Member

Choose a reason for hiding this comment

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

unless they are specifically ignored

Swap they for these, I think.

This should have an example of how to ignore them.

@novemberborn
Copy link
Member

Hey @wmertens, do you have the time to finish this up, or would you rather I give it a go?

@wmertens
Copy link
Author

Hmm, no time at all right now, maybe next week; so feel free to assist, thanks! :)

@novemberborn
Copy link
Member

No worries @wmertens. I'll probably focus on other issues first.

@novemberborn
Copy link
Member

Hey @wmertens I'm going to close this, if only for housekeeping reasons. Feel free to reopen / make a new PR if you have the time to get back to this.

I have some thoughts on how AVA should select test, helper and source files that will impact watch mode. I've added the appropriate label to #1511 so maybe I'll be able to solve it all in one go when I get to that stage.

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

Labels

None yet

2 participants