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

fix: watch-run #1083

Merged
merged 2 commits into from Apr 20, 2020
Merged

fix: watch-run #1083

merged 2 commits into from Apr 20, 2020

Conversation

Zn4rK
Copy link
Contributor

@Zn4rK Zn4rK commented Apr 7, 2020

Closes #1082

I need a bit of help verifying that these tests are correct. I tried to understand what's happening with _WatchApi, but couldn't wrap my head around it.

It looks scary to change /projectReferencesWatch_Composite_WatchApi/expectedOutput-3.8/patch4/output.txt to not emit an error, but projectReferencesWatch still has the corresponding error.

@johnnyreilly
Copy link
Member

Thanks for contributing! I must admit to wondering what the consequence of removing the regex would be... I have a feeling I put that in for a reason but, shame on me, I didn't put a comment to explain 😭

@Zn4rK
Copy link
Contributor Author

Zn4rK commented Apr 9, 2020

@johnnyreilly Yeah, I tried a bunch of stuff to try and figure out why it was there to begin with.
What essentially is let through the conditionals are files like these:

// many more of these, on every single watchRun
// since the first check doesn't include equality, they are updated on every "watch-run". 
filePath node_modules/typescript/lib/README.md date: 499162500010
filePath node_modules/typescript/lib/diagnosticMessages.generated.json, date: 499162500010
filePath node_modules/typescript/lib/typesMap.json date: 499162500010

But never the file that triggered the change - it eventually gets updated by the successLoader, but that's after it's needed - i.e. after any transformations.

Having it this way, the files are never updated in the cache any more times than necessary. It could potentially make it quicker.

@johnnyreilly
Copy link
Member

Cool - thanks for the explanation. We've got some big stuff happening with project references right now; see this PR: #1076

I'd like to get that landed and then take a look at this afterwards. Please bear with us!

@Zn4rK
Copy link
Contributor Author

Zn4rK commented Apr 10, 2020

Alright. Sounds good! I'll just use my patch for now.

And FYI I noticed that my excerpt above only included files from typescript, but the list contains a whole bunch of files from many different packages.

There's another conditional further down that I think can be removed completely (or at least modified) as well.
If the file has changed since the last time it was included (i.e. since the initial build), my "fix" would include it.

The typescript program needs to have a new version of the file that's been changed before emitting basically.

@johnnyreilly
Copy link
Member

v7.0.0 is now merged - I think you may have some merge conflicts I'm afraid!

@Zn4rK
Copy link
Contributor Author

Zn4rK commented Apr 15, 2020

I've rebased and updated, so I guess we're only waiting on Appveyor and Travis! :)

@johnnyreilly
Copy link
Member

Heya!

I'll admit to some nervousness around the change to this test output here:

https://github.com/Zn4rK/ts-loader/blob/82c192229be94edec5286e10698fa18230d33eb7/test/comparison-tests/projectReferencesWatch_WatchApi/expectedOutput-3.8/patch4/output.txt

Is this what you meant when you said:

It looks scary to change /projectReferencesWatch_Composite_WatchApi/expectedOutput-3.8/patch4/output.txt to not emit an error, but projectReferencesWatch still has the corresponding error.

I am aware of some quirkiness in our comparison tests which @sheetalkamat bumped on here: #1076 (comment)

That change was rolled back later on. So this may be fine... Thoughts?

@Zn4rK
Copy link
Contributor Author

Zn4rK commented Apr 19, 2020

Heya!

I'll admit to some nervousness around the change to this test output here:

https://github.com/Zn4rK/ts-loader/blob/82c192229be94edec5286e10698fa18230d33eb7/test/comparison-tests/projectReferencesWatch_WatchApi/expectedOutput-3.8/patch4/output.txt

Is this what you meant when you said [...]

I understand your nervousness and I'm a bit nervous too! I'm fairly confident that It should work as expected though.

That's basically what I meant. I just tested this manually, and ideally this file should be reverted to emit an error - since it still does that (as it should).

Screenshot 2020-04-19 at 18 11 31
(I made sure to include watch: true in the config)

I am aware of some quirkiness in our comparison tests which @sheetalkamat bumped on here: #1076 (comment)

We could maybe make the test flaky instead and take another look at improving the comparison tests in the future?

@johnnyreilly
Copy link
Member

Let's roll with it as is for now. Worst comes to worst we can revert this later, but I'll go 🤞 it's down to the quirkiness of the comparison test pack.

Could you update the package.json to 7.0.1 please? And add an entry to CHANGELOG.md - don't forget to thank yourself!

@Zn4rK
Copy link
Contributor Author

Zn4rK commented Apr 19, 2020

Let's roll with it as is for now. Worst comes to worst we can revert this later, but I'll go 🤞 it's down to the quirkiness of the comparison test pack.

Fair enough! :) I guess we just have to remember that it actually should emit an error. But the correct expected output still exists in projectReferencesWatch.

Could you update the package.json to 7.0.1 please? And add an entry to CHANGELOG.md - don't forget to thank yourself!

Done! 👍Thank you for taking the time with this!

Bump minimum node version to 10
@johnnyreilly johnnyreilly merged commit cc31287 into TypeStrong:master Apr 20, 2020
@johnnyreilly
Copy link
Member

Released! https://github.com/TypeStrong/ts-loader/releases/tag/v7.0.1

Entrypoint main = bundle.js
[./app.ts] 186 bytes {main} [built] [1 error]
Copy link
Contributor

Choose a reason for hiding this comment

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

How is this correct change.. Is this issue with the test (where it baselines wrong result) or the change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe that's an issue with this test. It should (and still does) produce the expected error. We could revert this make it flaky instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've manually verified projectReferencesWatch_Composite_WatchApi and projectReferencesWatch_WatchApi, both emit the error when running "manually" but not when using the comparison tests.

Copy link
Member

Choose a reason for hiding this comment

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

Is this issue with the test (where it baselines wrong result) or the change?

I think the problem may be the comparison test pack which seems to be demonstrating unhelpful (incorrect) behaviour. The comparison test pack is not as reliable as I'd like (and I'm partly responsible).

This doesn't give me a warm fluffy feeling but I don't believe it represents a bug in ts-loader.

Entrypoint main = bundle.js
[./app.ts] 186 bytes {main} [built] [1 error]
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same as above.

berickson1 pushed a commit to berickson1/ts-loader that referenced this pull request May 22, 2020
* fix: watch-run

* Update package.json

Bump minimum node version to 10

Co-authored-by: John Reilly <johnny_reilly@hotmail.com>
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.

Watch-run doesn't update correctly
3 participants