Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property 'runSchematic' does not exist on type 'SchematicTestRunner'. #18062

Closed
2 of 16 tasks
Javaman2 opened this issue Jun 29, 2020 · 1 comment · Fixed by #18064
Closed
2 of 16 tasks

Property 'runSchematic' does not exist on type 'SchematicTestRunner'. #18062

Javaman2 opened this issue Jun 29, 2020 · 1 comment · Fixed by #18064
Assignees
Labels
freq1: low Only reported by a handful of users who observe it rarely severity5: regression type: bug/fix
Milestone

Comments

@Javaman2
Copy link

Javaman2 commented Jun 29, 2020

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • xi18n
  • run
  • config
  • help
  • version
  • doc
  • schematic

Is this a regression?

Not sure

Description

These two commands:

schematics blank --schematics --name=schematics
ng build schematics

Result in this:
Alt Text
The angular/cli doesn't generate ,spec schematics correctly.

Alt Text

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..

@alan-agius4 alan-agius4 added comp: schematics/schematics freq1: low Only reported by a handful of users who observe it rarely severity5: regression type: bug/fix labels Jun 29, 2020
@ngbot ngbot bot added this to the Backlog milestone Jun 29, 2020
@alan-agius4 alan-agius4 self-assigned this Jun 29, 2020
filipesilva pushed a commit that referenced this issue Jun 30, 2020
…ith `runner.runSchematicAsync`

Deprecated `runSchematic` has been removed in version 10, `runSchematicAsync` should be used instead.

Closes #18062
filipesilva pushed a commit that referenced this issue Jun 30, 2020
…ith `runner.runSchematicAsync`

Deprecated `runSchematic` has been removed in version 10, `runSchematicAsync` should be used instead.

Closes #18062
villelahdenvuo pushed a commit to villelahdenvuo/angular-cli that referenced this issue Jul 6, 2020
…ith `runner.runSchematicAsync`

Deprecated `runSchematic` has been removed in version 10, `runSchematicAsync` should be used instead.

Closes angular#18062
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jul 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
freq1: low Only reported by a handful of users who observe it rarely severity5: regression type: bug/fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants