Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/cli/lib/templates/AngularTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ export class AngularTemplate implements Template {
constructor(private rootPath: string) { }

public get templatePaths(): string[] {
return [path.join(this.rootPath, "files")];
// Include common Angular files (like test.ts) before template-specific files
const commonPath = path.join(__dirname, "../../templates/angular/common-files");
return [commonPath, path.join(this.rootPath, "files")];
}

public generateConfig(name: string, options: {}): { [key: string]: any } {
Expand Down
23 changes: 23 additions & 0 deletions packages/cli/templates/angular/common-files/src/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// 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 {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';

declare const require: {
context(path: string, deep?: boolean, filter?: RegExp): {
keys(): string[];
<T>(id: string): T;
};
};

// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(), {
teardown: { destroyAfterEach: false }
}
);
4 changes: 3 additions & 1 deletion packages/igx-templates/IgniteUIForAngularTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ export class IgniteUIForAngularTemplate implements Template {
};

public get templatePaths(): string[] {
return [path.join(this.rootPath, "files")];
// Include common Angular files (like test.ts) before template-specific files
const commonPath = path.join(__dirname, "common-files");
return [commonPath, path.join(this.rootPath, "files")];
}

constructor(private rootPath: string) {
Expand Down
23 changes: 23 additions & 0 deletions packages/igx-templates/common-files/src/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// 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 {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';

declare const require: {
context(path: string, deep?: boolean, filter?: RegExp): {
keys(): string[];
<T>(id: string): T;
};
};

// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(), {
teardown: { destroyAfterEach: false }
}
);
4 changes: 3 additions & 1 deletion packages/igx-templates/igx-ts-legacy/projects/_base/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ $app-palette: palette($primary, $secondary, $surface);
"node_modules/igniteui-angular/styles/igniteui-angular.css"`;

public get templatePaths(): string[] {
return [path.join(__dirname, "files")];
// Include common Angular files (like test.ts) before template-specific files
const commonPath = path.join(__dirname, "../../../common-files");
return [commonPath, path.join(__dirname, "files")];
}

public installModules(): void {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// 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 {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';

declare const require: {
context(path: string, deep?: boolean, filter?: RegExp): {
keys(): string[];
<T>(id: string): T;
};
};

// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(), {
teardown: { destroyAfterEach: false }
}
);
4 changes: 3 additions & 1 deletion packages/igx-templates/igx-ts/projects/_base/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ $app-palette: palette($primary, $secondary, $surface);
"node_modules/igniteui-angular/styles/igniteui-angular.css"`;

public get templatePaths(): string[] {
return [path.join(__dirname, "files")];
// Include common Angular files (like test.ts) before template-specific files
const commonPath = path.join(__dirname, "../../../common-files");
return [commonPath, path.join(__dirname, "files")];
}

public installModules(): void {
Expand Down
23 changes: 23 additions & 0 deletions packages/igx-templates/igx-ts/projects/empty/files/src/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// 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 {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';

declare const require: {
context(path: string, deep?: boolean, filter?: RegExp): {
keys(): string[];
<T>(id: string): T;
};
};

// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(), {
teardown: { destroyAfterEach: false }
}
);