Tests - Package & Create Targets#73
Conversation
|
This pull request bring the targets to 100% code coverage :)
|
| * When you pass your own namedInputs (like you would in a project.json file) via the inferred tasks plugin, | ||
| * the tasks pipeline ignores them and throws this error. | ||
| * Some Nx plugins use the default namedInput, probably for that reason, | ||
| * but I'm concerned that if developers change those inputs, it might lead to undesired behavior. |
There was a problem hiding this comment.
| * When you pass your own namedInputs (like you would in a project.json file) via the inferred tasks plugin, | |
| * the tasks pipeline ignores them and throws this error. | |
| * Some Nx plugins use the default namedInput, probably for that reason, | |
| * but I'm concerned that if developers change those inputs, it might lead to undesired behavior. | |
| * When you pass your own `namedInputs` (like you would in a `project.json` file) via the inferred tasks plugin, | |
| * the tasks pipeline ignores them and throws this error. | |
| * Some Nx plugins use the default `namedInput`, probably for that reason, | |
| * but I'm concerned that if developers change those inputs, it might lead to undesired behaviour. |
I assume this situation changed since the discussion in #62 made progress.
There was a problem hiding this comment.
I have pushed the changes you suggested. Should i leave it in code if the situation changed?
projects/nx-verdaccio/src/plugin/targets/create-targets.unit-test.ts
Outdated
Show resolved
Hide resolved
projects/nx-verdaccio/src/plugin/targets/create-targets.unit-test.ts
Outdated
Show resolved
Hide resolved
projects/nx-verdaccio/src/plugin/targets/create-targets.unit-test.ts
Outdated
Show resolved
Hide resolved
projects/nx-verdaccio/src/plugin/targets/create-targets.unit-test.ts
Outdated
Show resolved
Hide resolved
projects/nx-verdaccio/src/plugin/targets/create-targets.unit-test.ts
Outdated
Show resolved
Hide resolved
projects/nx-verdaccio/src/plugin/targets/package.targets.unit-test.ts
Outdated
Show resolved
Hide resolved
BioPhoton
left a comment
There was a problem hiding this comment.
Another nice testing PR!! <3
Very nice you even checked the coverage 💪! I found slight things we could adjust... have a look.
|
Any updates? |
|
I will push The changes today/tommorow |
…emove `correct structure` for consistency, add missing mockReturnFalse to false positive test
…, happy path, spies, mock
…ere used only once
…ate targets tests
…ole object structure
|
Things done after review
Self Review
|
| expect(nxDevkitMockModule.logger.warn).toHaveBeenCalledTimes(0); | ||
| }); | ||
|
|
There was a problem hiding this comment.
| expect(nxDevkitMockModule.logger.warn).toHaveBeenCalledTimes(0); | |
| }); | |
| expect(nxDevkitMockModule.logger.warn).not.toHaveBeenCalled(); | |
| }); | |
| expect(nxDevkitMockModule.logger.warn).toHaveBeenCalledTimes(0); | ||
| }); |
There was a problem hiding this comment.
| expect(nxDevkitMockModule.logger.warn).toHaveBeenCalledTimes(0); | |
| }); | |
| expect(nxDevkitMockModule.logger.warn).not.toHaveBeenCalled(); | |
| }); |
| let normalizeCreateNodesOptionsSpy: MockInstance; | ||
| let isEnvProjectSpy: MockInstance; | ||
| let isPkgSpy: MockInstance; | ||
| let verdaccioTargetsSpy: MockInstance; | ||
| let getEnvTargetsSpy: MockInstance; | ||
| let updateEnvTargetNamesSpy: MockInstance; | ||
|
|
||
| beforeEach((): void => { | ||
| normalizeCreateNodesOptionsSpy = vi | ||
| .spyOn(normalizeCreateNodesSpyModule, 'normalizeCreateNodesOptions') | ||
| .mockReturnValue(normalizedOptions); | ||
| isEnvProjectSpy = vi | ||
| .spyOn(environmentTargetsModule, 'isEnvProject') | ||
| .mockReturnValue(true); | ||
| isPkgSpy = vi | ||
| .spyOn(packageTargetsSpyModule, 'isPkgProject') | ||
| .mockReturnValue(true); |
There was a problem hiding this comment.
General best practices for setup spy's and configuring spy's:
- setup in describe
- configuring with potential defaults in beforeEach
- actual mock return in the it block
BioPhoton
left a comment
There was a problem hiding this comment.
Thanks for the tests!
I left some comments

No description provided.