[Bug]: ng test
does not work for o3r-generated library in pnp
#2620
Labels
ng test
does not work for o3r-generated library in pnp
#2620
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: