Skip to content

Commit be3b98c

Browse files
committed
refactor(schematics): references, ignore some spy typing, test script
1 parent 6339a71 commit be3b98c

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"test:lib": "ng test igniteui-angular --watch=false --no-progress --code-coverage",
1212
"test:lib:azure": "ng test igniteui-angular --watch=false --no-progress --code-coverage --karma-config=./projects/igniteui-angular/karma.azure.conf.js",
1313
"test:lib:watch": "ng test igniteui-angular",
14-
"test:schematics": "node -r ts-node/register ./node_modules/jasmine/bin/jasmine.js ./projects/igniteui-angular/migrations/**/*.spec.ts ./projects/igniteui-angular/schematics/**/*.spec.ts",
14+
"test:schematics": "ts-node --project projects/igniteui-angular/migrations/tsconfig.json ./node_modules/jasmine/bin/jasmine.js ./projects/igniteui-angular/migrations/**/*.spec.ts ./projects/igniteui-angular/schematics/**/*.spec.ts",
1515
"build:lib": "ng build igniteui-angular --prod && gulp build-style",
1616
"build:style": "gulp build-style",
1717
"build:migration": "gulp copy-migrations && tsc --listEmittedFiles --project ./projects/igniteui-angular/migrations/tsconfig.json",

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

+7-7
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ describe('UpdateChanges', () => {
119119
}
120120
return false;
121121
});
122-
spyOn(fs, 'readFileSync').and.callFake(() => JSON.stringify(outputJson));
122+
spyOn<any>(fs, 'readFileSync').and.callFake(() => JSON.stringify(outputJson));
123123

124124
const fileContent = `<one (onReplaceMe)="a"> <comp\r\ntag (onReplaceMe)="dwdw" (onOld)=""> </other> <another (onOld)="b" />`;
125125
appTree.create('test.component.html', fileContent);
@@ -163,7 +163,7 @@ describe('UpdateChanges', () => {
163163
}
164164
return false;
165165
});
166-
spyOn(fs, 'readFileSync').and.callFake(() => JSON.stringify(inputJson));
166+
spyOn<any>(fs, 'readFileSync').and.callFake(() => JSON.stringify(inputJson));
167167

168168
const fileContent = `<one [replaceMe]="a"> <comp\r\ntag [replaceMe]="dwdw" [oldProp]=''> </other> <another oldProp="b" />`;
169169
appTree.create('test.component.html', fileContent);
@@ -224,7 +224,7 @@ describe('UpdateChanges', () => {
224224
}
225225
return false;
226226
});
227-
spyOn(fs, 'readFileSync').and.callFake(() => JSON.stringify(classJson));
227+
spyOn<any>(fs, 'readFileSync').and.callFake(() => JSON.stringify(classJson));
228228

229229
const fileContent = `import { igxClass } from ""; export class Test { prop: igxClass; prop2: igxClass2; }`;
230230
appTree.create('test.component.ts', fileContent);
@@ -264,7 +264,7 @@ describe('UpdateChanges', () => {
264264
}
265265
return false;
266266
});
267-
spyOn(fs, 'readFileSync').and.callFake(() => JSON.stringify(classJson));
267+
spyOn<any>(fs, 'readFileSync').and.callFake(() => JSON.stringify(classJson));
268268

269269
const fileContent =
270270
`import { Component, Injectable, ViewChild } from "@angular/core";` +
@@ -356,7 +356,7 @@ describe('UpdateChanges', () => {
356356
}
357357
return false;
358358
});
359-
spyOn(fs, 'readFileSync').and.callFake(() => JSON.stringify(inputJson));
359+
spyOn<any>(fs, 'readFileSync').and.callFake(() => JSON.stringify(inputJson));
360360

361361
const fileContent = `<igx-icon fontSet='material' name='phone'></igx-icon>
362362
<igx-icon fontSet="material-icons" name="build"></igx-icon>
@@ -411,7 +411,7 @@ describe('UpdateChanges', () => {
411411
}
412412
return false;
413413
});
414-
spyOn(fs, 'readFileSync').and.callFake(() => JSON.stringify(themePropsJson));
414+
spyOn<any>(fs, 'readFileSync').and.callFake(() => JSON.stringify(themePropsJson));
415415

416416
const fileContent =
417417
`$var: igx-theme-func(
@@ -477,7 +477,7 @@ $var3: igx-comp-theme(
477477
}
478478
return false;
479479
});
480-
spyOn(fs, 'readFileSync').and.callFake(() => JSON.stringify(importsJson));
480+
spyOn<any>(fs, 'readFileSync').and.callFake(() => JSON.stringify(importsJson));
481481

482482
const fileContent = `
483483
@NgModule({

projects/igniteui-angular/schematics/ng-add/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { logSuccess, addDependencies, overwriteJsonFile, getPropertyFromWorkspac
66
import * as os from 'os';
77
import { addResetCss } from './add-normalize';
88
import { getWorkspace } from '@schematics/angular/utility/config';
9-
import { WorkspaceSchema } from '@angular-devkit/core/src/workspace';
9+
import { WorkspaceSchema } from '@schematics/angular/utility/workspace-models';
1010

1111
/**
1212
* ES7 `Object.entries` needed for igxGrid to render in IE.

projects/igniteui-angular/schematics/utils/dependency-handler.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { SchematicContext, Rule, SchematicsException } from '@angular-devkit/schematics';
2-
import { WorkspaceSchema } from '@angular-devkit/core/src/workspace';
32
import { Tree } from '@angular-devkit/schematics/src/tree/interface';
43
import { getWorkspace } from '@schematics/angular/utility/config';
54
import { Options } from '../interfaces/options';
6-
import { WorkspaceProject, ProjectType } from '@schematics/angular/utility/workspace-models';
5+
import { WorkspaceProject, ProjectType, WorkspaceSchema } from '@schematics/angular/utility/workspace-models';
76

87
function logIncludingDependency(context: SchematicContext, pkg: string, version: string): void {
98
context.logger.info(`Including ${pkg} - Version: ${version}`);

0 commit comments

Comments
 (0)