-
Notifications
You must be signed in to change notification settings - Fork 508
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
test/ dir is in include
, non-spec TS files (e.g. test utils) break build with v0.13 rootDir: ./src
#638
Comments
You don't need to (and probably shouldn't) compile it during EDIT: for tl;dr for other readers, remove
It is listed very clearly as a deprecation in the release and clearly prints a warning. I very much know it can break many people's code, that is the exact reason it is a deprecation with a warning instead of a full breaking change. The warning says the previous behavior was very buggy (so much so that the more tests we added, the more frequently CI would fail) and tells you how to change. This was a necessary change. I also do know a good number of the TSDX configs out there, but there are thousands using this, it's impossible to test against all possible uses. I did create #627 recently however. In the future we could more formally test against some big projects, but keep in mind TSDX is still very young, it is v0.x and will still have many breaking changes ahead. The API surface will evolve and the point of v0.x is to make that clear to consumers that it's still being ironed out and breaking changes will happen more frequently. Not that it's necessarily a good thing, but plenty of stable v1+ libraries much bigger than TSDX accidentally break things in patches, minors, etc (this occurs in some of TSDX's own dependencies no less like in #511) or make very hard breaking changes that require big migrations. But that'll happen, and every project will fix bugs and learn. |
It doesn't 'handle it fine', hence this issue. |
You clearly wrote this issue is about |
|
Like I said, you don't need to build that file. I think I see what the issue is though -- the default template tsdx/src/createRollupConfig.ts Lines 151 to 162 in e84e8d6
That also meant test files were being read by rpts2/TS before and excluding them might improve performance of build a bit ( |
include
, non-spec TS files (e.g. test utils) break build with v13 rootDir: ./src
include
, non-spec TS files (e.g. test utils) break build with v13 rootDir: ./src
include
, non-spec TS files (e.g. test utils) break build with v0.13 rootDir: ./src
I do notice that the build is faster now. =) |
If I remove test folder from include and put TestUtils.tsx back into test, then I get other errors around that file. =( |
Error:(6, 35) TS6059: File '/test/TestUtils.tsx' is not under 'rootDir' '/mui-rff/src'. 'rootDir' is expected to contain all source files. |
Huh, even when it's not imported by any Not sure if that's because of an upstream bug like ezolenko/rollup-plugin-typescript2#211 or if it's because rpts2's Rollup You can also override TSDX's default exclude with your own EDIT: when |
Yea... just try making a non-test file that is only included by test files (and not used by anything in src) work. ;-) |
ok so I created a
So either of the workarounds work. Now the question is whether to change the default
Buuut, it seems that I also found microsoft/TypeScript#9858, which validates that But it also says in microsoft/TypeScript#9858 (comment) that "[ Guh, I'm not sure there's an easy way of reverting #504 without introducing bugs. The only way it'd work is if all |
Please ignore the previous comment I made (now deleted), made too many changes at once, so I tested it wrong. typescript-eslint/typescript-eslint#1350 (comment) also points to using a separate Notably this means that for #639 , Probably want to move to using |
Thanks for all your work on this. It is painfully clear to me that nobody writes tests. ;-) |
I understand you're half-joking, but just to respond to that:
|
For the record, I wasn't poking at TSDX, I was poking at users of TSDX. ;-) |
If your users were writing tests, I'd expect to see a long list of people commenting on this issue right now. Having a simple helper file that is shared between tests is such a common usecase in every set of tests I've ever written, it seems to reason that people would be commenting like mad right now. |
This comment has been minimized.
This comment has been minimized.
Thank you both for the back and forth. |
Ah, I see. Well I think there's also less because not everyone has upgraded, and not everyone has So I did some more testing -- having So I think the correct approach to this will be to remove Notably That's super involved, though notably A quick-fix that handles this particular case is the suggestion I made before, adding |
Also they are just warnings, you can ignore the |
So maybe it makes sense for root Not sure how Storybook would interact with this however, c.f. #641 |
Confirmed some more cases today that the faulty
So yea, having
@jaredpalmer I checked out Formik and am not sure what the issue is there, as Formik doesn't have Currently working on getting #621 and #627 out ASAP as they improve testing and the testing structure. A preset for |
It is based off a template several versions ago. |
Removed from the template, test added, and added a sentence to the Per my comments there, I couldn't reproduce the VS Code issues in #225 / #80 and @allcontributors please add @lookfirst for bug |
I've put up a pull request to add @lookfirst! 🎉 |
Updated to latest version (0.13.1) I moved my Now my IDE reports this error: "TS6059: File '/mui-rff/test/TestUtils.tsx' is not under 'rootDir' '/mui-rff/src'. 'rootDir' is expected to contain all source files." |
Yea you gotta remove v0.13.1 just changed the templates, unfortunately we can't change user tsconfigs yet (but maybe we will once there's a TSDX tsconfig preset) |
I did remove it. |
This comment has been minimized.
This comment has been minimized.
Feel free to clone my repo, fix what you think is broken and make sure to open a test file in IDEA and make sure nothing is broken there too. Then submit a PR. Then you could close this issue. ;-) |
Ok, might wanna restart your IDE or something, I have periodic caching issues in mine too. If your So either cache issue or there's a bug in the IDE |
I did clear cache and restart it. |
I mean I don't know what to tell you, that sounds like an IDE issue -- it's reading your If |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Let's see what IDEA says about it: https://youtrack.jetbrains.com/issue/IDEA-236281 |
This comment has been minimized.
This comment has been minimized.
You should probably give them your And, per previous comments, for some reason only one file is giving that error instead of all |
You can also use the approach I mentioned in #638 (comment) , which should make the Summary would be:
That'll require passing |
Current Behavior
Prior to v0.13 #504 , I could put a file into my test folder that contained utility code for tests and it would get compiled without a problem.
test/TestUtils.tsx
Now, when I
tsdx build
, I see this error:rpt2: options error TS6059: File '/mui-rff/test/TestUtils.tsx' is not under 'rootDir' '/mui-rff/src'. 'rootDir' is expected to contain all source files.
Expected behavior
I have a place to put utility code for tests.
Suggested solution(s)
No idea, but you have a list of 3rd parties using this project and it would be nice if you would start to test future versions of tsdx against these projects to see if you break peoples stuff and can then use that to find out how to tell people how to fix their broken stuff.
Your environment
The text was updated successfully, but these errors were encountered: