-
Notifications
You must be signed in to change notification settings - Fork 39
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
[Bug]: ng test
does not work for o3r-generated library in pnp
#2620
Comments
Hi, I don't think that removing the workspace property is a solution, it will lead to many other issues. I would have a question: do we want to keep the Jasmine brought by Angular when we (including company guidelines) recommend to use Jest? A simple workaround (to keep temporary Jasmine) is to simply copy past the Jasmine devDependency from the workspace package.json into the new library devDependency. What do you think? |
As discussed, we will fix this issue by removing the jasmine setup and replace it with jest in the application and library generation. Note: there should be an option not to setup jest and keep jasmine |
The following two items should also be considered when putting in place the setup.
|
Package name
workspace
Package version
11.5.0
Reproduction steps
Generate an o3r project with yarn as packageManager and generate a library.
Run
yarn ng test my-lib
. Test should work.Update the
yarnrc
to setnodeLinker: pnp
and run the yarn install.Now, run the test command.
Current result
Test fails with error:
Error: error TS2688: Cannot find type definition file for 'jasmine'. The file is in the program because: Entry point of type library 'jasmine' specified in compilerOptions
and errors such as
Cannot find name 'beforeEach'
.Expected result
Test should not fail
Additional comments
Issue seems to come from the fact that jasmine is not part of the devDependencies of the library project and is only available in the root package and that the project is in pnp with defined workspace.
Yarn pnp expects that each module works in isolation and the generated library misses the
@types/jasmine
devDependency.(See yarnpkg/berry#1058 (comment))
We need to keep in mind that we cannot just add this devDependency as it was brought by angular create and library generator. It is not recommended to add dependencies that we do not bring ourselves.
In this issue, we need to consider whether we keep the support of pnp for our generated module, if we remove the workspace property from the generated root package.json (and see the impact on project size et dev experience) or if we can find an alternative solution.
The text was updated successfully, but these errors were encountered: