diff --git a/packages/core/update/Update.ts b/packages/core/update/Update.ts index cdac1564b..857ae561f 100644 --- a/packages/core/update/Update.ts +++ b/packages/core/update/Update.ts @@ -119,7 +119,7 @@ export async function updateWorkspace(rootPath: string): Promise { // For React and WebComponents projects without explicit workspaces, // check for common project patterns like projects/* in addition to src/ workspaces.push(path.join(rootPath, "src")); - + // Check for projects/* pattern common in React demo/example repositories // Only check if projects directory exists to avoid unnecessary glob calls const projectsDir = path.join(rootPath, "projects"); diff --git a/packages/igx-templates/igx-ts-legacy/category-chart/default/files/src/app/__path__/__filePrefix__.component.spec.ts b/packages/igx-templates/igx-ts-legacy/category-chart/default/files/src/app/__path__/__filePrefix__.component.spec.ts index 286b7463c..7d311eb4b 100644 --- a/packages/igx-templates/igx-ts-legacy/category-chart/default/files/src/app/__path__/__filePrefix__.component.spec.ts +++ b/packages/igx-templates/igx-ts-legacy/category-chart/default/files/src/app/__path__/__filePrefix__.component.spec.ts @@ -10,7 +10,8 @@ describe('<%=ClassName%>Component', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [<%=ClassName%>Component], - imports: [FormsModule, IgxCategoryChartModule] + imports: [FormsModule, IgxCategoryChartModule], + teardown: { destroyAfterEach: false } }) .compileComponents(); })); diff --git a/packages/igx-templates/igx-ts-legacy/financial-chart/default/files/src/app/__path__/__filePrefix__.component.spec.ts b/packages/igx-templates/igx-ts-legacy/financial-chart/default/files/src/app/__path__/__filePrefix__.component.spec.ts index 3335976b7..90e3fc546 100644 --- a/packages/igx-templates/igx-ts-legacy/financial-chart/default/files/src/app/__path__/__filePrefix__.component.spec.ts +++ b/packages/igx-templates/igx-ts-legacy/financial-chart/default/files/src/app/__path__/__filePrefix__.component.spec.ts @@ -9,7 +9,8 @@ describe('<%=ClassName%>Component', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [<%=ClassName%>Component], - imports: [IgxFinancialChartModule] + imports: [IgxFinancialChartModule], + teardown: { destroyAfterEach: false } }) .compileComponents(); })); diff --git a/packages/igx-templates/igx-ts-legacy/projects/_base/files/angular.json b/packages/igx-templates/igx-ts-legacy/projects/_base/files/angular.json index 9333b9e45..c47b4dbcf 100644 --- a/packages/igx-templates/igx-ts-legacy/projects/_base/files/angular.json +++ b/packages/igx-templates/igx-ts-legacy/projects/_base/files/angular.json @@ -94,8 +94,10 @@ "test": { "builder": "@angular-devkit/build-angular:karma", "options": { - "main": "src/test.ts", - "polyfills": "src/polyfills.ts", + "polyfills": [ + "zone.js", + "zone.js/testing" + ], "tsConfig": "tsconfig.spec.json", "inlineStyleLanguage": "scss", "styles": [ diff --git a/packages/igx-templates/igx-ts-legacy/projects/_base/files/src/test.ts b/packages/igx-templates/igx-ts-legacy/projects/_base/files/src/test.ts deleted file mode 100644 index c07a42ef2..000000000 --- a/packages/igx-templates/igx-ts-legacy/projects/_base/files/src/test.ts +++ /dev/null @@ -1,13 +0,0 @@ -// This file is required by karma.conf.js and loads recursively all the .spec and framework files - -import 'zone.js/testing'; -import { getTestBed } from '@angular/core/testing'; -import { BrowserTestingModule, platformBrowserTesting } from '@angular/platform-browser/testing'; - -// First, initialize the Angular testing environment. -getTestBed().initTestEnvironment( - BrowserTestingModule, - platformBrowserTesting(), { - teardown: { destroyAfterEach: false } - } -); diff --git a/packages/igx-templates/igx-ts-legacy/projects/_base/files/tsconfig.spec.json b/packages/igx-templates/igx-ts-legacy/projects/_base/files/tsconfig.spec.json index 092345b02..b841681aa 100644 --- a/packages/igx-templates/igx-ts-legacy/projects/_base/files/tsconfig.spec.json +++ b/packages/igx-templates/igx-ts-legacy/projects/_base/files/tsconfig.spec.json @@ -8,7 +8,6 @@ ] }, "files": [ - "src/test.ts", "src/polyfills.ts" ], "include": [ diff --git a/packages/igx-templates/igx-ts-legacy/projects/side-nav-auth/files/tsconfig.spec.json b/packages/igx-templates/igx-ts-legacy/projects/side-nav-auth/files/tsconfig.spec.json index b058083bc..92c4c685a 100644 --- a/packages/igx-templates/igx-ts-legacy/projects/side-nav-auth/files/tsconfig.spec.json +++ b/packages/igx-templates/igx-ts-legacy/projects/side-nav-auth/files/tsconfig.spec.json @@ -11,7 +11,6 @@ "module": "commonjs" }, "files": [ - "src/test.ts", "src/polyfills.ts" ], "include": [ diff --git a/packages/igx-templates/igx-ts/category-chart/default/files/src/app/__path__/__filePrefix__.component.spec.ts b/packages/igx-templates/igx-ts/category-chart/default/files/src/app/__path__/__filePrefix__.component.spec.ts index 0925f3a73..f4b7497b5 100644 --- a/packages/igx-templates/igx-ts/category-chart/default/files/src/app/__path__/__filePrefix__.component.spec.ts +++ b/packages/igx-templates/igx-ts/category-chart/default/files/src/app/__path__/__filePrefix__.component.spec.ts @@ -9,7 +9,8 @@ describe('<%=ClassName%>Component', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [FormsModule, IgxCategoryChartModule, <%=ClassName%>Component] + imports: [FormsModule, IgxCategoryChartModule, <%=ClassName%>Component], + teardown: { destroyAfterEach: false } }) .compileComponents(); })); diff --git a/packages/igx-templates/igx-ts/financial-chart/default/files/src/app/__path__/__filePrefix__.component.spec.ts b/packages/igx-templates/igx-ts/financial-chart/default/files/src/app/__path__/__filePrefix__.component.spec.ts index edc0ea4fe..31dc844f5 100644 --- a/packages/igx-templates/igx-ts/financial-chart/default/files/src/app/__path__/__filePrefix__.component.spec.ts +++ b/packages/igx-templates/igx-ts/financial-chart/default/files/src/app/__path__/__filePrefix__.component.spec.ts @@ -8,7 +8,8 @@ describe('<%=ClassName%>Component', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [IgxFinancialChartModule, <%=ClassName%>Component] + imports: [IgxFinancialChartModule, <%=ClassName%>Component], + teardown: { destroyAfterEach: false } }) .compileComponents(); })); diff --git a/packages/igx-templates/igx-ts/linear-gauge/default/files/src/app/__path__/__filePrefix__.component.spec.ts b/packages/igx-templates/igx-ts/linear-gauge/default/files/src/app/__path__/__filePrefix__.component.spec.ts index a35a19dd1..3af2f8ea1 100644 --- a/packages/igx-templates/igx-ts/linear-gauge/default/files/src/app/__path__/__filePrefix__.component.spec.ts +++ b/packages/igx-templates/igx-ts/linear-gauge/default/files/src/app/__path__/__filePrefix__.component.spec.ts @@ -9,7 +9,7 @@ describe('<%=ClassName%>Component', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [IgxLinearGaugeModule, NoopAnimationsModule, <%=ClassName%>Componen] + imports: [IgxLinearGaugeModule, NoopAnimationsModule, <%=ClassName%>Component] }) .compileComponents(); })); diff --git a/packages/igx-templates/igx-ts/projects/_base/files/angular.json b/packages/igx-templates/igx-ts/projects/_base/files/angular.json index 0cf83fe77..1feede70d 100644 --- a/packages/igx-templates/igx-ts/projects/_base/files/angular.json +++ b/packages/igx-templates/igx-ts/projects/_base/files/angular.json @@ -86,7 +86,6 @@ "test": { "builder": "@angular-devkit/build-angular:karma", "options": { - "main": "src/test.ts", "polyfills": [ "zone.js", "zone.js/testing" diff --git a/packages/igx-templates/igx-ts/projects/_base/files/src/test.ts b/packages/igx-templates/igx-ts/projects/_base/files/src/test.ts deleted file mode 100644 index c07a42ef2..000000000 --- a/packages/igx-templates/igx-ts/projects/_base/files/src/test.ts +++ /dev/null @@ -1,13 +0,0 @@ -// This file is required by karma.conf.js and loads recursively all the .spec and framework files - -import 'zone.js/testing'; -import { getTestBed } from '@angular/core/testing'; -import { BrowserTestingModule, platformBrowserTesting } from '@angular/platform-browser/testing'; - -// First, initialize the Angular testing environment. -getTestBed().initTestEnvironment( - BrowserTestingModule, - platformBrowserTesting(), { - teardown: { destroyAfterEach: false } - } -); diff --git a/packages/igx-templates/igx-ts/projects/_base/files/tsconfig.spec.json b/packages/igx-templates/igx-ts/projects/_base/files/tsconfig.spec.json index 61c1bb357..be7e9da76 100644 --- a/packages/igx-templates/igx-ts/projects/_base/files/tsconfig.spec.json +++ b/packages/igx-templates/igx-ts/projects/_base/files/tsconfig.spec.json @@ -7,9 +7,6 @@ "jasmine" ] }, - "files": [ - "src/test.ts" - ], "include": [ "src/**/*.spec.ts", "src/**/*.d.ts" diff --git a/packages/igx-templates/igx-ts/projects/side-nav-auth/files/tsconfig.spec.json b/packages/igx-templates/igx-ts/projects/side-nav-auth/files/tsconfig.spec.json index b058083bc..92c4c685a 100644 --- a/packages/igx-templates/igx-ts/projects/side-nav-auth/files/tsconfig.spec.json +++ b/packages/igx-templates/igx-ts/projects/side-nav-auth/files/tsconfig.spec.json @@ -11,7 +11,6 @@ "module": "commonjs" }, "files": [ - "src/test.ts", "src/polyfills.ts" ], "include": [ diff --git a/spec/unit/packageManager-spec.ts b/spec/unit/packageManager-spec.ts index f650e4fcd..86f2f3c0b 100644 --- a/spec/unit/packageManager-spec.ts +++ b/spec/unit/packageManager-spec.ts @@ -479,35 +479,35 @@ describe("Unit - Package Manager", () => { // spyOn(require("module"), "_load").and.returnValue(mockRequire); spyOn(Util, "log"); spyOn(App.container, "get").and.returnValue(mockFs); - + const createMockChild = (exitCode: number, stdoutData: string, stderrData: string) => { const mockChild = { stdout: { on: jasmine.createSpy() }, stderr: { on: jasmine.createSpy() }, on: jasmine.createSpy() }; - + // Setup stdout data handler mockChild.stdout.on.and.callFake((event: string, handler: any) => { if (event === 'data') { setTimeout(() => handler(Buffer.from(stdoutData)), 10); } }); - + // Setup stderr data handler mockChild.stderr.on.and.callFake((event: string, handler: any) => { if (event === 'data') { setTimeout(() => handler(Buffer.from(stderrData)), 10); } }); - + // Setup close handler mockChild.on.and.callFake((event: string, handler: any) => { if (event === 'close') { setTimeout(() => handler(exitCode), 20); } }); - + return mockChild; }; diff --git a/spec/unit/update-spec.ts b/spec/unit/update-spec.ts index 254a8de46..e9dd73928 100644 --- a/spec/unit/update-spec.ts +++ b/spec/unit/update-spec.ts @@ -804,7 +804,7 @@ export default function Home() { (fsSpy.directoryExists as jasmine.Spy).and.callFake((dirPath: string) => { return dirPath.includes("projects/charts") || dirPath.includes("projects") || dirPath.endsWith("/src"); }); - + // Mock glob to simulate finding workspace directories and files (fsSpy.glob as jasmine.Spy).and.callFake((dirPath: string, pattern: string) => { if (pattern === "projects/*") { @@ -826,7 +826,7 @@ export default function Home() { } return []; }); - + (fsSpy.readFile as jasmine.Spy).and.callFake((filePath: string) => { if (filePath.indexOf("package.json") < 0) { return; @@ -842,7 +842,7 @@ export default function Home() { for (const fileEntry of mockFileArray) { expect((fsSpy.writeFile as jasmine.Spy)).toHaveBeenCalledWith(fileEntry.path, fileEntry.expected); } - // Expect: 1 for projects/*, 1 for package.json files at root, 1 for logic files, 1 for style files, 1 for package.json in workspace, 1 for vite.config.ts + // Expect: 1 for projects/*, 1 for package.json files at root, 1 for logic files, 1 for style files, 1 for package.json in workspace, 1 for vite.config.ts expect(fsSpy.glob).toHaveBeenCalledTimes(7); }); @@ -996,7 +996,7 @@ export const GridComponent = () => { (fsSpy.directoryExists as jasmine.Spy).and.callFake((dirPath: string) => { return dirPath === "projects" || dirPath.endsWith("/projects") || dirPath.includes("projects/") || dirPath === "src" || dirPath.endsWith("/src"); }); - + // Mock glob to simulate finding projects directories and files (fsSpy.glob as jasmine.Spy).and.callFake((dirPath: string, pattern: string) => { if (pattern === "package.json") { @@ -1021,7 +1021,7 @@ export const GridComponent = () => { } return []; }); - + (fsSpy.readFile as jasmine.Spy).and.callFake((filePath: string) => { if (filePath.indexOf("package.json") > -1) { return mockFileArray.find(entry => entry.path === "package.json").content;