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

Make watch mode dependency tracking work with custom require hooks #2088

Merged
merged 3 commits into from May 12, 2019

Conversation

lo1tuma
Copy link
Contributor

@lo1tuma lo1tuma commented Apr 5, 2019

Fixes: #2049

I’ve tested these fixes with one of my projects where sources and test files are written in typescript. I use @babel/register and @babel/typescript instead of tsc.

BTW: I’ve noticed that the sources patterns in ava.config.js must not start with a leading ./ otherwise ava-files doesn’t recognize the files as source files.

test/ava-files.js Outdated Show resolved Hide resolved
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 the PR @lo1tuma! Some comments below.

I’ve noticed that the sources patterns in ava.config.js must not start with a leading ./ otherwise ava-files doesn’t recognize the files as source files.

That seems odd. You should still be able to specify patterns within directories that are then treated as source files.

lib/ava-files.js Outdated Show resolved Hide resolved
lib/worker/subprocess.js Show resolved Hide resolved
test/ava-files.js Outdated Show resolved Hide resolved
@lo1tuma
Copy link
Contributor Author

lo1tuma commented Apr 6, 2019

That seems odd. You should still be able to specify patterns within directories that are then treated as source files.

Specifying directories works, but as I said only without leading ./.
Here is a small example to explain the current behavior a bit better:

Directory structure:

├── bar
│  └── b.js
├── foo
│  └── a.js
└── test
│  └── spec.js
├── ava.config.js
└── package.json

When I specify sources as [ './foo/**/*', './bar/**/*'] it doesn’t work, but [ 'foo/**/*', 'bar/**/*'] works.
I’m not really sure if this is an issue or the expected behavior, but it cost me some time to figure it out so I though it is worth mentioning.

@novemberborn
Copy link
Member

Hey @lo1tuma, apologies for not reviewing your changes. I've been trying to improve the file globbing itself, see #2103. My focus will be on landing that. Hopefully it also deals with #2085.

@novemberborn
Copy link
Member

Hey @lo1tuma, #2103 which fixed #2085. Would you like to update this PR to address #2049?

@lo1tuma
Copy link
Contributor Author

lo1tuma commented May 6, 2019

Hi @novemberborn, great work with #2103. I’ve updated this PR to only address #2049.

@novemberborn novemberborn changed the title Fix watch mode with custom extensions Make watch mode dependency tracking work with custom require hooks May 12, 2019
@novemberborn novemberborn merged commit cb4c809 into avajs:master May 12, 2019
@novemberborn
Copy link
Member

Thanks @lo1tuma!

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

Successfully merging this pull request may close these issues.

Update dependency tracking after modules are loaded from AVA's "require" configuration
3 participants