-
-
Notifications
You must be signed in to change notification settings - Fork 130
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
[Question] Testing & (Mock) Classes #84
Comments
1) Running tests via IDE:this is just a warning, your tests are passing, so you can ignore this warning... if you really want to suppress this warning, add following module.exports = {
name: 'tree',
preset: '../../jest.config.js',
transform: {
'^.+\\.[tj]sx?$': 'ts-jest'
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'html'],
coverageDirectory: '../../coverage/libs/tree',
globals: {
'ts-jest': {
diagnostics: {
ignoreCodes: 'TS151001'
}
}
}
}; 2) Configuration & Schemantics
ng g @nrwl/workspace:lib models --tags=utils --defaults -d
ng g lib home --routing
ng g lib core --tags=core-module --defaults -d
# same as about. @nrwl/angular is the `defaultCollection`
ng g @nrwl/angular:lib core --tags=core-module --defaults -d
ng g lib ContextMenu --tags=public-module --publishable=true --defaults -d
3) "Hiding" Test Classes in PackagesI am not sure the best solution for this. |
Dear @xmlking , 1) Running Tests in IDE (
|
3) "Hide" Test Classesclosest thing i get, is as follows: This way, for example, the However, when defining them as |
@johannesschobel thank you for further researching those issues. |
Dear @xmlking ,
thanks again for this really (!) awesome (!) starter package. This is a piece of art 😆
I recently added my own package to the
libs
folder and it worked like a charm. Then i started to write tests. In this context, however, i stumbled upon a few questions. Maybe you can help me with the latter?1) Running tests via IDE:
Consider, for example, the following "dummy" test-case:
Obviously, this test should pass. As I use
IntelliJ WebStorm
, i see the green "run" buttons next todescribe()
andit()
to specifically run one specific test or an entire suite. However, when clicking this button, it errors with:if i run the test via console
it runs all tests and they pass.
2) Configuration & Schemantics
When creating a new
lib
in the project viang g lib NAME
it automatically modifies the.\angular.json
file. In this context, it creates a key inprojects.NAME
, where some basic configuration stuff is located.However, i noticed, that in my "own generated" libs the key
projects.NAME.architect.test.options.setupFile
is missing. Further, the referenced file (e.g.,libs/NAME/src/test-setup.ts
) is also missing / not generated!3) "Hiding" Test Classes in Packages
In order to test certain functionality, i created some dummy classes (e.g,. a
Book
andAuthor
class). Respective classes are, for example, located inlibs/NAME/test/mocks/book.ts
.Of course, these classes are only vital for this specific library and does not need to be available in other. How can i "hide" them in other packages (e.g., disable the "intelli sense" auto-completion) for such "test classes"? Is this possible?
Thank you so much for this awesome project! You rock!
All the best from Germany
The text was updated successfully, but these errors were encountered: