-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
Feature Request: Replace Angular Testbed based spec schematics #6293
Comments
Curious on this, would the schematics be placed in the project layout, I assume under ng-mocks/libs/ng-mocks/schematics? |
Hi @JsantosDK, right, |
What schematics exactly should be done?
Note that doing schematics may also introduce incompatibly between old versions. |
Hello @satanTime, since you are busy, I will try to develop this feature myself. For now, I will work on building PR that adds a schematic for components so that instead of generation this: import { ComponentFixture, TestBed } from '@angular/core/testing';
import { FooComponent } from './foo.component';
describe('FooComponent', () => {
let component: FooComponent;
let fixture: ComponentFixture<FooComponent>;
beforeEach(() => {
TestBed.configureTestingModule({
imports: [FooComponent]
});
fixture = TestBed.createComponent(FooComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
}); We generate this: import { MockedComponentFixture, MockBuilder, MockRender } from 'ng-mocks';
import { FooComponent } from './foo.component';
describe('FooComponent', () => {
let component: FooComponent;
let fixture: MockedComponentFixture<FooComponent>;
beforeEach(() => {
return MockBuilder(FooComponent)
});
it('should create', () => {
fixture = MockRender(FooComponent);
component = fixture.point.componentInstance;
expect(component).toBeTruthy();
});
}); I will try to add more options to this if it proves to be something that is used. |
Describe the feature or problem you'd like to solve
My fingers hurt from having to replace the default code in every spec with some initial code for testing with NgMocks.
Proposed solution
Add a new library project called schematics created using @angular-devkit/schematics-cli.
Additional context
The text was updated successfully, but these errors were encountered: