angular-cli
angular-cli copied to clipboard
Property 'runSchematic' does not exist on type 'SchematicTestRunner'.
π Bug report
Command (mark with an x)
- [ ] new
- [x] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
- [x] schematic
Is this a regression?
Not sure
Description
These two commands:
schematics blank --schematics --name=schematics
ng build schematics
Result in this:
The angular/cli doesn't generate ,spec schematics correctly.

This fixes the error:
import { Tree } from '@angular-devkit/schematics';
import { SchematicTestRunner } from '@angular-devkit/schematics/testing';
import * as path from 'path';
const collectionPath = path.join(__dirname, '../collection.json');
describe('schematics', () => {
it('works', async() => {
const runner = new SchematicTestRunner('schematics', collectionPath);
const tree = await runner.runSchematicAsync('schematics', {}, Tree.empty());
tree.subscribe(tree=>{
console.log(tree);
expect(tree.files).toEqual([]);
});
});
});
π¬ Minimal Reproduction
schematics blank --schematics --name=schematics
ng build schematics
Creates a new schematic in current folder. Subsequent build produces this error.
π₯ Exception or Error
src/schematics/index_spec.ts:12:25 - error TS2339: Property 'runSchematic' does not exist on type 'SchematicTestRunner'.
12 const tree = runner.runSchematic('schematics', {}, Tree.empty());
π Your Environment
Angular CLI: 9.0.7
Node: 12.14.1
OS: win32 x64
Angular: 9.0.7
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes
Package Version
------------------------------------------------------------
@angular-devkit/architect 0.900.7
@angular-devkit/build-angular 0.900.7
@angular-devkit/build-ng-packagr 0.900.7
@angular-devkit/build-optimizer 0.900.7
@angular-devkit/build-webpack 0.900.7
@angular-devkit/core 9.0.7
@angular-devkit/schematics 9.0.7 <= Must exist
@ngtools/webpack 9.0.7
@schematics/angular 9.0.7
@schematics/update 0.900.7
ng-packagr 9.1.5
rxjs 6.5.5
typescript 3.7.5
webpack 4.41.2
Anything else relevant? Work around is to just change the test code as shown above..
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.