Skip to content

Commit 273444a

Browse files
committed
refactor(migrations): support getting statistics in tsurge testing (angular#58019)
This allows us to test statistics in future commits. PR Close angular#58019
1 parent 6b57fcd commit 273444a

File tree

7 files changed

+155
-120
lines changed

7 files changed

+155
-120
lines changed

packages/core/schematics/migrations/output-migration/output-migration.spec.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -113,22 +113,22 @@ describe('outputs', () => {
113113
await verify({
114114
before: `
115115
import {Directive, Output, EventEmitter} from '@angular/core';
116-
116+
117117
@Directive()
118118
export class TestDir {
119-
/**
120-
* Whenever there is change, emits an event.
119+
/**
120+
* Whenever there is change, emits an event.
121121
*/
122122
@Output() someChange = new EventEmitter();
123123
}
124124
`,
125125
after: `
126126
import {Directive, output} from '@angular/core';
127-
127+
128128
@Directive()
129129
export class TestDir {
130-
/**
131-
* Whenever there is change, emits an event.
130+
/**
131+
* Whenever there is change, emits an event.
132132
*/
133133
readonly someChange = output();
134134
}
@@ -140,7 +140,7 @@ describe('outputs', () => {
140140
await verify({
141141
before: `
142142
import {Directive, Output, EventEmitter} from '@angular/core';
143-
143+
144144
@Directive()
145145
export class TestDir {
146146
/* Whenever there is change,emits an event. */
@@ -149,7 +149,7 @@ describe('outputs', () => {
149149
`,
150150
after: `
151151
import {Directive, output} from '@angular/core';
152-
152+
153153
@Directive()
154154
export class TestDir {
155155
/* Whenever there is change,emits an event. */
@@ -171,7 +171,7 @@ describe('outputs', () => {
171171
await verify({
172172
before: `
173173
import {Directive, Output, EventEmitter, Subject} from '@angular/core';
174-
174+
175175
@Directive()
176176
export class TestDir {
177177
@Output() someChange1 = new EventEmitter();
@@ -180,7 +180,7 @@ describe('outputs', () => {
180180
`,
181181
after: `
182182
import {Directive, Subject, output} from '@angular/core';
183-
183+
184184
@Directive()
185185
export class TestDir {
186186
readonly someChange1 = output();
@@ -329,7 +329,7 @@ describe('outputs', () => {
329329
import {Directive, Output, EventEmitter} from '@angular/core';
330330
import {map} from 'rxjs';
331331
import 'jasmine';
332-
332+
333333
@Directive()
334334
export class TestDir {
335335
@Output() someChange = new EventEmitter<number>();
@@ -342,7 +342,7 @@ describe('outputs', () => {
342342
import {Directive, output} from '@angular/core';
343343
import {map} from 'rxjs';
344344
import 'jasmine';
345-
345+
346346
@Directive()
347347
export class TestDir {
348348
readonly someChange = output<number>();
@@ -357,11 +357,11 @@ describe('outputs', () => {
357357
it('should _not_ migrate outputs that are used with .pipe', () => {
358358
verifyNoChange(`
359359
import {Directive, Output, EventEmitter} from '@angular/core';
360-
360+
361361
@Directive()
362362
export class TestDir {
363363
@Output() someChange = new EventEmitter();
364-
364+
365365
someMethod() {
366366
this.someChange.pipe();
367367
}
@@ -372,14 +372,14 @@ describe('outputs', () => {
372372
it('should _not_ migrate outputs that are used with .pipe outside of a component class', () => {
373373
verifyNoChange(`
374374
import {Directive, Output, EventEmitter} from '@angular/core';
375-
375+
376376
@Directive()
377377
export class TestDir {
378378
@Output() someChange = new EventEmitter();
379379
}
380-
380+
381381
let instance: TestDir;
382-
382+
383383
instance.someChange.pipe();
384384
`);
385385
});
@@ -409,7 +409,7 @@ async function verifyNoChange(beforeAndAfter: string) {
409409
}
410410

411411
async function verify(testCase: {before: string; after: string}) {
412-
const fs = await runTsurgeMigration(new OutputMigration(), [
412+
const {fs} = await runTsurgeMigration(new OutputMigration(), [
413413
{
414414
name: absoluteFrom('/app.component.ts'),
415415
isProgramRootFile: true,

packages/core/schematics/migrations/signal-migration/test/migration_spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe('signal input migration', () => {
2222
'should properly handle declarations with loose property initialization ' +
2323
'and strict null checks enabled',
2424
async () => {
25-
const fs = await runTsurgeMigration(
25+
const {fs} = await runTsurgeMigration(
2626
new SignalInputMigration(),
2727
[
2828
{
@@ -70,7 +70,7 @@ describe('signal input migration', () => {
7070
'should properly handle declarations with loose property initialization ' +
7171
'and strict null checks disabled',
7272
async () => {
73-
const fs = await runTsurgeMigration(
73+
const {fs} = await runTsurgeMigration(
7474
new SignalInputMigration(),
7575
[
7676
{

0 commit comments

Comments
 (0)