Repository navigation
Commit a2d8a25
fix(@schematics/angular): preserve stub-by-default semantics for createSpy with an original function
`jasmine.createSpy(name, originalFn)` stores the original function but does not invoke it:
the default spy plan is a no-op stub, and the original function only runs after
`.and.callThrough()`. The refactor-jasmine-vitest schematic maps this call to
`vi.fn(originalFn)`, which invokes the function immediately, so a migrated bare spy
suddenly calls through and can change test behavior.
(cherry picked from commit d899c51)1 parent 3df747b commit a2d8a25
2 files changed
Lines changed: 45 additions & 14 deletions
File tree
- packages/schematics/angular/refactor/jasmine-vitest/transformers
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
441 | 441 | | |
442 | 442 | | |
443 | 443 | | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | 444 | | |
450 | 445 | | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
| 446 | + | |
| 447 | + | |
456 | 448 | | |
457 | 449 | | |
458 | | - | |
459 | | - | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
460 | 453 | | |
461 | 454 | | |
462 | 455 | | |
463 | 456 | | |
464 | | - | |
| 457 | + | |
465 | 458 | | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
466 | 485 | | |
467 | 486 | | |
468 | 487 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
75 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
76 | 83 | | |
77 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
78 | 90 | | |
79 | 91 | | |
80 | 92 | | |
| |||
0 commit comments