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

Some common code repo unit tests are not in any tsconfig #1134

Closed
samreid opened this issue Nov 2, 2021 · 16 comments
Closed

Some common code repo unit tests are not in any tsconfig #1134

samreid opened this issue Nov 2, 2021 · 16 comments

Comments

@samreid
Copy link
Member

samreid commented Nov 2, 2021

Discovered in phetsims/dot#112, some unit tests such as dot are not covered in any tsconfig. For instance, try changing LinearFunctionTests.js and see that it doesn't recompile.

@samreid
Copy link
Member Author

samreid commented Nov 2, 2021

In the commit, I demonstrated a way to add the unit test layer into a common code repo. This defines a new tsconfig file in the sim repo that adds the unit tests. The primary "tsconfig.json" file is the one which should be used as a standard dependency (for client usage). I'm inclined to discuss this proposal with @zepumph before I apply it throughout the common code repos. We should also consider that some repos may have a "demo" main that has downstream dependencies, without having tests. So I'm not sure what the 2nd layer of tsconfig should be called (if we have a general term for it).

@samreid samreid assigned zepumph and unassigned samreid Nov 2, 2021
@zepumph
Copy link
Member

zepumph commented Nov 4, 2021

Honestly, I think that making things as explicit as possible to start sounds best. One tsconfig for the library, another for the tests, and another for the demo (which likely includes joist).

In that case, it seems like it would be easiest to potentially create tsconfig files automatically, because a default demo and tests config file will likely be quite straight forward.

Do you have an opinion on the matter?

@zepumph zepumph assigned samreid and unassigned zepumph Nov 4, 2021
zepumph added a commit to phetsims/dot that referenced this issue Nov 5, 2021
samreid added a commit to phetsims/scenery-phet that referenced this issue Nov 19, 2021
@samreid
Copy link
Member Author

samreid commented Nov 19, 2021

The 2 prior commits demonstrate how to fix this for scenery-phet.

@samreid
Copy link
Member Author

samreid commented Nov 19, 2021

I said on slack:

Some common code repos are showing on CT as e.g., ModuleNotFoundError: Module not found: Error: Can't resolve '../chipper/dist/scenery-phet/js/scenery-phet-main.js' . This problem is being tracked in #1134 and I demonstrated how to solve it for scenery-phet. I have to leave for an appointment this morning and probably won’t be able to solve these before I go. This is also a problem because commits on common code repos will probably fail due to the unit tests not working. I’ll work on it as soon as I can but if you need to push common repos before it’s fixed, please (a) disable commit hooks or (b) follow the pattern in #1134 like was done for scenery-phet.

samreid added a commit to phetsims/axon that referenced this issue Nov 19, 2021
samreid added a commit to phetsims/sun that referenced this issue Nov 19, 2021
@samreid
Copy link
Member Author

samreid commented Nov 19, 2021

Also, I'm thinking of inverting this so that, say, sun/tsconfig.json has everything. And sun/tsconfig-core has only core files needed by dependencies. This would make it easier to cd sun and tsc -b or tsc

samreid added a commit that referenced this issue Nov 19, 2021
samreid added a commit to phetsims/tambo that referenced this issue Nov 19, 2021
samreid added a commit to phetsims/twixt that referenced this issue Nov 19, 2021
samreid added a commit that referenced this issue Nov 19, 2021
samreid added a commit to phetsims/vegas that referenced this issue Nov 19, 2021
samreid added a commit that referenced this issue Nov 19, 2021
samreid added a commit that referenced this issue Nov 19, 2021
samreid added a commit to phetsims/joist that referenced this issue Nov 19, 2021
samreid added a commit to phetsims/scenery-phet that referenced this issue Nov 24, 2021
samreid added a commit to phetsims/tambo that referenced this issue Nov 24, 2021
samreid added a commit to phetsims/joist that referenced this issue Nov 24, 2021
@samreid
Copy link
Member Author

samreid commented Nov 24, 2021

OK that seems fixed. The main problem I've had with this organization is that you cannot run tsc -b combined with --project. So there is no easy way to build, say, dot as a module. One alternative would be to move dot/tsconfig-module.json to dot/tsconfig/module/tsconfig.json or maybe dot/module/tsconfig.json, but maybe we will wait until we have more of a need for this. Or we could add things in chipper/tsconfig to point to these as needed. Maybe I'll create a side issue about this.

@samreid samreid closed this as completed Nov 24, 2021
samreid added a commit to phetsims/perennial that referenced this issue Oct 21, 2024
samreid added a commit to phetsims/perennial that referenced this issue Oct 21, 2024
samreid added a commit to phetsims/perennial that referenced this issue Oct 21, 2024
samreid added a commit to phetsims/perennial that referenced this issue Oct 21, 2024
samreid added a commit to phetsims/perennial that referenced this issue Oct 21, 2024
samreid added a commit to phetsims/perennial that referenced this issue Oct 21, 2024
samreid added a commit to phetsims/perennial that referenced this issue Oct 21, 2024
samreid added a commit to phetsims/perennial that referenced this issue Oct 21, 2024
samreid added a commit to phetsims/perennial that referenced this issue Oct 21, 2024
samreid added a commit to phetsims/perennial that referenced this issue Oct 21, 2024
samreid added a commit to phetsims/perennial that referenced this issue Oct 21, 2024
samreid added a commit to phetsims/perennial that referenced this issue Oct 21, 2024
samreid added a commit to phetsims/perennial that referenced this issue Oct 21, 2024
samreid added a commit to phetsims/perennial that referenced this issue Oct 21, 2024
samreid added a commit to phetsims/perennial that referenced this issue Oct 21, 2024
samreid added a commit to phetsims/perennial that referenced this issue Oct 21, 2024
samreid added a commit to phetsims/perennial that referenced this issue Oct 21, 2024
samreid added a commit to phetsims/perennial that referenced this issue Oct 21, 2024
samreid added a commit to phetsims/perennial that referenced this issue Oct 21, 2024
samreid added a commit to phetsims/perennial that referenced this issue Oct 21, 2024
samreid added a commit to phetsims/perennial that referenced this issue Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants