Skip to content

Commit 0c85744

Browse files
Apply suggestions from code review
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 3164fc9 commit 0c85744

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

  • packages/schematics/angular/refactor/jasmine-vitest/transformers

packages/schematics/angular/refactor/jasmine-vitest/transformers/jasmine-spy.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,24 @@ export function transformSpyReset(
445445
return node;
446446
}
447447

448+
function shouldStubBareSpyOn(node: ts.CallExpression): boolean {
449+
if (
450+
ts.isIdentifier(node.expression) &&
451+
node.expression.text === 'spyOnProperty' &&
452+
node.arguments.length >= 3
453+
) {
454+
const accessType = node.arguments[2];
455+
if (ts.isStringLiteralLike(accessType) && accessType.text === 'set') {
456+
return false;
457+
}
458+
}
459+
460+
const parent = node.parent;
461+
if (
462+
parent &&
463+
ts.isPropertyAccessExpression(parent) &&
464+
parent.expression === node &&
465+
ts.isIdentifier(parent.name) &&
448466
function shouldStubBareSpyOn(node: ts.CallExpression): boolean {
449467
if (
450468
ts.isIdentifier(node.expression) &&
@@ -471,6 +489,9 @@ function shouldStubBareSpyOn(node: ts.CallExpression): boolean {
471489
return true;
472490
}
473491

492+
return true;
493+
}
494+
474495
function getSpyIdentifierFromCalls(node: ts.PropertyAccessExpression): ts.Expression | undefined {
475496
if (ts.isIdentifier(node.name) && node.name.text === 'calls') {
476497
return node.expression;

0 commit comments

Comments
 (0)