Skip to content

Commit 6cc4a14

Browse files
CopilotChronosSF
andcommitted
Fix code review issues: environment config, duplicate properties, missing vi imports
Co-authored-by: ChronosSF <[email protected]>
1 parent 60f1fce commit 6cc4a14

File tree

4 files changed

+20
-23
lines changed

4 files changed

+20
-23
lines changed

projects/igniteui-angular/migrations/common/UpdateChanges.spec.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ describe('UpdateChanges', () => {
143143
}
144144
return false;
145145
});
146-
spyOn<any>(fs, 'readFileSync').mockImplementation(() => JSON.stringify(outputJson));
146+
vi.spyOn<any>(fs, 'readFileSync').mockImplementation(() => JSON.stringify(outputJson));
147147

148148
const fileContent = `<one (onReplaceMe)="a"> <comp\r\ntag (onReplaceMe)="dwdw" (onOld)=""> </other> <another (onOld)="b" />`;
149149
appTree.create('test.component.html', fileContent);
@@ -195,7 +195,7 @@ describe('UpdateChanges', () => {
195195
}
196196
return false;
197197
});
198-
spyOn<any>(fs, 'readFileSync').mockImplementation(() => JSON.stringify(inputJson));
198+
vi.spyOn<any>(fs, 'readFileSync').mockImplementation(() => JSON.stringify(inputJson));
199199

200200
let fileContent = `<one [replaceMe]="a"> <comp\r\ntag [replaceMe]="dwdw" [oldProp]=''> </other> <another oldProp="b" />`;
201201
appTree.create('test.component.html', fileContent);
@@ -273,7 +273,7 @@ describe('UpdateChanges', () => {
273273
}
274274
return false;
275275
});
276-
spyOn<any>(fs, 'readFileSync').mockImplementation(() => JSON.stringify(classJson));
276+
vi.spyOn<any>(fs, 'readFileSync').mockImplementation(() => JSON.stringify(classJson));
277277

278278
const fileContent =
279279
`import { igxClass, igxClass2 } from "igniteui-angular"; export class Test { prop: igxClass; prop2: igxClass2; }`;
@@ -309,7 +309,7 @@ describe('UpdateChanges', () => {
309309
}
310310
return false;
311311
});
312-
spyOn<any>(fs, 'readFileSync').mockImplementation(() => JSON.stringify(classJson));
312+
vi.spyOn<any>(fs, 'readFileSync').mockImplementation(() => JSON.stringify(classJson));
313313

314314
const fileContent =
315315
`import { igxClass, igxClass2 } from "igniteui-angular"; export class Test { prop: igxClass; prop2: igxClass2; }`;
@@ -350,7 +350,7 @@ describe('UpdateChanges', () => {
350350
}
351351
return false;
352352
});
353-
spyOn<any>(fs, 'readFileSync').mockImplementation(() => JSON.stringify(classJson));
353+
vi.spyOn<any>(fs, 'readFileSync').mockImplementation(() => JSON.stringify(classJson));
354354

355355
const fileContent =
356356
`import { Component, Injectable, ViewChild } from "@angular/core";` +
@@ -438,7 +438,7 @@ describe('UpdateChanges', () => {
438438
}
439439
return false;
440440
});
441-
spyOn<any>(fs, 'readFileSync').mockImplementation(() => JSON.stringify(classJson));
441+
vi.spyOn<any>(fs, 'readFileSync').mockImplementation(() => JSON.stringify(classJson));
442442

443443
const fileContent =
444444
`import { Name } from ""; import { Another } from "@space/package"; export class Test { prop: Name; prop2: Another; }`;
@@ -472,7 +472,7 @@ describe('UpdateChanges', () => {
472472
}
473473
return false;
474474
});
475-
spyOn<any>(fs, 'readFileSync').mockImplementation(() => JSON.stringify(classJson));
475+
vi.spyOn<any>(fs, 'readFileSync').mockImplementation(() => JSON.stringify(classJson));
476476

477477
let fileContent =
478478
`import { Size, Type as someThg } from "igniteui-angular";
@@ -536,7 +536,7 @@ export class Test {
536536
}
537537
return false;
538538
});
539-
spyOn<any>(fs, 'readFileSync').mockImplementation(() => JSON.stringify(inputJson));
539+
vi.spyOn<any>(fs, 'readFileSync').mockImplementation(() => JSON.stringify(inputJson));
540540

541541
const fileContent = `<igx-icon fontSet='material' name='phone'></igx-icon>
542542
<igx-icon fontSet="material-icons" name="build"></igx-icon>
@@ -594,7 +594,7 @@ export class Test {
594594
}
595595
return false;
596596
});
597-
spyOn<any>(fs, 'readFileSync').mockImplementation(() => JSON.stringify(themeChangesJson));
597+
vi.spyOn<any>(fs, 'readFileSync').mockImplementation(() => JSON.stringify(themeChangesJson));
598598

599599
const fileContent =
600600
`$var: igx-theme-func(
@@ -660,7 +660,7 @@ $var3: igx-comp-theme(
660660
}
661661
return false;
662662
});
663-
spyOn<any>(fs, 'readFileSync').mockImplementation(() => JSON.stringify(importsJson));
663+
vi.spyOn<any>(fs, 'readFileSync').mockImplementation(() => JSON.stringify(importsJson));
664664

665665
const fileContent = `
666666
@NgModule({
@@ -1018,7 +1018,7 @@ export class CustomGridComponent {
10181018
}
10191019
return false;
10201020
});
1021-
spyOn<any>(fs, 'readFileSync').mockImplementation(() => JSON.stringify(themeChangesJson));
1021+
vi.spyOn<any>(fs, 'readFileSync').mockImplementation(() => JSON.stringify(themeChangesJson));
10221022

10231023
const fileContent =
10241024
`$palette: $light-material-palette;
@@ -1113,7 +1113,7 @@ $header-border-color: igx-color($dark-theme-palette, "primary", 600)
11131113
}
11141114
return false;
11151115
});
1116-
spyOn<any>(fs, 'readFileSync').mockImplementation(() => JSON.stringify(themeChangesJson));
1116+
vi.spyOn<any>(fs, 'readFileSync').mockImplementation(() => JSON.stringify(themeChangesJson));
11171117

11181118
const fileContent =
11191119
`@use 'igniteui-angular/theming' as igniteui1;
@@ -1181,7 +1181,7 @@ $my-other-theme: my-namespace.function1($color1: igniteui2.contrast-color($palet
11811181
}
11821182
return false;
11831183
});
1184-
spyOn<any>(fs, 'readFileSync').mockImplementation(() => JSON.stringify(themeChangesJson));
1184+
vi.spyOn<any>(fs, 'readFileSync').mockImplementation(() => JSON.stringify(themeChangesJson));
11851185

11861186
const fileContent =
11871187
`@use 'igniteui-angular/theming' as *;
@@ -1240,7 +1240,7 @@ $my-other-theme: my-namespace.function1($color1: contrast-color($palette: palett
12401240
}
12411241
return false;
12421242
});
1243-
spyOn<any>(fs, 'readFileSync').mockImplementation(() => JSON.stringify(themeChangesJson));
1243+
vi.spyOn<any>(fs, 'readFileSync').mockImplementation(() => JSON.stringify(themeChangesJson));
12441244

12451245
const fileContent =
12461246
`@use 'igniteui-angular/theming' as igniteui1;
@@ -1301,7 +1301,7 @@ $my-other-theme: my-namespace.function1($color1: contrast-color($palette: palett
13011301
}
13021302
return false;
13031303
});
1304-
spyOn<any>(fs, 'readFileSync').mockImplementation(() => JSON.stringify(themeChangesJson));
1304+
vi.spyOn<any>(fs, 'readFileSync').mockImplementation(() => JSON.stringify(themeChangesJson));
13051305

13061306
const fileContent =
13071307
`@use 'igniteui-angular/theming' as *;

projects/igniteui-angular/test-utils/helper-utils.spec.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,18 @@ import { Subscription } from 'rxjs';
77
import { it, expect, beforeEach, afterEach, vi } from 'vitest';
88
/**
99
* Global beforeEach and afterEach checks to ensure test fails on specific warnings
10-
* Use direct env because karma-parallel's wrap ignores these in secondary shards
11-
* https://github.com/joeljeske/karma-parallel/issues/64
1210
*/
13-
(jasmine.getEnv() as any).beforeEach(() => {
11+
beforeEach(() => {
1412
vi.spyOn(console, 'warn');
1513
});
1614

17-
(jasmine.getEnv() as any).afterEach(() => {
15+
afterEach(() => {
1816
expect(console.warn)
1917
.withContext('Components & tests should be free of @for track duplicated keys warnings')
20-
.not.toHaveBeenCalledWith(jasmine.stringContaining('NG0955'));
18+
.not.toHaveBeenCalledWith(expect.stringContaining('NG0955'));
2119
expect(console.warn)
2220
.withContext('Components & tests should be free of @for track DOM re-creation warnings')
23-
.not.toHaveBeenCalledWith(jasmine.stringContaining('NG0956'));
21+
.not.toHaveBeenCalledWith(expect.stringContaining('NG0956'));
2422
});
2523

2624

projects/igniteui-angular/tree/src/tree/tree-navigation.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ describe('IgxTree - Navigation #treeView', () => {
787787
size: 0
788788
},
789789
};
790-
const mockElementRef = { nativeElement: vi.fn(), nativeElement: document.createElement('div') };
790+
const mockElementRef = { nativeElement: document.createElement('div') };
791791
const mockSelectionService = { selectNodesWithNoEvent: vi.fn(), selectMultipleNodes: vi.fn(), deselectNode: vi.fn(), selectNode: vi.fn(), register: vi.fn() };
792792

793793
TestBed.resetTestingModule();

vitest.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ export default defineConfig({
55
plugins: [angular()],
66
test: {
77
globals: true,
8-
environment: 'node',
98
setupFiles: ['src/test-setup.ts'],
109
include: ['**/*.spec.ts'],
1110
browser: {

0 commit comments

Comments
 (0)