diff --git a/.lintstagedrc.js b/.lintstagedrc.js index 9e7ecbe38a..2fd17c5fa5 100644 --- a/.lintstagedrc.js +++ b/.lintstagedrc.js @@ -26,11 +26,7 @@ module.exports = { const filesForLint = filenames .map(file => path.relative(cwd, file)) - .filter(file => !file.match(/\.spec\.ts$/i)) - .filter(file => !file.match(/\.fixtures\.ts$/i)) .filter(file => !file.match(/^e2e\//i)) - .filter(file => !file.match(/^examples\//i)) - .filter(file => !file.match(/^tests\//i)) .map(file => `'${file}'`); if (filesForLint.length) { diff --git a/.prettierrc.yml b/.prettierrc.yml index 8a33546a6a..f0f76624e2 100644 --- a/.prettierrc.yml +++ b/.prettierrc.yml @@ -1,9 +1,15 @@ +arrowParens: 'avoid' bracketSpacing: true -semi: true +endOfLine: 'lf' +jsxBracketSameLine: false +jsxSingleQuote: true printWidth: 120 +proseWrap: 'preserve' +semi: true singleQuote: true -arrowParens: 'avoid' -trailingComma: 'es5' +tabWidth: 2 +trailingComma: 'all' +useTabs: false overrides: - files: 'README.md' options: diff --git a/README.md b/README.md index fd99277455..029f8a6877 100644 --- a/README.md +++ b/README.md @@ -236,8 +236,8 @@ parameter. TestBed.configureTestingModule( ngMocks.guts( AppBaseComponent, // <- is not touched - [AppBaseModule, AppModule] - ) + [AppBaseModule, AppModule], + ), ); ``` @@ -259,7 +259,7 @@ beforeEach(() => .mock(TranslatePipe, v => `translated:${v}`) .mock(SearchService, { search: of([]), - }) + }), ); ``` @@ -361,7 +361,7 @@ and [`MockRender`](#mockrender): ```typescript describe('Test', () => { beforeEach(() => - MockBuilder(TargetComponent).mock(DependencyComponent) + MockBuilder(TargetComponent).mock(DependencyComponent), ); it('should create', () => { @@ -383,7 +383,7 @@ to play with. ```typescript describe('MockComponent', () => { beforeEach(() => - MockBuilder(TestedComponent).mock(DependencyComponent) + MockBuilder(TestedComponent).mock(DependencyComponent), ); it('sends the correct value to the child input', () => { @@ -397,7 +397,7 @@ describe('MockComponent', () => { // but properly typed. const mockComponent = ngMocks.find( fixture, - 'app-child' + 'app-child', ).componentInstance; // Let's pretend that DependencyComponent has 'someInput' as @@ -478,7 +478,7 @@ describe('MockComponent', () => { // We can use this selector to assert exactly its content. const mockNgTemplate = ngMocks.find( fixture.debugElement, - '[data-key="something"]' + '[data-key="something"]', ).nativeElement.innerHTML; expect(mockNgTemplate).toContain('

inside template

'); }); @@ -552,7 +552,7 @@ and [`MockRender`](#mockrender): ```typescript describe('Test', () => { beforeEach(() => - MockBuilder(TargetComponent).mock(DependencyDirective) + MockBuilder(TargetComponent).mock(DependencyDirective), ); it('should create', () => { @@ -574,7 +574,7 @@ to play with. ```typescript describe('MockDirective:Attribute', () => { beforeEach(() => - MockBuilder(TestedComponent).mock(DependencyDirective) + MockBuilder(TestedComponent).mock(DependencyDirective), ); it('sends the correct value to the input', () => { @@ -588,7 +588,7 @@ describe('MockDirective:Attribute', () => { // but easier and more precise. const mockDirective = ngMocks.get( ngMocks.find(fixture.debugElement, 'span'), - DependencyDirective + DependencyDirective, ); // Let's pretend DependencyDirective has 'someInput' @@ -613,7 +613,7 @@ describe('MockDirective:Attribute', () => { // but easier and more precise. const mockDirective = ngMocks.get( ngMocks.find(fixture.debugElement, 'span'), - DependencyDirective + DependencyDirective, ); // Again, let's pretend DependencyDirective has an output called @@ -653,7 +653,7 @@ describe('MockDirective:Structural', () => { beforeEach(() => MockBuilder(TestedComponent).mock(DependencyDirective, { // render: true, // <-- a flag to render the directive by default - }) + }), ); it('renders content of the child structural directive', () => { @@ -662,13 +662,13 @@ describe('MockDirective:Structural', () => { // Let's assert that nothing has been rendered inside of // the structural directive by default. expect( - fixture.debugElement.nativeElement.innerHTML + fixture.debugElement.nativeElement.innerHTML, ).not.toContain('>content<'); // And let's render it manually now. const mockDirective = ngMocks.findInstance( fixture.debugElement, - DependencyDirective + DependencyDirective, ); if (isMockOf(mockDirective, DependencyDirective, 'd')) { mockDirective.__render(); @@ -677,7 +677,7 @@ describe('MockDirective:Structural', () => { // The content of the structural directive should be rendered. expect(fixture.debugElement.nativeElement.innerHTML).toContain( - '>content<' + '>content<', ); }); }); @@ -768,8 +768,8 @@ describe('MockPipe', () => { beforeEach(() => MockBuilder(TestedComponent).mock( DependencyPipe, - (...args: string[]) => JSON.stringify(args) - ) + (...args: string[]) => JSON.stringify(args), + ), ); it('transforms values to json', () => { @@ -903,7 +903,7 @@ describe('Test', () => { .mock(ObservableService, { prop$: EMPTY, getStream$: () => EMPTY, - }) + }), ); it('should create', () => { @@ -934,7 +934,7 @@ describe('MockProvider', () => { MockProvider(DependencyService), MockProvider(DEPENDENCY_TOKEN, 'mock token'), ], - }).compileComponents() + }).compileComponents(), ); it('uses mock providers', () => { @@ -1018,7 +1018,7 @@ and [`MockRender`](#mockrender): ```typescript describe('Test', () => { beforeEach(() => - MockBuilder(TargetComponent).mock(DependencyModule) + MockBuilder(TargetComponent).mock(DependencyModule), ); it('should create', () => { @@ -1048,7 +1048,7 @@ to play with. ```typescript describe('MockModule', () => { beforeEach(() => - MockBuilder(TestedComponent).mock(DependencyModule) + MockBuilder(TestedComponent).mock(DependencyModule), ); it('renders TestedComponent with its dependencies', () => { @@ -1160,7 +1160,7 @@ beforeEach(() => { return MockBuilder(TodoComponent).mock( TodoService, - todoServiceMock + todoServiceMock, ); }); @@ -1198,7 +1198,7 @@ describe('MockObservable', () => { MockInstance(TargetService, instance => ngMocks.stub(instance, { value$, // even it is a read-only property we can override. - }) + }), ); }); @@ -1269,7 +1269,7 @@ describe('MockReactiveForms', () => { beforeEach(() => MockBuilder(TestedComponent) .mock(DependencyComponent) - .keep(ReactiveFormsModule) + .keep(ReactiveFormsModule), ); it('sends the correct value to the mock form component', () => { @@ -1279,7 +1279,7 @@ describe('MockReactiveForms', () => { // Let's find the mock form component. const mockControl = ngMocks.find( fixture.debugElement, - DependencyComponent + DependencyComponent, ).componentInstance; // Let's simulate its change, like a user does it. @@ -1314,7 +1314,7 @@ describe('MockForms', () => { beforeEach(() => MockBuilder(TestedComponent) .mock(DependencyComponent) - .keep(FormsModule) + .keep(FormsModule), ); it('sends the correct value to the mock form component', async () => { @@ -1324,7 +1324,7 @@ describe('MockForms', () => { // Let's find the mock form component. const mockControl = ngMocks.find( fixture.debugElement, - DependencyComponent + DependencyComponent, ).componentInstance; // Let's simulate its change, like a user does it. @@ -1518,7 +1518,7 @@ describe('MAIN', () => { fixture.componentInstance.title = 'Updated Application'; fixture.detectChanges(); expect(header.componentInstance.title).toBe( - 'Updated Application' + 'Updated Application', ); // Checking that AppComponent listens on outputs of @@ -1619,7 +1619,7 @@ describe('MockBuilder:simple', () => { const fixture = MockRender(MyComponent); expect(fixture).toBeDefined(); expect(fixture.debugElement.nativeElement.innerHTML).toContain( - '
My Content
' + '
My Content
', ); }); }); @@ -1691,7 +1691,7 @@ beforeEach(() => .keep(SomeDirective) .keep(SomePipe) .keep(SomeService) - .keep(SomeInjectionToken) + .keep(SomeInjectionToken), ); ``` @@ -1709,7 +1709,7 @@ beforeEach(() => .mock(SomeDirective) .mock(SomePipe) .mock(SomeService) - .mock(SomeInjectionToken) + .mock(SomeInjectionToken), ); ``` @@ -1719,8 +1719,8 @@ For pipes, we can set their handlers as the 2nd parameter of `.mock`. beforeEach(() => MockBuilder(MyComponent, MyModule).mock( SomePipe, - value => 'My Custom Content' - ) + value => 'My Custom Content', + ), ); ``` @@ -1731,7 +1731,7 @@ They are added as `useValue` in providers. beforeEach(() => MockBuilder(MyComponent, MyModule) .mock(SomeService3, anything1) - .mock(SOME_TOKEN, anything2) + .mock(SOME_TOKEN, anything2), ); ``` @@ -1747,7 +1747,7 @@ beforeEach(() => .exclude(SomeDirective) .exclude(SomePipe) .exclude(SomeDependency) - .exclude(SomeInjectionToken) + .exclude(SomeInjectionToken), ); ``` @@ -1763,7 +1763,7 @@ beforeEach(() => .replace(SomeModule, SomeOtherModule) .replace(SomeComponent, SomeOtherComponent) .replace(SomeDirective, SomeOtherDirective) - .replace(SomePipe, SomeOtherPipe) + .replace(SomePipe, SomeOtherPipe), ); ``` @@ -1773,8 +1773,8 @@ In case of `HttpClientTestingModule` you can use `.replace` too. beforeEach(() => MockBuilder(MyComponent, MyModule).replace( HttpClientModule, - HttpClientTestingModule - ) + HttpClientTestingModule, + ), ); ``` @@ -1784,7 +1784,7 @@ In case of `RouterTestingModule` you need to use [`.keep`](#mockbuilderkeep) for beforeEach(() => MockBuilder(MyComponent, MyModule) .keep(RouterModule) - .keep(RouterTestingModule.withRoutes([])) + .keep(RouterTestingModule.withRoutes([])), ); ``` @@ -1798,7 +1798,7 @@ beforeEach(() => .provide(MyService) .provide([SomeService1, SomeService2]) .provide({ provide: SomeComponent3, useValue: anything1 }) - .provide({ provide: SOME_TOKEN, useFactory: () => anything2 }) + .provide({ provide: SOME_TOKEN, useFactory: () => anything2 }), ); ``` @@ -1816,7 +1816,7 @@ beforeEach(() => }) .mock(SomeDeclaration2, { export: true, - }) + }), ); ``` @@ -1835,7 +1835,7 @@ beforeEach(() => .mock(MyNestedModule, { exportAll: true, export: true, - }) + }), ); ``` @@ -1867,7 +1867,7 @@ beforeEach(() => }) .replace(SomeModuleComponentDirectivePipeProvider1, anything1, { dependency: true, - }) + }), ); ``` @@ -1879,7 +1879,7 @@ If we want to render a structural directive by default. Now we can do that via a beforeEach(() => MockBuilder(MyComponent, MyModule).mock(MyDirective, { render: true, - }) + }), ); ``` @@ -1892,7 +1892,7 @@ beforeEach(() => $implicit: something1, variables: { something2: something3 }, }, - }) + }), ); ``` @@ -1908,7 +1908,7 @@ beforeEach(() => variables: { something2: something3 }, }, }, - }) + }), ); ``` @@ -1919,7 +1919,7 @@ The answer is to exclude `NG_MOCKS_GUARDS` token, it will **remove all the guard ```typescript beforeEach(() => - MockBuilder(MyGuard, MyModule).exclude(NG_MOCKS_GUARDS) + MockBuilder(MyGuard, MyModule).exclude(NG_MOCKS_GUARDS), ); ``` @@ -1931,7 +1931,7 @@ then all interceptors will be excluded except the explicitly configured ones. ```typescript beforeEach(() => - MockBuilder(MyInterceptor, MyModule).exclude(NG_MOCKS_INTERCEPTORS) + MockBuilder(MyInterceptor, MyModule).exclude(NG_MOCKS_INTERCEPTORS), ); ``` @@ -1947,8 +1947,8 @@ we need to pass `NG_MOCKS_ROOT_PROVIDERS` token into [`.mock`](#mockbuildermock) beforeEach(() => MockBuilder( MyComponentWithRootServices, - MyModuleWithRootTokens - ).mock(NG_MOCKS_ROOT_PROVIDERS) + MyModuleWithRootTokens, + ).mock(NG_MOCKS_ROOT_PROVIDERS), ); ``` @@ -1959,8 +1959,8 @@ For that, we need to keep `NG_MOCKS_ROOT_PROVIDERS` token. beforeEach(() => MockBuilder( MyComponentWithRootServices, - MyModuleWithRootTokens - ).keep(NG_MOCKS_ROOT_PROVIDERS) + MyModuleWithRootTokens, + ).keep(NG_MOCKS_ROOT_PROVIDERS), ); ``` @@ -1978,7 +1978,7 @@ beforeEach(() => .keep(SomeModule) .mock(SomeModule) .keep(SomeModule) - .mock(SomeModule) + .mock(SomeModule), ); ``` @@ -2036,7 +2036,7 @@ const fixture = MockRender( useValue: MockService(Document), }, ], - } + }, ); ``` @@ -2076,13 +2076,13 @@ describe('MockRender', () => { { myListener1: spy, myParam1: 'something1', - } + }, ); // ngMocks.input helps to get the current value of an input on // a related debugElement without knowing its owner. expect(ngMocks.input(fixture.point, 'value1')).toEqual( - 'something1' + 'something1', ); expect(ngMocks.input(fixture.point, 'value2')).toEqual('check'); @@ -2103,7 +2103,7 @@ describe('MockRender', () => { // Checking the inputs. expect(ngMocks.input(fixture.point, 'value1')).toEqual( - 'something2' + 'something2', ); expect(ngMocks.input(fixture.point, 'value2')).toBeUndefined(); @@ -2194,8 +2194,8 @@ beforeAll(() => }); // if you want you can use injector.get(SomeService) for more // complicated customization. - } - ) + }, + ), ); ``` @@ -2253,7 +2253,7 @@ describe('MockInstance', () => { // Without the custom initialization rendering would fail here // with "Cannot read property 'subscribe' of undefined". expect(() => MockRender(RealComponent)).not.toThrowError( - /Cannot read property 'subscribe' of undefined/ + /Cannot read property 'subscribe' of undefined/, ); }); }); @@ -2306,7 +2306,7 @@ const ngModuleMeta = ngMocks.guts(Component, ItsModule); const ngModuleMeta = ngMocks.guts( [Component1, Component2, Service3], [ModuleToMock, DirectiveToMock, WhateverToMock], - [ServiceToExclude, DirectiveToExclude] + [ServiceToExclude, DirectiveToExclude], ); ``` @@ -2314,7 +2314,7 @@ const ngModuleMeta = ngMocks.guts( const ngModuleMeta = ngMocks.guts( null, ModuleToMock, - ComponentToExclude + ComponentToExclude, ); ``` @@ -2341,7 +2341,7 @@ const directive1 = ngMocks.findInstance(Directive1); const directive2 = ngMocks.findInstance(fixture, Directive2); const directive3 = ngMocks.findInstance( fixture.debugElement, - Directive3 + Directive3, ); ``` @@ -2358,7 +2358,7 @@ const directives1 = ngMocks.findInstances(Directive1); const directives2 = ngMocks.findInstances(fixture, Directive2); const directives3 = ngMocks.findInstances( fixture.debugElement, - Directive3 + Directive3, ); ``` @@ -2621,7 +2621,7 @@ describe('performance:correct', () => { // The TestBed is not going to be changed between tests. beforeEach(() => - MockBuilder(TargetComponent, TargetModule).keep(TargetService) + MockBuilder(TargetComponent, TargetModule).keep(TargetService), ); it('...', () => { @@ -2700,7 +2700,7 @@ describe('beforeEach:manual-spy', () => { // A normal setup of the TestBed, TargetService will be replaced // with its mock copy. beforeEach(() => - MockBuilder(TargetComponent).mock(TargetService, mock) + MockBuilder(TargetComponent).mock(TargetService, mock), ); }); ``` diff --git a/e2e/a10/src/test.ts b/e2e/a10/src/test.ts index e8320e6b92..9122fed143 100644 --- a/e2e/a10/src/test.ts +++ b/e2e/a10/src/test.ts @@ -9,7 +9,7 @@ declare const require: { context( path: string, deep?: boolean, - filter?: RegExp + filter?: RegExp, ): { keys(): string[]; (id: string): T; diff --git a/e2e/a11/src/test.ts b/e2e/a11/src/test.ts index e8320e6b92..9122fed143 100644 --- a/e2e/a11/src/test.ts +++ b/e2e/a11/src/test.ts @@ -9,7 +9,7 @@ declare const require: { context( path: string, deep?: boolean, - filter?: RegExp + filter?: RegExp, ): { keys(): string[]; (id: string): T; diff --git a/e2e/a9/src/test.ts b/e2e/a9/src/test.ts index e8320e6b92..9122fed143 100644 --- a/e2e/a9/src/test.ts +++ b/e2e/a9/src/test.ts @@ -9,7 +9,7 @@ declare const require: { context( path: string, deep?: boolean, - filter?: RegExp + filter?: RegExp, ): { keys(): string[]; (id: string): T; diff --git a/examples/MAIN/test.spec.ts b/examples/MAIN/test.spec.ts index c3118ffb12..9cd48408cf 100644 --- a/examples/MAIN/test.spec.ts +++ b/examples/MAIN/test.spec.ts @@ -1,3 +1,5 @@ +// tslint:disable:arrow-return-shorthand + import { CommonModule } from '@angular/common'; import { Component, ContentChild, ElementRef, EventEmitter, Input, NgModule, Output, TemplateRef } from '@angular/core'; import { RouterModule } from '@angular/router'; @@ -19,9 +21,8 @@ import { MockBuilder, MockRender, ngMocks } from 'ng-mocks'; `, }) class AppComponent { - @Input() public title = 'My Application'; - @Output() public logoClick = new EventEmitter(); + @Input() public title = 'My Application'; } // A dependency component out of which we want to create a mock @@ -35,13 +36,12 @@ class AppComponent { `, }) class AppHeaderComponent { - @Input() public showLogo: boolean; - @Input() public title: string; - @Output() public logo: EventEmitter; @ContentChild('menu', { read: false } as any) public menu: TemplateRef; + @Input() public showLogo: boolean; + @Input() public title: string; } // The module where our components are declared. @@ -113,8 +113,8 @@ describe('MAIN', () => { // Instead of TestBed.createComponent(AppComponent) in beforeEach // MockRender might be used directly in tests. const fixture = MockRender(AppComponent, { - title: 'Fake Application', logoClick: logoClickSpy, + title: 'Fake Application', }); // It creates a helper component // with the next template: diff --git a/examples/MockBuilder/fixtures.components.ts b/examples/MockBuilder/fixtures.components.ts index b5986034d1..36895c57cd 100644 --- a/examples/MockBuilder/fixtures.components.ts +++ b/examples/MockBuilder/fixtures.components.ts @@ -29,8 +29,8 @@ import { `, }) export class ComponentContentChild { - @ContentChild('block', { ...staticFalse }) injectedBlock: TemplateRef; - @Input() items?: T[]; + @ContentChild('block', { ...staticFalse }) public injectedBlock: TemplateRef; + @Input() public items?: T[]; } @Component({ @@ -59,9 +59,9 @@ export class ComponentContentChild {
PipeWeWantToCustomize: {{ 'text' | PipeWeWantToCustomize }}
PipeWeWantToRestore: {{ 'text' | PipeWeWantToRestore }}
-
INJECTION_TOKEN_WE_DONT_WANT_TO_MIMIC: {{ t1v }}
-
INJECTION_TOKEN_WE_WANT_TO_MIMIC: {{ t2v }}
-
INJECTION_TOKEN_WE_WANT_TO_CUSTOMIZE: {{ t3v }}
+
INJECTION_TOKEN_WE_DONT_WANT_TO_MIMIC: {{ t1 }}
+
INJECTION_TOKEN_WE_WANT_TO_MIMIC: {{ t2 }}
+
INJECTION_TOKEN_WE_WANT_TO_CUSTOMIZE: {{ t3 }}
anythingWeWant1: {{ anythingWeWant1?.getName() }}
anythingWeWant2: {{ anythingWeWant2?.getName() }}
@@ -83,49 +83,21 @@ export class ComponentContentChild { `, }) export class MyComponent { - public readonly anythingWeWant1: AnythingWeWant1; - public readonly anythingWeWant2: AnythingWeWant2; - public readonly myCustomProvider1: MyCustomProvider1; - public readonly myCustomProvider2: MyCustomProvider2; - public readonly myCustomProvider3: MyCustomProvider3; - public readonly myService1: MyService1; - public readonly myService2: MyService2; - public readonly serviceWeDontWantToMimic: ServiceWeDontWantToMimic; - public readonly serviceWeWantToCustomize: ServiceWeWantToCustomize; - public readonly serviceWeWantToMimic: ServiceWeWantToMimic; - public readonly t1v: string; - public readonly t2v: string; - public readonly t3v: string; - - constructor( - @Optional() @Inject(INJECTION_TOKEN_WE_DONT_WANT_TO_MIMIC) t1: string, - @Optional() @Inject(INJECTION_TOKEN_WE_WANT_TO_MIMIC) t2: string, - @Optional() @Inject(INJECTION_TOKEN_WE_WANT_TO_CUSTOMIZE) t3: string, - @Optional() anythingWeWant1: AnythingWeWant1, - @Optional() anythingWeWant2: AnythingWeWant2, - @Optional() myCustomProvider1: MyCustomProvider1, - @Optional() myCustomProvider2: MyCustomProvider2, - @Optional() myCustomProvider3: MyCustomProvider3, - @Optional() myService1: MyService1, - @Optional() myService2: MyService2, - @Optional() serviceWeDontWantToMimic: ServiceWeDontWantToMimic, - @Optional() serviceWeWantToMimic: ServiceWeWantToMimic, - @Optional() serviceWeWantToCustomize: ServiceWeWantToCustomize - ) { - this.t1v = t1; - this.t2v = t2; - this.t3v = t3; - this.anythingWeWant1 = anythingWeWant1; - this.anythingWeWant2 = anythingWeWant2; - this.myCustomProvider1 = myCustomProvider1; - this.myCustomProvider2 = myCustomProvider2; - this.myCustomProvider3 = myCustomProvider3; - this.myService1 = myService1; - this.myService2 = myService2; - this.serviceWeDontWantToMimic = serviceWeDontWantToMimic; - this.serviceWeWantToCustomize = serviceWeWantToCustomize; - this.serviceWeWantToMimic = serviceWeWantToMimic; - } + public constructor( + @Optional() @Inject(INJECTION_TOKEN_WE_DONT_WANT_TO_MIMIC) public t1: string, + @Optional() @Inject(INJECTION_TOKEN_WE_WANT_TO_MIMIC) public t2: string, + @Optional() @Inject(INJECTION_TOKEN_WE_WANT_TO_CUSTOMIZE) public t3: string, + @Optional() public anythingWeWant1: AnythingWeWant1, + @Optional() public anythingWeWant2: AnythingWeWant2, + @Optional() public myCustomProvider1: MyCustomProvider1, + @Optional() public myCustomProvider2: MyCustomProvider2, + @Optional() public myCustomProvider3: MyCustomProvider3, + @Optional() public myService1: MyService1, + @Optional() public myService2: MyService2, + @Optional() public serviceWeDontWantToMimic: ServiceWeDontWantToMimic, + @Optional() public serviceWeWantToMimic: ServiceWeWantToMimic, + @Optional() public serviceWeWantToCustomize: ServiceWeWantToCustomize, + ) {} } @Component({ diff --git a/examples/MockBuilder/fixtures.modules.ts b/examples/MockBuilder/fixtures.modules.ts index b76893d4b5..bf0b2ca35a 100644 --- a/examples/MockBuilder/fixtures.modules.ts +++ b/examples/MockBuilder/fixtures.modules.ts @@ -1,3 +1,4 @@ +import { CommonModule } from '@angular/common'; import { HttpClientModule } from '@angular/common/http'; import { NgModule } from '@angular/core'; @@ -30,7 +31,6 @@ import { INJECTION_TOKEN_WE_WANT_TO_CUSTOMIZE, INJECTION_TOKEN_WE_WANT_TO_MIMIC, } from './fixtures.tokens'; -import { CommonModule } from '@angular/common'; @NgModule({ declarations: [ diff --git a/examples/MockBuilder/fixtures.pipes.ts b/examples/MockBuilder/fixtures.pipes.ts index 1c5e57cd83..2e18716241 100644 --- a/examples/MockBuilder/fixtures.pipes.ts +++ b/examples/MockBuilder/fixtures.pipes.ts @@ -7,7 +7,7 @@ export class MyPipe implements PipeTransform { protected prefix = 'MyPipe:'; public transform(value: any, ...args: any[]): any { - return this.prefix + value; + return `${this.prefix}${value}`; } } @@ -18,7 +18,7 @@ export class PipeWeDontWantToMimicPipe implements PipeTransform { protected prefix = 'PipeWeDontWantToMimic:'; public transform(value: any, ...args: any[]): any { - return this.prefix + value; + return `${this.prefix}${value}`; } } @@ -29,7 +29,7 @@ export class PipeWeWantToMimicPipe implements PipeTransform { protected prefix = 'PipeWeWantToMimic:'; public transform(value: any, ...args: any[]): any { - return this.prefix + value; + return `${this.prefix}${value}`; } } @@ -40,7 +40,7 @@ export class PipeWeWantToCustomize implements PipeTransform { protected prefix = 'PipeWeWantToCustomize:'; public transform(value: any, ...args: any[]): any { - return this.prefix + value; + return `${this.prefix}${value}`; } } @@ -51,6 +51,6 @@ export class PipeWeWantToRestore implements PipeTransform { protected prefix = 'PipeWeWantToRestore:'; public transform(value: any, ...args: any[]): any { - return this.prefix + value; + return `${this.prefix}${value}`; } } diff --git a/examples/MockBuilder/test.spec.ts b/examples/MockBuilder/test.spec.ts index 88e55bcf98..6f4350db95 100644 --- a/examples/MockBuilder/test.spec.ts +++ b/examples/MockBuilder/test.spec.ts @@ -159,7 +159,7 @@ describe('MockBuilder:deep', () => { expect(content).toContain('
MyComponent2: More callbacks
'); expect(content).toContain('
MyComponent3:
'); expect(content).toContain( - '
ComponentWeDontWantToMimic: ComponentWeDontWantToMimic
' + '
ComponentWeDontWantToMimic: ComponentWeDontWantToMimic
', ); expect(content).toContain('
ComponentWeWantToMimic:
'); expect(content).toContain('
ComponentStructural: -$implicit- b
'); @@ -176,7 +176,7 @@ describe('MockBuilder:deep', () => { expect(content).toContain('
PipeWeWantToRestore: PipeWeWantToRestore:text
'); expect(content).toContain( - '
INJECTION_TOKEN_WE_DONT_WANT_TO_MIMIC: INJECTION_TOKEN_WE_DONT_WANT_TO_MIMIC
' + '
INJECTION_TOKEN_WE_DONT_WANT_TO_MIMIC: INJECTION_TOKEN_WE_DONT_WANT_TO_MIMIC
', ); expect(content).toContain('
INJECTION_TOKEN_WE_WANT_TO_MIMIC:
'); expect(content).toContain('
INJECTION_TOKEN_WE_WANT_TO_CUSTOMIZE: My_Token
'); @@ -211,7 +211,7 @@ describe('MockBuilder:promise', () => { }) .beforeCompileComponents(testBed => { testBed.overrideTemplate(MyComponent2, 'More callbacks'); - }) + }), ); it('should render content ignoring all dependencies', () => { diff --git a/examples/MockComponent/test.spec.ts b/examples/MockComponent/test.spec.ts index 575cfcf951..b5bfddeb92 100644 --- a/examples/MockComponent/test.spec.ts +++ b/examples/MockComponent/test.spec.ts @@ -9,13 +9,13 @@ import { staticFalse } from '../../tests'; }) class DependencyComponent { @ContentChild('something', { ...staticFalse }) - injectedSomething: TemplateRef<{}>; + public injectedSomething: TemplateRef<{}>; @Input() - someInput = ''; + public someInput = ''; @Output() - someOutput = new EventEmitter(); + public someOutput = new EventEmitter(); } @Component({ @@ -23,8 +23,8 @@ class DependencyComponent { template: ` `, }) class TestedComponent { - value = ''; - trigger = (obj: any) => {}; + public value = ''; + public trigger = (obj: any) => {}; } describe('MockComponent', () => { diff --git a/examples/MockDirective-Attribute/test.spec.ts b/examples/MockDirective-Attribute/test.spec.ts index 5e977c814d..4dde242145 100644 --- a/examples/MockDirective-Attribute/test.spec.ts +++ b/examples/MockDirective-Attribute/test.spec.ts @@ -6,10 +6,10 @@ import { MockBuilder, MockRender, ngMocks } from 'ng-mocks'; }) class DependencyDirective { @Input('dependency-input') - someInput = ''; + public someInput = ''; @Output('dependency-output') - someOutput = new EventEmitter(); + public someOutput = new EventEmitter(); } @Component({ @@ -17,8 +17,8 @@ class DependencyDirective { template: ` `, }) class TestedComponent { - value = ''; - trigger = () => {}; + public value = ''; + public trigger = () => {}; } describe('MockDirective:Attribute', () => { diff --git a/examples/MockDirective-Structural/test.spec.ts b/examples/MockDirective-Structural/test.spec.ts index a53691e0f5..7e29c69215 100644 --- a/examples/MockDirective-Structural/test.spec.ts +++ b/examples/MockDirective-Structural/test.spec.ts @@ -6,10 +6,10 @@ import { isMockOf, MockBuilder, MockRender, ngMocks } from 'ng-mocks'; }) class DependencyDirective { @Input('dependency') - someInput = ''; + public someInput = ''; @Output('dependency-output') - someOutput = new EventEmitter(); + public someOutput = new EventEmitter(); } @Component({ @@ -17,8 +17,8 @@ class DependencyDirective { template: ` content`, }) class TestedComponent { - value = ''; - trigger = () => {}; + public value = ''; + public trigger = () => {}; } describe('MockDirective:Structural', () => { @@ -29,7 +29,7 @@ describe('MockDirective:Structural', () => { beforeEach(() => MockBuilder(TestedComponent).mock(DependencyDirective, { // render: true, // <-- a flag to render the directive by default - }) + }), ); it('renders content of the child structural directive', () => { diff --git a/examples/MockForms/test.spec.ts b/examples/MockForms/test.spec.ts index ef27f0c7b3..557b927e42 100644 --- a/examples/MockForms/test.spec.ts +++ b/examples/MockForms/test.spec.ts @@ -16,11 +16,9 @@ import { isMockOf, MockBuilder, MockRender, ngMocks } from 'ng-mocks'; template: `dependency`, }) class DependencyComponent implements ControlValueAccessor { - registerOnChange(fn: any): void {} - - registerOnTouched(fn: any): void {} - - writeValue(obj: any): void {} + public registerOnChange(fn: any): void {} + public registerOnTouched(fn: any): void {} + public writeValue(obj: any): void {} } @Component({ @@ -28,7 +26,7 @@ class DependencyComponent implements ControlValueAccessor { template: ` `, }) class TestedComponent { - value: any; + public value: any; } describe('MockForms', () => { diff --git a/examples/MockInstance/test.spec.ts b/examples/MockInstance/test.spec.ts index b5f15a5f25..42f969fa59 100644 --- a/examples/MockInstance/test.spec.ts +++ b/examples/MockInstance/test.spec.ts @@ -10,7 +10,7 @@ import { Observable, Subject } from 'rxjs'; class ChildComponent { public readonly update$: Observable; - constructor() { + public constructor() { const subject = new Subject(); this.update$ = subject; subject.complete(); @@ -28,7 +28,7 @@ class RealComponent implements AfterViewInit { } as any) protected child: ChildComponent; - ngAfterViewInit() { + public ngAfterViewInit() { this.child.update$.subscribe(); } } diff --git a/examples/MockModule/test.spec.ts b/examples/MockModule/test.spec.ts index 6826901221..010769853e 100644 --- a/examples/MockModule/test.spec.ts +++ b/examples/MockModule/test.spec.ts @@ -10,13 +10,13 @@ import { staticFalse } from '../../tests'; }) class DependencyComponent { @ContentChild('something', { ...staticFalse }) - injectedSomething: TemplateRef<{}>; + public injectedSomething: TemplateRef<{}>; @Input() - someInput = ''; + public someInput = ''; @Output() - someOutput = new EventEmitter(); + public someOutput = new EventEmitter(); } @NgModule({ @@ -31,8 +31,8 @@ class DependencyModule {} template: ` `, }) class TestedComponent { - value = ''; - trigger = () => {}; + public value = ''; + public trigger = () => {}; } describe('MockModule', () => { diff --git a/examples/MockObservable/test.spec.ts b/examples/MockObservable/test.spec.ts index 490fa73e44..2273a3d642 100644 --- a/examples/MockObservable/test.spec.ts +++ b/examples/MockObservable/test.spec.ts @@ -17,7 +17,7 @@ class TargetService { class TargetComponent { public list: number[]; - constructor(service: TargetService) { + public constructor(service: TargetService) { service.value$.subscribe(list => (this.list = list)); } } @@ -43,7 +43,7 @@ describe('MockObservable', () => { MockInstance(TargetService, instance => ngMocks.stub(instance, { value$, // even it is a read-only property we can override. - }) + }), ); }); diff --git a/examples/MockPipe/test.spec.ts b/examples/MockPipe/test.spec.ts index c9a9344aa4..8022631ae7 100644 --- a/examples/MockPipe/test.spec.ts +++ b/examples/MockPipe/test.spec.ts @@ -3,7 +3,7 @@ import { MockBuilder, MockRender, ngMocks } from 'ng-mocks'; @Pipe({ name: 'dependency' }) class DependencyPipe implements PipeTransform { - transform = (name: string): string => `hi ${name}`; + public transform = (name: string): string => `hi ${name}`; } @Component({ diff --git a/examples/MockProvider/test.spec.ts b/examples/MockProvider/test.spec.ts index 6fdd678c4b..c3e7646542 100644 --- a/examples/MockProvider/test.spec.ts +++ b/examples/MockProvider/test.spec.ts @@ -30,28 +30,14 @@ class Dependency2Service { template: `"{{ dep1.name }}" "{{ dep2.name }}" "{{ unk }}" "{{ pri }}" "{{ str }}" "{{ obj | json }}"`, }) class TargetComponent { - public readonly dep1: Dependency1Service; - public readonly dep2: Dependency2Service; - public readonly obj: any; - public readonly pri: string; - public readonly str: string; - public readonly unk: string; - - constructor( - dep1: Dependency1Service, - dep2: Dependency2Service, - @Inject(UNK_TOKEN) unk: string, - @Inject(STR_TOKEN) str: string, - @Inject(OBJ_TOKEN) obj: any, - @Inject('pri') pri: string - ) { - this.dep1 = dep1; - this.dep2 = dep2; - this.unk = unk; - this.str = str; - this.obj = obj; - this.pri = pri; - } + public constructor( + public readonly dep1: Dependency1Service, + public readonly dep2: Dependency2Service, + @Inject(UNK_TOKEN) public readonly unk: string, + @Inject(STR_TOKEN) public readonly str: string, + @Inject(OBJ_TOKEN) public readonly obj: any, + @Inject('pri') public readonly pri: string, + ) {} } describe('MockProvider', () => { @@ -69,7 +55,7 @@ describe('MockProvider', () => { MockProvider(OBJ_TOKEN, mockObj), MockProvider('pri', 'pri'), ], - }).compileComponents() + }).compileComponents(), ); it('uses mock providers', () => { diff --git a/examples/MockReactiveForms/test.spec.ts b/examples/MockReactiveForms/test.spec.ts index 6684cad24b..ab3813a5d8 100644 --- a/examples/MockReactiveForms/test.spec.ts +++ b/examples/MockReactiveForms/test.spec.ts @@ -16,11 +16,9 @@ import { isMockOf, MockBuilder, MockRender, ngMocks } from 'ng-mocks'; template: `dependency`, }) class DependencyComponent implements ControlValueAccessor { - registerOnChange(fn: any): void {} - - registerOnTouched(fn: any): void {} - - writeValue(obj: any): void {} + public registerOnChange(fn: any): void {} + public registerOnTouched(fn: any): void {} + public writeValue(obj: any): void {} } @Component({ @@ -28,7 +26,7 @@ class DependencyComponent implements ControlValueAccessor { template: ` `, }) class TestedComponent { - formControl = new FormControl(); + public readonly formControl = new FormControl(); } describe('MockReactiveForms', () => { diff --git a/examples/MockRender/test.spec.ts b/examples/MockRender/test.spec.ts index c1a9011628..2cfbb37624 100644 --- a/examples/MockRender/test.spec.ts +++ b/examples/MockRender/test.spec.ts @@ -7,14 +7,9 @@ import { MockBuilder, MockRender, ngMocks } from 'ng-mocks'; template: `dependency`, }) class DependencyComponent { - @ContentChild('something', { static: false } as any) - injectedSomething: TemplateRef<{}>; - - @Input() - someInput = ''; - - @Output() - someOutput = new EventEmitter(); + @ContentChild('something', { static: false } as any) public injectedSomething: TemplateRef<{}>; + @Input() public someInput = ''; + @Output() public readonly someOutput = new EventEmitter(); } @NgModule({ @@ -28,14 +23,9 @@ class DependencyModule {} template: ` `, }) class TestedComponent { - @Output() - trigger = new EventEmitter(); - - @Input() - value1 = ''; - - @Input() - value2 = ''; + @Output() public readonly trigger = new EventEmitter(); + @Input() public value1 = ''; + @Input() public value2 = ''; } describe('MockRender', () => { @@ -62,7 +52,7 @@ describe('MockRender', () => { { myListener1: spy, myParam1: 'something1', - } + }, ); // ngMocks.input helps to get the current value of an input on diff --git a/examples/NG_MOCKS/NG_MOCKS.spec.ts b/examples/NG_MOCKS/NG_MOCKS.spec.ts index a1fbe3a73f..237bec92de 100644 --- a/examples/NG_MOCKS/NG_MOCKS.spec.ts +++ b/examples/NG_MOCKS/NG_MOCKS.spec.ts @@ -13,7 +13,7 @@ import { } from './fixtures.components'; import { DirectiveWeDontWantToMimic, DirectiveWeWantToMimic } from './fixtures.directives'; import { ModuleWeDontWantToMimic, ModuleWeWantToMimicBesidesMyModule, MyModule } from './fixtures.modules'; -import { WeDontWantToMimicPipe, WeWantToMimicPipe, PipeWeWantToRestore } from './fixtures.pipes'; +import { PipeWeWantToRestore, WeDontWantToMimicPipe, WeWantToMimicPipe } from './fixtures.pipes'; import { ServiceWeDontWantToMimic, ServiceWeWantToCustomize, ServiceWeWantToMimic } from './fixtures.services'; import { INJECTION_TOKEN_WE_DONT_WANT_TO_MIMIC, diff --git a/examples/NG_MOCKS/fixtures.components.ts b/examples/NG_MOCKS/fixtures.components.ts index 8dff908f6b..14646d2981 100644 --- a/examples/NG_MOCKS/fixtures.components.ts +++ b/examples/NG_MOCKS/fixtures.components.ts @@ -25,8 +25,8 @@ import { template: '', }) export class ComponentContentChild { - @ContentChild('block', { ...staticFalse }) injectedBlock: TemplateRef; - @Input() items?: T[]; + @ContentChild('block', { ...staticFalse }) public readonly injectedBlock: TemplateRef; + @Input() public items?: T[]; } @Component({ @@ -34,49 +34,21 @@ export class ComponentContentChild { template: '', }) export class MyComponent { - public readonly anythingWeWant1: AnythingWeWant1; - public readonly anythingWeWant2: AnythingWeWant2; - public readonly myCustomProvider1: MyCustomProvider1; - public readonly myCustomProvider2: MyCustomProvider2; - public readonly myCustomProvider3: MyCustomProvider3; - public readonly myService1: MyService1; - public readonly myService2: MyService2; - public readonly serviceWeDontWantToMimic: ServiceWeDontWantToMimic; - public readonly serviceWeWantToCustomize: ServiceWeWantToCustomize; - public readonly serviceWeWantToMimic: ServiceWeWantToMimic; - public readonly t1v: string; - public readonly t2v: string; - public readonly t3v: string; - - constructor( - @Optional() @Inject(INJECTION_TOKEN_WE_DONT_WANT_TO_MIMIC) t1: string, - @Optional() @Inject(INJECTION_TOKEN_WE_WANT_TO_MIMIC) t2: string, - @Optional() @Inject(INJECTION_TOKEN_WE_WANT_TO_CUSTOMIZE) t3: string, - @Optional() anythingWeWant1: AnythingWeWant1, - @Optional() anythingWeWant2: AnythingWeWant2, - @Optional() myCustomProvider1: MyCustomProvider1, - @Optional() myCustomProvider2: MyCustomProvider2, - @Optional() myCustomProvider3: MyCustomProvider3, - @Optional() myService1: MyService1, - @Optional() myService2: MyService2, - @Optional() serviceWeDontWantToMimic: ServiceWeDontWantToMimic, - @Optional() serviceWeWantToMimic: ServiceWeWantToMimic, - @Optional() serviceWeWantToCustomize: ServiceWeWantToCustomize - ) { - this.t1v = t1; - this.t2v = t2; - this.t3v = t3; - this.anythingWeWant1 = anythingWeWant1; - this.anythingWeWant2 = anythingWeWant2; - this.myCustomProvider1 = myCustomProvider1; - this.myCustomProvider2 = myCustomProvider2; - this.myCustomProvider3 = myCustomProvider3; - this.myService1 = myService1; - this.myService2 = myService2; - this.serviceWeDontWantToMimic = serviceWeDontWantToMimic; - this.serviceWeWantToCustomize = serviceWeWantToCustomize; - this.serviceWeWantToMimic = serviceWeWantToMimic; - } + public constructor( + @Optional() @Inject(INJECTION_TOKEN_WE_DONT_WANT_TO_MIMIC) public readonly t1: string, + @Optional() @Inject(INJECTION_TOKEN_WE_WANT_TO_MIMIC) public readonly t2: string, + @Optional() @Inject(INJECTION_TOKEN_WE_WANT_TO_CUSTOMIZE) public readonly t3: string, + @Optional() public readonly anythingWeWant1: AnythingWeWant1, + @Optional() public readonly anythingWeWant2: AnythingWeWant2, + @Optional() public readonly myCustomProvider1: MyCustomProvider1, + @Optional() public readonly myCustomProvider2: MyCustomProvider2, + @Optional() public readonly myCustomProvider3: MyCustomProvider3, + @Optional() public readonly myService1: MyService1, + @Optional() public readonly myService2: MyService2, + @Optional() public readonly serviceWeDontWantToMimic: ServiceWeDontWantToMimic, + @Optional() public readonly serviceWeWantToMimic: ServiceWeWantToMimic, + @Optional() public readonly serviceWeWantToCustomize: ServiceWeWantToCustomize, + ) {} } @Component({ diff --git a/examples/NG_MOCKS/fixtures.modules.ts b/examples/NG_MOCKS/fixtures.modules.ts index 93ab15bbe2..6b1e9c1f7f 100644 --- a/examples/NG_MOCKS/fixtures.modules.ts +++ b/examples/NG_MOCKS/fixtures.modules.ts @@ -1,3 +1,4 @@ +import { CommonModule } from '@angular/common'; import { HttpClientModule } from '@angular/common/http'; import { NgModule } from '@angular/core'; @@ -13,10 +14,10 @@ import { import { DirectiveWeDontWantToMimic, DirectiveWeWantToMimic, MyDirective } from './fixtures.directives'; import { MyPipe, - WeDontWantToMimicPipe, PipeWeWantToCustomize, - WeWantToMimicPipe, PipeWeWantToRestore, + WeDontWantToMimicPipe, + WeWantToMimicPipe, } from './fixtures.pipes'; import { MyService1, @@ -30,7 +31,6 @@ import { INJECTION_TOKEN_WE_WANT_TO_CUSTOMIZE, INJECTION_TOKEN_WE_WANT_TO_MIMIC, } from './fixtures.tokens'; -import { CommonModule } from '@angular/common'; @NgModule({ declarations: [ diff --git a/examples/NG_MOCKS/fixtures.pipes.ts b/examples/NG_MOCKS/fixtures.pipes.ts index 1f6a94cc46..a03eafbb5f 100644 --- a/examples/NG_MOCKS/fixtures.pipes.ts +++ b/examples/NG_MOCKS/fixtures.pipes.ts @@ -7,7 +7,7 @@ export class MyPipe implements PipeTransform { protected prefix = 'MyPipe:'; public transform(value: any, ...args: any[]): any { - return this.prefix + value; + return `${this.prefix}${value}`; } } @@ -18,7 +18,7 @@ export class WeDontWantToMimicPipe implements PipeTransform { protected prefix = 'PipeWeDontWantToMimic:'; public transform(value: any, ...args: any[]): any { - return this.prefix + value; + return `${this.prefix}${value}`; } } @@ -29,7 +29,7 @@ export class WeWantToMimicPipe implements PipeTransform { protected prefix = 'PipeWeWantToMimic:'; public transform(value: any, ...args: any[]): any { - return this.prefix + value; + return `${this.prefix}${value}`; } } @@ -40,7 +40,7 @@ export class PipeWeWantToCustomize implements PipeTransform { protected prefix = 'PipeWeWantToCustomize:'; public transform(value: any, ...args: any[]): any { - return this.prefix + value; + return `${this.prefix}${value}`; } } @@ -51,6 +51,6 @@ export class PipeWeWantToRestore implements PipeTransform { protected prefix = 'PipeWeWantToRestore:'; public transform(value: any, ...args: any[]): any { - return this.prefix + value; + return `${this.prefix}${value}`; } } diff --git a/examples/TestAttributeDirective/test.spec.ts b/examples/TestAttributeDirective/test.spec.ts index 3b3497e437..11bb07756e 100644 --- a/examples/TestAttributeDirective/test.spec.ts +++ b/examples/TestAttributeDirective/test.spec.ts @@ -12,15 +12,15 @@ class TargetDirective { protected ref: ElementRef; - constructor(ref: ElementRef) { + public constructor(ref: ElementRef) { this.ref = ref; } - @HostListener('mouseenter') onMouseEnter() { + @HostListener('mouseenter') public onMouseEnter() { this.ref.nativeElement.style.backgroundColor = this.color; } - @HostListener('mouseleave') onMouseLeave() { + @HostListener('mouseleave') public onMouseLeave() { this.ref.nativeElement.style.backgroundColor = null; } } diff --git a/examples/TestHttpInterceptor/test.spec.ts b/examples/TestHttpInterceptor/test.spec.ts index 8362368835..642b133dd6 100644 --- a/examples/TestHttpInterceptor/test.spec.ts +++ b/examples/TestHttpInterceptor/test.spec.ts @@ -1,11 +1,11 @@ import { - HTTP_INTERCEPTORS, HttpClient, HttpClientModule, HttpEvent, HttpHandler, HttpInterceptor, HttpRequest, + HTTP_INTERCEPTORS, } from '@angular/common/http'; import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; import { Injectable, NgModule } from '@angular/core'; @@ -24,7 +24,7 @@ class TargetInterceptor implements HttpInterceptor { setHeaders: { 'My-Custom': this.value, }, - }) + }), ); } } @@ -40,7 +40,7 @@ class MockInterceptor implements HttpInterceptor { setHeaders: { 'My-Mock': this.value, }, - }) + }), ); } } @@ -75,7 +75,7 @@ describe('TestHttpInterceptor', () => { MockBuilder(TargetInterceptor, TargetModule) .exclude(NG_MOCKS_INTERCEPTORS) .keep(HTTP_INTERCEPTORS) - .replace(HttpClientModule, HttpClientTestingModule) + .replace(HttpClientModule, HttpClientTestingModule), ); it('triggers interceptor', () => { diff --git a/examples/TestHttpRequest/test.spec.ts b/examples/TestHttpRequest/test.spec.ts index 40ac285b42..4e5a241946 100644 --- a/examples/TestHttpRequest/test.spec.ts +++ b/examples/TestHttpRequest/test.spec.ts @@ -8,13 +8,9 @@ import { Observable } from 'rxjs'; // A service that does http requests. @Injectable() class TargetService { - protected http: HttpClient; + public constructor(protected http: HttpClient) {} - constructor(http: HttpClient) { - this.http = http; - } - - fetch(): Observable { + public fetch(): Observable { return this.http.get('/data'); } } diff --git a/examples/TestLifecycleHooks/test.spec.ts b/examples/TestLifecycleHooks/test.spec.ts index bc3f4a21d1..b41e611432 100644 --- a/examples/TestLifecycleHooks/test.spec.ts +++ b/examples/TestLifecycleHooks/test.spec.ts @@ -64,38 +64,35 @@ class TargetComponent implements OnInit, OnDestroy, OnChanges, AfterViewInit, AfterViewChecked, AfterContentInit, AfterContentChecked { @Input() public input: string | null = null; - protected readonly service: TargetService; - - constructor(service: TargetService) { - this.service = service; + public constructor(protected readonly service: TargetService) { this.service.ctor(); } - ngOnInit(): void { + public ngOnInit(): void { this.service.onInit(); } - ngOnDestroy(): void { + public ngOnDestroy(): void { this.service.onDestroy(); } - ngOnChanges(): void { + public ngOnChanges(): void { this.service.onChanges(); } - ngAfterViewInit(): void { + public ngAfterViewInit(): void { this.service.afterViewInit(); } - ngAfterViewChecked(): void { + public ngAfterViewChecked(): void { this.service.afterViewChecked(); } - ngAfterContentInit(): void { + public ngAfterContentInit(): void { this.service.afterContentInit(); } - ngAfterContentChecked(): void { + public ngAfterContentChecked(): void { this.service.afterContentChecked(); } } @@ -119,7 +116,7 @@ describe('TestLifecycleHooks', () => { { input: '', }, - { detectChanges: false } + { detectChanges: false }, ); const service: TargetService = TestBed.get(TargetService); diff --git a/examples/TestPipe/test.spec.ts b/examples/TestPipe/test.spec.ts index d8c483dc0d..473182540f 100644 --- a/examples/TestPipe/test.spec.ts +++ b/examples/TestPipe/test.spec.ts @@ -7,7 +7,7 @@ import { MockBuilder, MockRender, ngMocks } from 'ng-mocks'; name: 'target', }) class TargetPipe implements PipeTransform { - transform(value: string[], asc = true): string { + public transform(value: string[], asc = true): string { let result = [...(value || [])].sort(); if (!asc) { result = result.reverse(); diff --git a/examples/TestProviderInComponent/test.spec.ts b/examples/TestProviderInComponent/test.spec.ts index 4a05629ccf..a02acba55b 100644 --- a/examples/TestProviderInComponent/test.spec.ts +++ b/examples/TestProviderInComponent/test.spec.ts @@ -14,11 +14,7 @@ class TargetService { template: `{{ service.value }}`, }) class TargetComponent { - public readonly service: TargetService; - - constructor(service: TargetService) { - this.service = service; - } + public constructor(public readonly service: TargetService) {} } describe('TestProviderInComponent', () => { diff --git a/examples/TestProviderInDirective/test.spec.ts b/examples/TestProviderInDirective/test.spec.ts index f4f181386f..ce013e54a6 100644 --- a/examples/TestProviderInDirective/test.spec.ts +++ b/examples/TestProviderInDirective/test.spec.ts @@ -15,25 +15,14 @@ class TargetService { selector: '[target]', }) class TargetDirective implements OnInit { - public readonly service: TargetService; + public constructor( + public readonly service: TargetService, + protected ref: ElementRef, + protected templateRef: TemplateRef, + protected viewContainerRef: ViewContainerRef, + ) {} - protected ref: ElementRef; - protected templateRef: TemplateRef; - protected viewContainerRef: ViewContainerRef; - - constructor( - service: TargetService, - ref: ElementRef, - templateRef: TemplateRef, - viewContainerRef: ViewContainerRef - ) { - this.service = service; - this.ref = ref; - this.templateRef = templateRef; - this.viewContainerRef = viewContainerRef; - } - - ngOnInit(): void { + public ngOnInit(): void { this.viewContainerRef.clear(); if (this.service.value) { this.viewContainerRef.createEmbeddedView(this.templateRef); diff --git a/examples/TestProviderWithDependencies/test.spec.ts b/examples/TestProviderWithDependencies/test.spec.ts index fc3feba60e..8b6894437e 100644 --- a/examples/TestProviderWithDependencies/test.spec.ts +++ b/examples/TestProviderWithDependencies/test.spec.ts @@ -7,7 +7,7 @@ import { MockBuilder, MockInstance, MockReset } from 'ng-mocks'; class Service1 { protected name = 'service1'; - trigger(): string { + public trigger(): string { return this.name; } } @@ -16,7 +16,7 @@ class Service1 { class Service2 { protected name = 'service2'; - trigger(): string { + public trigger(): string { return this.name; } } @@ -28,7 +28,7 @@ class TargetService { public readonly value1: string; public readonly value2: string; - constructor(dep1: Service1, dep2: Service2) { + public constructor(dep1: Service1, dep2: Service2) { this.value1 = dep1.trigger(); this.value2 = dep2.trigger(); } diff --git a/examples/TestProviderWithUseClass/test.spec.ts b/examples/TestProviderWithUseClass/test.spec.ts index 14d4740ce1..4104d5c59c 100644 --- a/examples/TestProviderWithUseClass/test.spec.ts +++ b/examples/TestProviderWithUseClass/test.spec.ts @@ -7,7 +7,7 @@ import { MockBuilder, MockInstance, MockReset } from 'ng-mocks'; class Service1 { public name: string; - constructor(name: string) { + public constructor(name: string) { this.name = name; } } @@ -21,11 +21,7 @@ class Service2 extends Service1 { // A service we want to test and to replace via useClass. @Injectable() class Target1Service { - public readonly service: Service1; - - constructor(service: Service1) { - this.service = service; - } + public constructor(public readonly service: Service1) {} } // A service replacing the Target1Service. diff --git a/examples/TestProviderWithUseFactory/test.spec.ts b/examples/TestProviderWithUseFactory/test.spec.ts index f2c6fa1268..c184b6eccd 100644 --- a/examples/TestProviderWithUseFactory/test.spec.ts +++ b/examples/TestProviderWithUseFactory/test.spec.ts @@ -11,11 +11,7 @@ class Service1 { // A service we want to use. @Injectable() class TargetService { - public readonly service: Service1; - - constructor(service: Service1) { - this.service = service; - } + public constructor(public readonly service: Service1) {} } // A module that provides all services. diff --git a/examples/TestRoute/test.spec.ts b/examples/TestRoute/test.spec.ts index 55bec535a3..147ae79da0 100644 --- a/examples/TestRoute/test.spec.ts +++ b/examples/TestRoute/test.spec.ts @@ -1,3 +1,5 @@ +// tslint:disable:no-void-expression + import { Location } from '@angular/common'; import { Component, NgModule } from '@angular/core'; import { fakeAsync, TestBed, tick } from '@angular/core/testing'; @@ -106,7 +108,7 @@ describe('TestRoute:Component', () => { // RouterTestingModule.withRoutes([]), yes yes, with empty routes // to have tools for testing. beforeEach(() => - MockBuilder(TargetComponent, TargetModule).keep(RouterModule).keep(RouterTestingModule.withRoutes([])) + MockBuilder(TargetComponent, TargetModule).keep(RouterModule).keep(RouterTestingModule.withRoutes([])), ); it('navigates between pages', fakeAsync(() => { diff --git a/examples/TestRoutingGuard/test.spec.ts b/examples/TestRoutingGuard/test.spec.ts index 0d9149f2ea..c5104753a6 100644 --- a/examples/TestRoutingGuard/test.spec.ts +++ b/examples/TestRoutingGuard/test.spec.ts @@ -1,9 +1,11 @@ +// tslint:disable:no-void-expression + import { Location } from '@angular/common'; import { Component, Injectable, NgModule, VERSION } from '@angular/core'; import { fakeAsync, TestBed, tick } from '@angular/core/testing'; import { CanActivate, Router, RouterModule, RouterOutlet } from '@angular/router'; import { RouterTestingModule } from '@angular/router/testing'; -import { MockBuilder, MockRender, NG_MOCKS_GUARDS, ngMocks } from 'ng-mocks'; +import { MockBuilder, MockRender, ngMocks, NG_MOCKS_GUARDS } from 'ng-mocks'; import { from, Observable } from 'rxjs'; import { mapTo } from 'rxjs/operators'; @@ -17,15 +19,9 @@ class LoginService { // A guard we want to test. @Injectable() class LoginGuard implements CanActivate { - protected router: Router; - protected service: LoginService; - - constructor(router: Router, service: LoginService) { - this.router = router; - this.service = service; - } + public constructor(protected router: Router, protected service: LoginService) {} - canActivate(): boolean | Observable { + public canActivate(): boolean | Observable { if (this.service.isLoggedIn) { return true; } @@ -40,7 +36,7 @@ class LoginGuard implements CanActivate { class MockGuard implements CanActivate { protected readonly allow = true; - canActivate(): boolean { + public canActivate(): boolean { return this.allow; } } @@ -105,13 +101,14 @@ describe('TestRoutingGuard', () => { MockBuilder(LoginGuard, TargetModule) .exclude(NG_MOCKS_GUARDS) .keep(RouterModule) - .keep(RouterTestingModule.withRoutes([])) + .keep(RouterTestingModule.withRoutes([])), ); // It is important to run routing tests in fakeAsync. it('redirects to login', fakeAsync(() => { if (parseInt(VERSION.major, 10) <= 6) { pending('Need Angular > 6'); + return; } diff --git a/examples/TestRoutingResolver/test.spec.ts b/examples/TestRoutingResolver/test.spec.ts index b15a5d8268..89c629cda0 100644 --- a/examples/TestRoutingResolver/test.spec.ts +++ b/examples/TestRoutingResolver/test.spec.ts @@ -1,3 +1,5 @@ +// tslint:disable:no-void-expression + import { Location } from '@angular/common'; import { Component, Injectable, NgModule } from '@angular/core'; import { fakeAsync, TestBed, tick } from '@angular/core/testing'; @@ -12,7 +14,7 @@ import { map } from 'rxjs/operators'; class DataService { protected flag = true; - data(): Observable { + public data(): Observable { return from([this.flag]); } } @@ -20,13 +22,9 @@ class DataService { // A resolver we want to test. @Injectable() class DataResolver implements Resolve<{ flag: boolean }> { - protected service: DataService; - - constructor(service: DataService) { - this.service = service; - } + public constructor(protected service: DataService) {} - resolve() { + public resolve() { return combineLatest([this.service.data()]).pipe(map(([flag]) => ({ flag }))); } } @@ -36,7 +34,7 @@ class DataResolver implements Resolve<{ flag: boolean }> { class MockResolver implements Resolve<{ mock: boolean }> { protected mock = true; - resolve() { + public resolve() { return of({ mock: this.mock }); } } @@ -113,7 +111,7 @@ describe('TestRoutingResolver', () => { data: { flag: false, }, - }) + }), ); })); }); diff --git a/examples/TestStructuralDirective/test.spec.ts b/examples/TestStructuralDirective/test.spec.ts index db3c43c8c7..36790b22de 100644 --- a/examples/TestStructuralDirective/test.spec.ts +++ b/examples/TestStructuralDirective/test.spec.ts @@ -7,15 +7,9 @@ import { MockBuilder, MockRender } from 'ng-mocks'; selector: '[target]', }) class TargetDirective { - protected templateRef: TemplateRef; - protected viewContainerRef: ViewContainerRef; + public constructor(protected templateRef: TemplateRef, protected viewContainerRef: ViewContainerRef) {} - constructor(templateRef: TemplateRef, viewContainerRef: ViewContainerRef) { - this.templateRef = templateRef; - this.viewContainerRef = viewContainerRef; - } - - @Input() set target(value: any) { + @Input() public set target(value: any) { if (value) { this.viewContainerRef.createEmbeddedView(this.templateRef); } else { @@ -39,7 +33,7 @@ describe('TestStructuralDirective', () => { `, { value: false, - } + }, ); // Because the value is false the "content" should not be diff --git a/examples/TestStructuralDirectiveWithContext/test.spec.ts b/examples/TestStructuralDirectiveWithContext/test.spec.ts index 79ff6f4f9b..1af1b87476 100644 --- a/examples/TestStructuralDirectiveWithContext/test.spec.ts +++ b/examples/TestStructuralDirectiveWithContext/test.spec.ts @@ -12,22 +12,19 @@ export interface ITargetContext { selector: '[target]', }) class TargetDirective { - protected templateRef: TemplateRef; - protected viewContainerRef: ViewContainerRef; + public constructor( + protected templateRef: TemplateRef, + protected viewContainerRef: ViewContainerRef, + ) {} - constructor(templateRef: TemplateRef, viewContainerRef: ViewContainerRef) { - this.templateRef = templateRef; - this.viewContainerRef = viewContainerRef; - } - - @Input() set target(items: string[]) { + @Input() public set target(items: string[]) { this.viewContainerRef.clear(); items.forEach((value, index) => this.viewContainerRef.createEmbeddedView(this.templateRef, { $implicit: value, myIndex: index, - }) + }), ); } } @@ -46,7 +43,7 @@ describe('TestStructuralDirectiveWithContext', () => { `, { values: ['hello', 'world'], - } + }, ); // Let's assert that the 'values' have been rendered as expected diff --git a/examples/TestToken/test.spec.ts b/examples/TestToken/test.spec.ts index ab5d7a3247..f71246785b 100644 --- a/examples/TestToken/test.spec.ts +++ b/examples/TestToken/test.spec.ts @@ -48,7 +48,7 @@ describe('TestToken', () => { // initialization we need to pass its module as the second // parameter. beforeEach(() => - MockBuilder().mock(TargetModule).keep(TOKEN_CLASS).keep(TOKEN_EXISTING).keep(TOKEN_FACTORY).keep(TOKEN_VALUE) + MockBuilder().mock(TargetModule).keep(TOKEN_CLASS).keep(TOKEN_EXISTING).keep(TOKEN_FACTORY).keep(TOKEN_VALUE), ); it('creates TOKEN_CLASS', () => { diff --git a/examples/ngMocksFaster/test.spec.ts b/examples/ngMocksFaster/test.spec.ts index 94bedb2749..c2b415bab0 100644 --- a/examples/ngMocksFaster/test.spec.ts +++ b/examples/ngMocksFaster/test.spec.ts @@ -1,3 +1,5 @@ +// tslint:disable:strict-type-predicates + import { Component, Injectable } from '@angular/core'; import { MockBuilder, MockInstance, MockRender, MockReset, ngMocks } from 'ng-mocks'; @@ -6,7 +8,7 @@ class TargetService { public prop = 0; private readonly value = 1; - method(): number { + public method(): number { return this.value; } } @@ -16,11 +18,7 @@ class TargetService { template: 'target', }) class TargetComponent { - public readonly service: TargetService; - - constructor(service: TargetService) { - this.service = service; - } + public constructor(public readonly service: TargetService) {} } describe('examples:performance', () => { diff --git a/examples/ngMocksGuts/test.spec.ts b/examples/ngMocksGuts/test.spec.ts index f96439c143..02b21c955e 100644 --- a/examples/ngMocksGuts/test.spec.ts +++ b/examples/ngMocksGuts/test.spec.ts @@ -52,27 +52,24 @@ class Target2Component {} }) class Target1Component { @Input() public greeting: string | null = null; - public readonly target: string; @Output() public readonly update: EventEmitter = new EventEmitter(); - constructor(@Inject(TARGET1) target: string) { - this.target = target; - } + public constructor(@Inject(TARGET1) public readonly target: string) {} } @Directive({ selector: '[target1]', }) class Target1Directive implements OnDestroy { - public readonly service: Target1Service; @Output() public readonly target1: EventEmitter = new EventEmitter(); - constructor(service: Target1Service) { - this.service = service; - this.service.callback = () => this.target1.emit(); + public constructor(public readonly service: Target1Service) { + this.service.callback = () => { + this.target1.emit(); + }; } - ngOnDestroy(): void { + public ngOnDestroy(): void { this.service.callback = () => undefined; } } diff --git a/karma-test-shim.ts b/karma-test-shim.ts index 9d60269156..2d836a8065 100644 --- a/karma-test-shim.ts +++ b/karma-test-shim.ts @@ -1,8 +1,7 @@ -// tslint:disable: no-import-side-effect ordered-imports +// tslint:disable:no-import-side-effect ordered-imports Error.stackTraceLimit = Infinity; -import 'core-js/es6'; -import 'core-js/es7'; +import 'core-js'; import 'zone.js/dist/zone'; import 'zone.js/dist/long-stack-trace-zone'; diff --git a/lib/common/core.helpers.ts b/lib/common/core.helpers.ts index 02ec258d0a..67c728add5 100644 --- a/lib/common/core.helpers.ts +++ b/lib/common/core.helpers.ts @@ -16,6 +16,7 @@ export const getTestBedInjection = (token: Type | InjectionToken): I | export const getInjection = (token: Type | InjectionToken): I => { const testBed: any = getTestBed(); + /* istanbul ignore next */ return testBed.inject ? testBed.inject(token) : testBed.get(token); }; @@ -26,24 +27,28 @@ export const flatten = (values: T | T[], result: T[] = []): T[] => { } else { result.push(values); } + return result; }; export const mapKeys = (set: Map): T[] => { const result: T[] = []; set.forEach((_, value: T) => result.push(value)); + return result; }; export const mapValues = (set: { forEach(a1: (value: T) => void): void }): T[] => { const result: T[] = []; set.forEach((value: T) => result.push(value)); + return result; }; export const mapEntries = (set: Map): Array<[K, T]> => { const result: Array<[K, T]> = []; set.forEach((value: T, key: K) => result.push([key, value])); + return result; }; diff --git a/lib/common/core.tokens.ts b/lib/common/core.tokens.ts index 44b79f3c13..450a93c8d7 100644 --- a/lib/common/core.tokens.ts +++ b/lib/common/core.tokens.ts @@ -6,7 +6,7 @@ import { AbstractType, Type } from './core.types'; export const NG_MOCKS = new InjectionToken>('NG_MOCKS'); export const NG_MOCKS_TOUCHES = new InjectionToken>('NG_MOCKS_TOUCHES'); export const NG_MOCKS_OVERRIDES = new InjectionToken | AbstractType, MetadataOverride>>( - 'NG_MOCKS_OVERRIDES' + 'NG_MOCKS_OVERRIDES', ); export const NG_MOCKS_GUARDS = new InjectionToken('NG_MOCKS_GUARDS'); export const NG_MOCKS_INTERCEPTORS = new InjectionToken('NG_MOCKS_INTERCEPTORS'); diff --git a/lib/common/func.is-mock-of.ts b/lib/common/func.is-mock-of.ts index 9459eeb90e..8fbec46851 100644 --- a/lib/common/func.is-mock-of.ts +++ b/lib/common/func.is-mock-of.ts @@ -37,7 +37,7 @@ export function isMockOf(instance: any, declaration: Type, ngType: 'd'): i export function isMockOf( instance: any, declaration: Type, - ngType: 'p' + ngType: 'p', ): instance is MockedPipe; /** diff --git a/lib/common/func.is-mocked-ng-def-of.ts b/lib/common/func.is-mocked-ng-def-of.ts index 8e8d83db23..71bd940294 100644 --- a/lib/common/func.is-mocked-ng-def-of.ts +++ b/lib/common/func.is-mocked-ng-def-of.ts @@ -23,7 +23,7 @@ export function isMockedNgDefOf(declaration: any, type: Type, ngType: 'm') export function isMockedNgDefOf( declaration: any, type: Type, - ngType: 'c' + ngType: 'c', ): declaration is Type>; /** @@ -34,7 +34,7 @@ export function isMockedNgDefOf( export function isMockedNgDefOf( declaration: any, type: Type, - ngType: 'd' + ngType: 'd', ): declaration is Type>; /** @@ -45,7 +45,7 @@ export function isMockedNgDefOf( export function isMockedNgDefOf( declaration: any, type: Type, - ngType: 'p' + ngType: 'p', ): declaration is Type>; /** diff --git a/lib/common/func.is-ng-def.ts b/lib/common/func.is-ng-def.ts index 072e1a42ec..4a9f291cc8 100644 --- a/lib/common/func.is-ng-def.ts +++ b/lib/common/func.is-ng-def.ts @@ -51,5 +51,6 @@ export function isNgDef(declaration: any, ngType?: string): declaration is Type< const isDirective = (!ngType || ngType === 'd') && isNgType(declaration, 'Directive'); const isPipe = (!ngType || ngType === 'p') && isNgType(declaration, 'Pipe'); const isInjectable = (!ngType || ngType === 'i') && isNgType(declaration, 'Injectable'); + return isModule || isComponent || isDirective || isPipe || isInjectable; } diff --git a/lib/common/jit-reflector.spec.ts b/lib/common/jit-reflector.spec.ts index e5f9f05aff..a30067d82a 100644 --- a/lib/common/jit-reflector.spec.ts +++ b/lib/common/jit-reflector.spec.ts @@ -8,9 +8,10 @@ describe('JitReflector', () => { parameters: jasmine.createSpy('parameters'), propMetadata: jasmine.createSpy('propMetadata'), }; - constructor() { + + public constructor() { super(); - this._reflectionCapabilities = this.mock; + this.reflectionCapabilities = this.mock; } } diff --git a/lib/common/jit-reflector.ts b/lib/common/jit-reflector.ts index 5fc4d34667..4a4ffbb313 100644 --- a/lib/common/jit-reflector.ts +++ b/lib/common/jit-reflector.ts @@ -2,40 +2,44 @@ import { CompileReflector, ExternalReference } from '@angular/compiler'; import { ɵReflectionCapabilities as ReflectionCapabilities, ɵstringify as stringify } from '@angular/core'; export class JitReflector implements CompileReflector { - protected _reflectionCapabilities: ReflectionCapabilities; + protected reflectionCapabilities: ReflectionCapabilities; - constructor() { - this._reflectionCapabilities = new ReflectionCapabilities(); + public constructor() { + this.reflectionCapabilities = new ReflectionCapabilities(); } - annotations(typeOrFunc: any): any[] { - return this._reflectionCapabilities.annotations(typeOrFunc); + public annotations(typeOrFunc: any): any[] { + return this.reflectionCapabilities.annotations(typeOrFunc); } - componentModuleUrl = (type: any) => `./${stringify(type)}`; + public componentModuleUrl(type: any): string { + return `./${stringify(type)}`; + } // This does not exist in Angular 5.1.x but is required to exist in 5.2+ - guards = (): Record => ({}); + public guards(): Record { + return {}; + } - hasLifecycleHook(type: any, lcProperty: string): boolean { - return this._reflectionCapabilities.hasLifecycleHook(type, lcProperty); + public hasLifecycleHook(type: any, lcProperty: string): boolean { + return this.reflectionCapabilities.hasLifecycleHook(type, lcProperty); } - parameters(typeOrFunc: any): any[][] { - return this._reflectionCapabilities.parameters(typeOrFunc); + public parameters(typeOrFunc: any): any[][] { + return this.reflectionCapabilities.parameters(typeOrFunc); } - propMetadata(typeOrFunc: any): { [key: string]: any[] } { - return this._reflectionCapabilities.propMetadata(typeOrFunc); + public propMetadata(typeOrFunc: any): { [key: string]: any[] } { + return this.reflectionCapabilities.propMetadata(typeOrFunc); } - resolveExternalReference = (ref: ExternalReference): any => ref.runtime; + public resolveExternalReference = (ref: ExternalReference): any => ref.runtime; - shallowAnnotations = (): any[] => { + public shallowAnnotations(): any[] { throw new Error('Not supported in JIT mode'); - }; + } - tryAnnotations(typeOrFunc: any): any[] { + public tryAnnotations(typeOrFunc: any): any[] { return this.annotations(typeOrFunc); } } diff --git a/lib/common/mock-control-value-accessor.ts b/lib/common/mock-control-value-accessor.ts index df64deb2d3..20c8bdae6c 100644 --- a/lib/common/mock-control-value-accessor.ts +++ b/lib/common/mock-control-value-accessor.ts @@ -8,29 +8,31 @@ export class MockControlValueAccessor extends Mock implements ControlValueAccess public readonly __ngMocksMockControlValueAccessor: true = true; /* istanbul ignore next */ - __simulateChange = (value: any) => {}; + public __simulateChange = (value: any) => {}; /* istanbul ignore next */ - __simulateTouch = () => {}; + public __simulateTouch = () => {}; /* istanbul ignore next */ - __simulateValidatorChange = () => {}; + public __simulateValidatorChange = () => {}; - registerOnChange(fn: (value: any) => void): void { + public registerOnChange(fn: (value: any) => void): void { this.__simulateChange = fn; } - registerOnTouched(fn: () => void): void { + public registerOnTouched(fn: () => void): void { this.__simulateTouch = fn; } - registerOnValidatorChange(fn: () => void): void { + public registerOnValidatorChange(fn: () => void): void { this.__simulateValidatorChange = fn; } - setDisabledState = (isDisabled: boolean): void => {}; + public setDisabledState(isDisabled: boolean): void {} - validate = (control: AbstractControl): ValidationErrors | null => null; + public validate(control: AbstractControl): ValidationErrors | null { + return null; + } - writeValue = (value: any) => {}; + public writeValue(value: any) {} } diff --git a/lib/common/mock.spec.ts b/lib/common/mock.spec.ts index ffd6965294..5921fe2d35 100644 --- a/lib/common/mock.spec.ts +++ b/lib/common/mock.spec.ts @@ -33,7 +33,7 @@ class ChildModuleClass extends ParentClass implements PipeTransform { return this.childValue; } - transform(): string { + public transform(): string { return typeof this.childValue; } } @@ -102,7 +102,7 @@ class ChildPipeClass extends ParentClass implements PipeTransform { return this.childValue; } - transform(): string { + public transform(): string { return typeof this.childValue; } } diff --git a/lib/common/mock.ts b/lib/common/mock.ts index 40a50cb019..ffedbd7340 100644 --- a/lib/common/mock.ts +++ b/lib/common/mock.ts @@ -1,4 +1,4 @@ -// tslint:disable: no-bitwise variable-name interface-over-type-literal +// tslint:disable:no-bitwise variable-name interface-over-type-literal import { EventEmitter, Injector, Optional } from '@angular/core'; import { NgControl } from '@angular/forms'; @@ -17,7 +17,7 @@ export class Mock { protected readonly __ngMocksConfig?: ngMocksMockConfig; - constructor(@Optional() injector?: Injector) { + public constructor(@Optional() injector?: Injector) { const mockOf = (this.constructor as any).mockOf; if (injector && this.__ngMocksConfig && this.__ngMocksConfig.setNgValueAccessor) { diff --git a/lib/mock-builder/mock-builder-performance.spec.ts b/lib/mock-builder/mock-builder-performance.spec.ts index 5972edfbe2..7610b8d8f2 100644 --- a/lib/mock-builder/mock-builder-performance.spec.ts +++ b/lib/mock-builder/mock-builder-performance.spec.ts @@ -48,7 +48,7 @@ class Target2Service {} export class Target2Module {} describe('MockBuilderPerformance', () => { - afterEach(() => ngMocks.reset()); + afterEach(ngMocks.reset); it('accepts the same beforeCC', () => { const beforeCC = () => undefined; diff --git a/lib/mock-builder/mock-builder-performance.ts b/lib/mock-builder/mock-builder-performance.ts index 3430ab5fab..5dd6236505 100644 --- a/lib/mock-builder/mock-builder-performance.ts +++ b/lib/mock-builder/mock-builder-performance.ts @@ -20,9 +20,9 @@ export class MockBuilderPerformance extends MockBuilderPromise { // avoiding influences on cache when users extend the testing module. return { - declarations: [...ngModule.declarations], - imports: [...ngModule.imports], - providers: [...ngModule.providers], + declarations: [...(ngModule.declarations || [])], + imports: [...(ngModule.imports || [])], + providers: [...(ngModule.providers || [])], }; } @@ -76,16 +76,16 @@ export class MockBuilderPerformance extends MockBuilderPromise { // avoiding influences on cache when users extend the testing module. return { - declarations: [...ngModule.declarations], - imports: [...ngModule.imports], - providers: [...ngModule.providers], + declarations: [...(ngModule.declarations || [])], + imports: [...(ngModule.imports || [])], + providers: [...(ngModule.providers || [])], }; } - public then( - fulfill?: (value: IMockBuilderResult) => PromiseLike, - reject?: (reason: any) => PromiseLike - ): PromiseLike { + public async then( + fulfill?: ((value: IMockBuilderResult) => PromiseLike) | undefined | null, + reject?: ((reason: any) => PromiseLike) | undefined | null, + ): Promise { if ( ngMocksUniverse.global.has('bullet') && ngMocksUniverse.global.has('builder:module') && @@ -167,8 +167,10 @@ export class MockBuilderPerformance extends MockBuilderPromise { if (prototypeDef === thisDef) { continue; } + return false; } + return true; } @@ -333,6 +335,7 @@ export class MockBuilderPerformance extends MockBuilderPromise { return false; } } + return true; } } diff --git a/lib/mock-builder/mock-builder-promise.extract-dep.ts b/lib/mock-builder/mock-builder-promise.extract-dep.ts index fe73ecf997..416fc5a428 100644 --- a/lib/mock-builder/mock-builder-promise.extract-dep.ts +++ b/lib/mock-builder/mock-builder-promise.extract-dep.ts @@ -13,5 +13,6 @@ export default (decorators?: any[]): any => { provide = decorator; } } + return provide; }; diff --git a/lib/mock-builder/mock-builder-promise.skip-dep.ts b/lib/mock-builder/mock-builder-promise.skip-dep.ts index 9a8719063e..0c01148efb 100644 --- a/lib/mock-builder/mock-builder-promise.skip-dep.ts +++ b/lib/mock-builder/mock-builder-promise.skip-dep.ts @@ -31,5 +31,6 @@ export default (provide: any): boolean => { if (typeof provide === 'function' && skip) { return true; } + return false; }; diff --git a/lib/mock-builder/mock-builder-promise.ts b/lib/mock-builder/mock-builder-promise.ts index 63126f01d1..4f7a33d2f0 100644 --- a/lib/mock-builder/mock-builder-promise.ts +++ b/lib/mock-builder/mock-builder-promise.ts @@ -24,7 +24,8 @@ import { IMockBuilder, IMockBuilderConfig, IMockBuilderResult } from './types'; const defaultMock = {}; // simulating Symbol -export class MockBuilderPromise implements PromiseLike, IMockBuilder { +export class MockBuilderPromise implements IMockBuilder { + public readonly [Symbol.toStringTag] = 'MockBuilder'; protected beforeCC: Set<(testBed: typeof TestBed) => void> = new Set(); protected configDef: Map | InjectionToken, any> = new Map(); protected defProviders: Map | InjectionToken, Provider[]> = new Map(); @@ -37,6 +38,7 @@ export class MockBuilderPromise implements PromiseLike, IMoc public beforeCompileComponents(callback: (testBed: typeof TestBed) => void): this { this.beforeCC.add(callback); + return this; } @@ -108,7 +110,7 @@ export class MockBuilderPromise implements PromiseLike, IMoc ? MockPipe(def, instance) : instance && typeof instance === 'object' && typeof instance.transform === 'function' ? MockPipe(def, instance.transform) - : MockPipe(def) + : MockPipe(def), ); } @@ -118,8 +120,8 @@ export class MockBuilderPromise implements PromiseLike, IMoc ngMocksUniverse.builtProviders.set( def, mockServiceHelper.useFactory(def, () => - isFunc ? ngMocks.stub(MockService(def), { transform: instance }) : instance - ) + isFunc ? ngMocks.stub(MockService(def), { transform: instance }) : instance, + ), ); } else if (isNgDef(def, 'i')) { ngMocksUniverse.builtProviders.set(def, MockProvider(def)); @@ -129,7 +131,7 @@ export class MockBuilderPromise implements PromiseLike, IMoc const instance = this.defValue.get(def); ngMocksUniverse.builtProviders.set( def, - mockServiceHelper.useFactory(def, () => instance) + mockServiceHelper.useFactory(def, () => instance), ); } else if (!isNgDef(def)) { ngMocksUniverse.builtProviders.set(def, MockProvider(def)); @@ -184,7 +186,7 @@ export class MockBuilderPromise implements PromiseLike, IMoc ngModule: loModule, providers: loProviders, } - : loModule + : loModule, ); } else { declarations.push(ngMocksUniverse.builtDeclarations.get(def)); @@ -396,6 +398,10 @@ export class MockBuilderPromise implements PromiseLike, IMoc }; } + public async catch(reject?: ((reason: any) => PromiseLike) | undefined | null): Promise { + return this.then().catch(reject); + } + public exclude(def: any): this { this.wipe(def); this.excludeDef.add(def); @@ -403,6 +409,10 @@ export class MockBuilderPromise implements PromiseLike, IMoc return this; } + public async finally(callback?: (() => void) | null | undefined): Promise { + return this.then().finally(callback); + } + public keep(input: any, config?: IMockBuilderConfig): this { const { def, providers } = isNgModuleDefWithProviders(input) ? { def: input.ngModule, providers: input.providers } @@ -414,7 +424,7 @@ export class MockBuilderPromise implements PromiseLike, IMoc // a magic to support modules with providers. if (providers) { - this.defProviders.set(def, [...existing, ...providers]); + this.defProviders.set(def, [...(existing || []), ...providers]); } if (config) { @@ -447,7 +457,7 @@ export class MockBuilderPromise implements PromiseLike, IMoc // a magic to support modules with providers. if (providers) { - this.defProviders.set(def, [...existing, ...providers]); + this.defProviders.set(def, [...(existing || []), ...providers]); } if (mock !== defaultMock) { @@ -471,15 +481,16 @@ export class MockBuilderPromise implements PromiseLike, IMoc const multi = typeof provider === 'object' && provider.provide && provider.multi; const existing = this.providerDef.has(provide) ? this.providerDef.get(provide) : []; this.wipe(provide); - this.providerDef.set(provide, multi ? [...existing, provider] : provider); + this.providerDef.set(provide, multi ? [...(Array.isArray(existing) ? existing : []), provider] : provider); } + return this; } public replace(source: Type, destination: Type, config?: IMockBuilderConfig): this { if (!isNgDef(destination) || !isNgDef(source) || isNgDef(destination, 'i') || isNgDef(source, 'i')) { throw new Error( - 'Cannot replace the declaration, both have to be a Module, a Component, a Directive or a Pipe, for Providers use `.mock` or `.provide`' + 'Cannot replace the declaration, both have to be a Module, a Component, a Directive or a Pipe, for Providers use `.mock` or `.provide`', ); } @@ -492,13 +503,14 @@ export class MockBuilderPromise implements PromiseLike, IMoc } else { this.configDef.delete(source); } + return this; } - public then( - fulfill?: (value: IMockBuilderResult) => PromiseLike, - reject?: (reason: any) => PromiseLike - ): PromiseLike { + public async then( + fulfill?: ((value: IMockBuilderResult) => PromiseLike) | undefined | null, + reject?: ((reason: any) => PromiseLike) | undefined | null, + ): Promise { const promise = new Promise((resolve: (value: IMockBuilderResult) => void): void => { const testBed = TestBed.configureTestingModule(this.build()); for (const callback of mapValues(this.beforeCC)) { @@ -509,6 +521,7 @@ export class MockBuilderPromise implements PromiseLike, IMoc resolve({ testBed }); }); }); + return promise.then(fulfill, reject); } diff --git a/lib/mock-builder/mock-builder.ts b/lib/mock-builder/mock-builder.ts index 70fe784312..5584a0be78 100644 --- a/lib/mock-builder/mock-builder.ts +++ b/lib/mock-builder/mock-builder.ts @@ -16,7 +16,7 @@ import { IMockBuilder } from './types'; */ export function MockBuilder( keepDeclaration?: AnyType | InjectionToken | null | undefined, - itsModuleToMock?: AnyType | null | undefined + itsModuleToMock?: AnyType | null | undefined, ): IMockBuilder { if (!(TestBed as any).ngMocks) { const configureTestingModule = TestBed.configureTestingModule; @@ -69,6 +69,7 @@ export function MockBuilder( if (ngMocksUniverse.global.has('bullet:customized')) { ngMocksUniverse.global.set('bullet:reset', true); } + return TestBed; } ngMocksUniverse.global.delete('bullet:customized'); @@ -106,5 +107,6 @@ export function MockBuilder( exportAll: true, }); } + return instance; } diff --git a/lib/mock-builder/types.ts b/lib/mock-builder/types.ts index d9b4ddcd51..4844f7bcb2 100644 --- a/lib/mock-builder/types.ts +++ b/lib/mock-builder/types.ts @@ -60,7 +60,7 @@ export type IMockBuilderConfig = | IMockBuilderConfigComponent | IMockBuilderConfigDirective; -export interface IMockBuilder { +export interface IMockBuilder extends Promise { beforeCompileComponents(callback: (testBed: typeof TestBed) => void): this; /** @@ -152,12 +152,4 @@ export interface IMockBuilder { * @see https://github.com/ike18t/ng-mocks#mockbuilderreplace */ replace(source: Type, destination: Type, config?: IMockBuilderConfig): this; - - /** - * @see https://github.com/ike18t/ng-mocks#mockbuilder-factory - */ - then( - fulfill?: (value: IMockBuilderResult) => PromiseLike, - reject?: (reason: any) => PromiseLike - ): PromiseLike; } diff --git a/lib/mock-component/mock-component.spec.child-component.fixtures.ts b/lib/mock-component/mock-component.spec.child-component.fixtures.ts index 8b42c340ab..8fc1990e11 100644 --- a/lib/mock-component/mock-component.spec.child-component.fixtures.ts +++ b/lib/mock-component/mock-component.spec.child-component.fixtures.ts @@ -5,7 +5,7 @@ import { Component } from '@angular/core'; template: 'some template', }) export class ChildComponent { - performAction(s: string) { + public performAction(s: string) { return this; } } diff --git a/lib/mock-component/mock-component.spec.custom-form-control.component.fixtures.ts b/lib/mock-component/mock-component.spec.custom-form-control.component.fixtures.ts index 3e275a8019..4c40386ae4 100644 --- a/lib/mock-component/mock-component.spec.custom-form-control.component.fixtures.ts +++ b/lib/mock-component/mock-component.spec.custom-form-control.component.fixtures.ts @@ -16,25 +16,25 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; `, }) export class CustomFormControlComponent implements ControlValueAccessor { - @Input() disabled = false; + @Input() public disabled = false; public value = ''; - onChange = (value: string) => {}; - onTouched = () => {}; + public onChange = (value: string) => {}; + public onTouched = () => {}; - registerOnChange(fn: (rating: string) => void): void { + public registerOnChange(fn: (rating: string) => void): void { this.onChange = fn; } - registerOnTouched(fn: () => void): void { + public registerOnTouched(fn: () => void): void { this.onTouched = fn; } - setDisabledState(isDisabled: boolean): void { + public setDisabledState(isDisabled: boolean): void { this.disabled = isDisabled; } - writeValue(value: string): void { + public writeValue(value: string): void { this.value = value; } } diff --git a/lib/mock-component/mock-component.spec.getter-setter.component.fixtures.ts b/lib/mock-component/mock-component.spec.getter-setter.component.fixtures.ts index 964f39265d..41371b2ab9 100644 --- a/lib/mock-component/mock-component.spec.getter-setter.component.fixtures.ts +++ b/lib/mock-component/mock-component.spec.getter-setter.component.fixtures.ts @@ -5,18 +5,17 @@ import { Component, Input } from '@angular/core'; template: '', }) export class GetterSetterComponent { - get myGetter() { - return true; - } - - set mySetter(value: string) {} - @Input() public normalInput?: boolean; public normalProperty = false; + public get myGetter() { + return true; + } + + public set mySetter(value: string) {} - normalMethod(): boolean { + public normalMethod(): boolean { return this.myGetter; } } diff --git a/lib/mock-component/mock-component.spec.simple-component.component.fixtures.ts b/lib/mock-component/mock-component.spec.simple-component.component.fixtures.ts index 14e5e34df4..368b6dc4fd 100644 --- a/lib/mock-component/mock-component.spec.simple-component.component.fixtures.ts +++ b/lib/mock-component/mock-component.spec.simple-component.component.fixtures.ts @@ -5,7 +5,7 @@ import { Component, EventEmitter, HostBinding, Input, Output } from '@angular/co template: 'some template', }) export class BaseSimpleComponent { - @Output() someOutput2: EventEmitter; + @Output() public readonly someOutput2: EventEmitter; } @Component({ @@ -14,8 +14,8 @@ export class BaseSimpleComponent { template: 'some template', }) export class SimpleComponent extends BaseSimpleComponent { - @Input() someInput: string; - @Input('someOtherInput') someInput2: string; - @HostBinding('class.someClass') @Input() someInput3: boolean; - @Output() someOutput1: EventEmitter; + @Input() public someInput: string; + @Input('someOtherInput') public someInput2: string; + @HostBinding('class.someClass') @Input() public someInput3: boolean; + @Output() public readonly someOutput1: EventEmitter; } diff --git a/lib/mock-component/mock-component.spec.template-outlet.component.fixtures.ts b/lib/mock-component/mock-component.spec.template-outlet.component.fixtures.ts index 2130a66264..0e4dd49e5b 100644 --- a/lib/mock-component/mock-component.spec.template-outlet.component.fixtures.ts +++ b/lib/mock-component/mock-component.spec.template-outlet.component.fixtures.ts @@ -13,14 +13,14 @@ import { staticFalse } from '../../tests'; }) export class TemplateOutletComponent { // injected. - @ContentChild('block1', { ...staticFalse }) injectedBlock1: TemplateRef; + @ContentChild('block1', { ...staticFalse }) public injectedBlock1: TemplateRef; // injected. - @ContentChild('block2', { ...staticFalse }) injectedBlock2: TemplateRef; + @ContentChild('block2', { ...staticFalse }) public injectedBlock2: TemplateRef; // undefined (not injected). - @ContentChild('block3', { ...staticFalse }) injectedBlock3: TemplateRef; + @ContentChild('block3', { ...staticFalse }) public injectedBlock3: TemplateRef; // ref to own template. - @ViewChild('block4', { ...staticFalse }) ownBlock3: ElementRef; + @ViewChild('block4', { ...staticFalse }) public ownBlock3: ElementRef; } diff --git a/lib/mock-component/mock-component.spec.ts b/lib/mock-component/mock-component.spec.ts index 832360478a..a0e36f48cb 100644 --- a/lib/mock-component/mock-component.spec.ts +++ b/lib/mock-component/mock-component.spec.ts @@ -1,3 +1,5 @@ +// tslint:disable:no-void-expression + import { Component, ContentChild, @@ -58,11 +60,11 @@ import { MockedComponent } from './types'; `, }) export class ExampleComponentContainer { - @ViewChild(ChildComponent, { ...staticTrue }) childComponent: ChildComponent; - emitted: string; - formControl = new FormControl(''); + @ViewChild(ChildComponent, { ...staticTrue }) public childComponent: ChildComponent; + public emitted: string; + public readonly formControl = new FormControl(''); - performActionOnChild(s: string): void { + public performActionOnChild(s: string): void { this.childComponent.performAction(s); } } @@ -81,7 +83,7 @@ describe('MockComponent', () => { SimpleComponent, TemplateOutletComponent, ChildComponent, - CustomFormControlComponent + CustomFormControlComponent, ), ], imports: [FormsModule, ReactiveFormsModule], @@ -167,9 +169,10 @@ describe('MockComponent', () => { }); it('should set getters and setters to undefined instead of function', () => { - const mockComponent = ngMocks.findInstance(fixture.debugElement, GetterSetterComponent) as MockedDirective< - GetterSetterComponent - >; + const mockComponent = ngMocks.findInstance( + fixture.debugElement, + GetterSetterComponent, + ) as MockedDirective; expect(mockComponent.normalMethod).toBeDefined(); expect(mockComponent.myGetter).not.toBeDefined(); @@ -181,7 +184,7 @@ describe('MockComponent', () => { it('should allow you simulate the component being touched', () => { fixture.detectChanges(); const customFormControl: MockedComponent = fixture.debugElement.query( - By.css('custom-form-control') + By.css('custom-form-control'), ).componentInstance; customFormControl.__simulateTouch(); expect(component.formControl.touched).toBe(true); @@ -190,7 +193,7 @@ describe('MockComponent', () => { it('should allow you simulate a value being set', () => { fixture.detectChanges(); const customFormControl: MockedComponent = fixture.debugElement.query( - By.css('custom-form-control') + By.css('custom-form-control'), ).componentInstance; customFormControl.__simulateChange('foo'); expect(component.formControl.value).toBe('foo'); @@ -212,7 +215,7 @@ describe('MockComponent', () => { const ngContent = templateOutlet; expect(ngContent).toBeTruthy(); expect(ngContent.nativeElement.innerText.replace(/\s+/gim, ' ').trim()).toEqual( - 'ng-content body header ng-content body footer' + 'ng-content body header ng-content body footer', ); // looking for 1st templateRef. @@ -281,15 +284,15 @@ describe('MockComponent', () => { template: '', }) class MyClass { - @ContentChild('i1', { read: true } as any) o1: TemplateRef; - @ContentChildren('i2', { read: true } as any) o2: TemplateRef; - @ViewChild('i3', { read: true } as any) o3: QueryList; - @ViewChildren('i4', { read: true } as any) o4: QueryList; - - @ContentChild('i5', { read: false } as any) o5: TemplateRef; - @ContentChildren('i6', { read: false } as any) o6: TemplateRef; - @ViewChild('i7', { read: false } as any) o7: QueryList; - @ViewChildren('i8', { read: false } as any) o8: QueryList; + @ContentChild('i1', { read: true } as any) public o1: TemplateRef; + @ContentChildren('i2', { read: true } as any) public o2: TemplateRef; + @ViewChild('i3', { read: true } as any) public o3: QueryList; + @ViewChildren('i4', { read: true } as any) public o4: QueryList; + + @ContentChild('i5', { read: false } as any) public o5: TemplateRef; + @ContentChildren('i6', { read: false } as any) public o6: TemplateRef; + @ViewChild('i7', { read: false } as any) public o7: QueryList; + @ViewChildren('i8', { read: false } as any) public o8: QueryList; } const actual = MockComponent(MyClass) as any; diff --git a/lib/mock-component/mock-component.ts b/lib/mock-component/mock-component.ts index 8f44d68be0..f5443e8b39 100644 --- a/lib/mock-component/mock-component.ts +++ b/lib/mock-component/mock-component.ts @@ -77,6 +77,7 @@ export function MockComponent(component: Type): Type`; }) .join(''); @@ -96,6 +97,7 @@ export function MockComponent(component: Type): Type { const value: Type & { __ngMocksSkip?: boolean } = forwardRef(() => ComponentMock); value.__ngMocksSkip = true; + return value; })(), }, @@ -118,6 +120,7 @@ export function MockComponent(component: Type): Type { const value: Type & { __ngMocksSkip?: boolean } = forwardRef(() => ComponentMock); value.__ngMocksSkip = true; + return value; })(), }); @@ -131,6 +134,7 @@ export function MockComponent(component: Type): Type { const value: Type & { __ngMocksSkip?: boolean } = forwardRef(() => ComponentMock); value.__ngMocksSkip = true; + return value; })(), }); @@ -154,7 +158,7 @@ export function MockComponent(component: Type): Type>): Array( - declaration: AnyType + declaration: AnyType, ): Type | MockedDirective | MockedComponent>; export function MockDeclaration( - declaration: AnyType + declaration: AnyType, ): Type | MockedDirective | MockedComponent>; export function MockDeclaration( - declaration: Type + declaration: Type, ): Type | MockedDirective | MockedComponent> { if (isNgDef(declaration, 'p')) { // TODO remove any when support of A5 has been stopped. @@ -30,5 +30,6 @@ export function MockDeclaration( if (isNgDef(declaration, 'd')) { return MockDirective(declaration); } + return declaration; } diff --git a/lib/mock-directive/mock-directive.spec.ts b/lib/mock-directive/mock-directive.spec.ts index 8711f39b78..f6da17e8b0 100644 --- a/lib/mock-directive/mock-directive.spec.ts +++ b/lib/mock-directive/mock-directive.spec.ts @@ -1,3 +1,5 @@ +// tslint:disable:no-void-expression + import { Component, ContentChild, @@ -33,11 +35,11 @@ class TargetService {} selector: '[exampleDirective]', }) class ExampleDirective { - @Input() exampleDirective: string; - @Output() someOutput = new EventEmitter(); - @Input('bah') something: string; + @Input() public exampleDirective: string; + @Output() public readonly someOutput = new EventEmitter(); + @Input('bah') public something: string; - performAction(s: string) { + public performAction(s: string) { return this; } } @@ -47,7 +49,7 @@ class ExampleDirective { selector: '[exampleStructuralDirective]', }) class ExampleStructuralDirective { - @Input() exampleStructuralDirective = true; + @Input() public exampleStructuralDirective = true; } @Directive({ @@ -59,13 +61,13 @@ class GettersAndSettersDirective { public normalProperty = false; - get myGetter() { + public get myGetter() { return true; } - set mySetter(value: string) {} + public set mySetter(value: string) {} - normalMethod(): boolean { + public normalMethod(): boolean { return this.myGetter; } } @@ -81,11 +83,11 @@ class GettersAndSettersDirective { `, }) class ExampleComponentContainer { - @ViewChild(ExampleDirective, { ...staticFalse }) childDirective: ExampleDirective; - emitted = false; - foo = new FormControl(''); + @ViewChild(ExampleDirective, { ...staticFalse }) public childDirective: ExampleDirective; + public emitted = false; + public readonly foo = new FormControl(''); - performActionOnChild(s: string): void { + public performActionOnChild(s: string): void { this.childDirective.performAction(s); } } @@ -147,9 +149,10 @@ describe('MockDirective', () => { }); it('should display structural directive content', () => { - const mockDirective = ngMocks.findInstance(fixture.debugElement, ExampleStructuralDirective) as MockedDirective< - ExampleStructuralDirective - >; + const mockDirective = ngMocks.findInstance( + fixture.debugElement, + ExampleStructuralDirective, + ) as MockedDirective; // structural directives should be rendered first. mockDirective.__render(); @@ -188,9 +191,10 @@ describe('MockDirective', () => { }); it('should set getters and setters to undefined instead of function', () => { - const mockDirective = ngMocks.findInstance(fixture.debugElement, GettersAndSettersDirective) as MockedDirective< - GettersAndSettersDirective - >; + const mockDirective = ngMocks.findInstance( + fixture.debugElement, + GettersAndSettersDirective, + ) as MockedDirective; expect(() => mockDirective.__render()).not.toThrow(); expect(mockDirective.normalMethod).toBeDefined(); expect(mockDirective.myGetter).not.toBeDefined(); @@ -210,15 +214,15 @@ describe('MockDirective', () => { selector: 'never', }) class MyClass { - @ContentChild('i1', { read: true } as any) o1: TemplateRef; - @ContentChildren('i2', { read: true } as any) o2: TemplateRef; - @ViewChild('i3', { read: true } as any) o3: QueryList; - @ViewChildren('i4', { read: true } as any) o4: QueryList; - - @ContentChild('i5', { read: false } as any) o5: TemplateRef; - @ContentChildren('i6', { read: false } as any) o6: TemplateRef; - @ViewChild('i7', { read: false } as any) o7: QueryList; - @ViewChildren('i8', { read: false } as any) o8: QueryList; + @ContentChild('i1', { read: true } as any) public o1: TemplateRef; + @ContentChildren('i2', { read: true } as any) public o2: TemplateRef; + @ViewChild('i3', { read: true } as any) public o3: QueryList; + @ViewChildren('i4', { read: true } as any) public o4: QueryList; + + @ContentChild('i5', { read: false } as any) public o5: TemplateRef; + @ContentChildren('i6', { read: false } as any) public o6: TemplateRef; + @ViewChild('i7', { read: false } as any) public o7: QueryList; + @ViewChildren('i8', { read: false } as any) public o8: QueryList; } const actual = MockDirective(MyClass) as any; diff --git a/lib/mock-directive/mock-directive.ts b/lib/mock-directive/mock-directive.ts index 6ef7d796cb..adb078cb09 100644 --- a/lib/mock-directive/mock-directive.ts +++ b/lib/mock-directive/mock-directive.ts @@ -66,6 +66,7 @@ export function MockDirective(directive: Type): Type { const value: Type & { __ngMocksSkip?: boolean } = forwardRef(() => DirectiveMock); value.__ngMocksSkip = true; + return value; })(), }, @@ -87,6 +88,7 @@ export function MockDirective(directive: Type): Type { const value: Type & { __ngMocksSkip?: boolean } = forwardRef(() => DirectiveMock); value.__ngMocksSkip = true; + return value; })(), }); @@ -100,6 +102,7 @@ export function MockDirective(directive: Type): Type { const value: Type & { __ngMocksSkip?: boolean } = forwardRef(() => DirectiveMock); value.__ngMocksSkip = true; + return value; })(), }); @@ -123,17 +126,17 @@ export function MockDirective(directive: Type): Type, - @Optional() viewContainer?: ViewContainerRef + @Optional() viewContainer?: ViewContainerRef, ) { super(injector); this.__ngMocksInstall(element, template, viewContainer); } - ngOnInit(): void { + public ngOnInit(): void { if (config && config.render) { const { $implicit, variables } = config.render !== true @@ -149,7 +152,7 @@ export function MockDirective(directive: Type): Type, - viewContainer?: ViewContainerRef + viewContainer?: ViewContainerRef, ): void { // Basically any directive on ng-template is treated as structural, even it doesn't control render process. // In our case we don't if we should render it or not and due to this we do nothing. diff --git a/lib/mock-helper/func.get-last-fixture.ts b/lib/mock-helper/func.get-last-fixture.ts index 003d3c84e6..965e596f54 100644 --- a/lib/mock-helper/func.get-last-fixture.ts +++ b/lib/mock-helper/func.get-last-fixture.ts @@ -2,5 +2,6 @@ import { ComponentFixture, getTestBed } from '@angular/core/testing'; export default () => { const fixtures: Array> = (getTestBed() as any)._activeFixtures; + return fixtures[fixtures.length - 1]; }; diff --git a/lib/mock-helper/mock-helper.findAll.ts b/lib/mock-helper/mock-helper.findAll.ts index 01effa840e..1fd7feb939 100644 --- a/lib/mock-helper/mock-helper.findAll.ts +++ b/lib/mock-helper/mock-helper.findAll.ts @@ -14,5 +14,6 @@ export default (...args: any[]) => { const debugElement = el || getLastFixture()?.debugElement; const term = typeof sel === 'string' ? By.css(sel) : By.directive(getSourceOfMock(sel)); + return debugElement?.queryAll(term) || []; }; diff --git a/lib/mock-helper/mock-helper.findInstances.ts b/lib/mock-helper/mock-helper.findInstances.ts index 03ee3f934c..66187b1882 100644 --- a/lib/mock-helper/mock-helper.findInstances.ts +++ b/lib/mock-helper/mock-helper.findInstances.ts @@ -7,7 +7,7 @@ import getLastFixture from './func.get-last-fixture'; function nestedCheck( result: T[], node: MockedDebugNode & { childNodes?: MockedDebugNode[] }, - callback: (node: MockedDebugNode) => undefined | T + callback: (node: MockedDebugNode) => undefined | T, ) { const element = callback(node); if (element) { @@ -34,5 +34,6 @@ export default (...args: any[]): T[] => { return undefined; } }); + return result; }; diff --git a/lib/mock-helper/mock-helper.guts.spec.ts b/lib/mock-helper/mock-helper.guts.spec.ts index cc118e89a5..4f50bf97bd 100644 --- a/lib/mock-helper/mock-helper.guts.spec.ts +++ b/lib/mock-helper/mock-helper.guts.spec.ts @@ -1,3 +1,5 @@ +// tslint:disable:no-void-expression + import { CommonModule } from '@angular/common'; import { Component, @@ -58,7 +60,7 @@ class Target1Component { public readonly target: string; @Output() public readonly update: EventEmitter = new EventEmitter(); - constructor(@Inject(TARGET1) target: string) { + public constructor(@Inject(TARGET1) target: string) { this.target = target; } } @@ -70,12 +72,12 @@ class Target1Directive implements OnDestroy { public readonly service: Target1Service; @Output() public readonly target1: EventEmitter = new EventEmitter(); - constructor(service: Target1Service) { + public constructor(service: Target1Service) { this.service = service; this.service.callback = () => this.target1.emit(); } - ngOnDestroy(): void { + public ngOnDestroy(): void { this.service.callback = () => undefined; } } @@ -548,7 +550,7 @@ describe('mock-helper.guts', () => { expect(ngModule).toEqual( jasmine.objectContaining({ imports: [CommonModule, Target2Module], - }) + }), ); }); @@ -557,7 +559,7 @@ describe('mock-helper.guts', () => { expect(ngModule).toEqual( jasmine.objectContaining({ imports: [CommonModule, getMockedNgDefOf(Target2Module)], - }) + }), ); }); @@ -574,7 +576,7 @@ describe('mock-helper.guts', () => { const ngModule = ngMocks.guts( [Target1Service, Target1Service], [Target1Module, Target1Module], - [Target1Pipe, Target1Pipe] + [Target1Pipe, Target1Pipe], ); expect(ngModule).toEqual({ declarations: [getMockedNgDefOf(Target1Component), getMockedNgDefOf(Target1Directive)], @@ -665,7 +667,7 @@ describe('mock-helper.guts', () => { const ngModule = ngMocks.guts( [Target1Module, Target1Component, Target1Directive, Target1Pipe, Target1Service, TARGET1], null, - [Target1Module, Target1Component, Target1Directive, Target1Pipe, Target1Service, TARGET1] + [Target1Module, Target1Component, Target1Directive, Target1Pipe, Target1Service, TARGET1], ); expect(ngModule).toEqual({ declarations: [], diff --git a/lib/mock-helper/mock-helper.guts.ts b/lib/mock-helper/mock-helper.guts.ts index c5b31a8597..49330262a6 100644 --- a/lib/mock-helper/mock-helper.guts.ts +++ b/lib/mock-helper/mock-helper.guts.ts @@ -70,6 +70,7 @@ export default (keep: any, mock: any = null, exclude: any = null): TestModuleMet } imports.push(keepFlat.indexOf(def.ngModule) === -1 ? MockModule(def) : def); + return; } @@ -83,6 +84,7 @@ export default (keep: any, mock: any = null, exclude: any = null): TestModuleMet } imports.push(def); + return; } @@ -96,6 +98,7 @@ export default (keep: any, mock: any = null, exclude: any = null): TestModuleMet } imports.push(MockModule(def)); + return; } @@ -123,6 +126,7 @@ export default (keep: any, mock: any = null, exclude: any = null): TestModuleMet for (const toMock of meta.providers ? flatten(meta.providers) : []) { resolveProvider(toMock); } + return; } @@ -136,6 +140,7 @@ export default (keep: any, mock: any = null, exclude: any = null): TestModuleMet } declarations.push(keepFlat.indexOf(def) === -1 ? MockComponent(def) : def); + return; } @@ -149,6 +154,7 @@ export default (keep: any, mock: any = null, exclude: any = null): TestModuleMet } declarations.push(keepFlat.indexOf(def) === -1 ? MockDirective(def) : def); + return; } @@ -162,6 +168,7 @@ export default (keep: any, mock: any = null, exclude: any = null): TestModuleMet } declarations.push(keepFlat.indexOf(def) === -1 ? MockPipe(def) : def); + return; } diff --git a/lib/mock-helper/mock-helper.input.ts b/lib/mock-helper/mock-helper.input.ts index 894b18e375..c38d0cb6d8 100644 --- a/lib/mock-helper/mock-helper.input.ts +++ b/lib/mock-helper/mock-helper.input.ts @@ -35,6 +35,7 @@ export default (...args: any[]) => { continue; } const directive: any = get(el, token); + return directive[prop]; } } diff --git a/lib/mock-helper/mock-helper.output.ts b/lib/mock-helper/mock-helper.output.ts index cdb0a1598f..ddb2a9e3bc 100644 --- a/lib/mock-helper/mock-helper.output.ts +++ b/lib/mock-helper/mock-helper.output.ts @@ -35,6 +35,7 @@ export default (...args: any[]) => { continue; } const directive: any = get(el, token); + return directive[prop]; } } diff --git a/lib/mock-helper/mock-helper.spec.ts b/lib/mock-helper/mock-helper.spec.ts index b3d1842d87..0d53a76577 100644 --- a/lib/mock-helper/mock-helper.spec.ts +++ b/lib/mock-helper/mock-helper.spec.ts @@ -13,11 +13,11 @@ import { ngMocks } from './mock-helper'; selector: '[exampleDirective]', }) export class ExampleDirective { - @Input() exampleDirective: string; - @Output() someOutput = new EventEmitter(); - @Input('bah') something: string; + @Input() public exampleDirective: string; + @Output() public someOutput = new EventEmitter(); + @Input('bah') public something: string; - performAction(s: string) { + public performAction(s: string) { return this; } } @@ -26,7 +26,7 @@ export class ExampleDirective { selector: '[exampleStructuralDirective]', }) export class ExampleStructuralDirective { - @Input() exampleStructuralDirective = true; + @Input() public exampleStructuralDirective = true; } @Component({ @@ -119,7 +119,7 @@ describe('MockHelper:getDirective', () => { expect(componentA.componentInstance).toEqual(jasmine.any(AComponent)); expect(() => ngMocks.find(componentA, BComponent)).toThrowError( - 'Cannot find an element via ngMocks.find(BComponent)' + 'Cannot find an element via ngMocks.find(BComponent)', ); }); @@ -129,7 +129,7 @@ describe('MockHelper:getDirective', () => { expect(componentB.componentInstance).toEqual(jasmine.any(BComponent)); expect(() => ngMocks.find(componentB, AComponent)).toThrowError( - 'Cannot find an element via ngMocks.find(AComponent)' + 'Cannot find an element via ngMocks.find(AComponent)', ); }); @@ -181,7 +181,7 @@ describe('MockHelper:getDirective', () => { it('findInstance throws an error', () => { const fixture = MockRender(``); expect(() => ngMocks.findInstance(fixture.debugElement, BComponent)).toThrowError( - /Cannot find an instance via ngMocks.findInstance\(BComponent\)/ + /Cannot find an instance via ngMocks.findInstance\(BComponent\)/, ); }); diff --git a/lib/mock-helper/mock-helper.stub.ts b/lib/mock-helper/mock-helper.stub.ts index 837c93f85a..f44b4e3c23 100644 --- a/lib/mock-helper/mock-helper.stub.ts +++ b/lib/mock-helper/mock-helper.stub.ts @@ -12,5 +12,6 @@ export default (instance: any, override: any, style?: 'get' Object.defineProperty(instance, key, def); } } + return instance; }; diff --git a/lib/mock-helper/mock-helper.ts b/lib/mock-helper/mock-helper.ts index 916083a5a5..89c043c2f3 100644 --- a/lib/mock-helper/mock-helper.ts +++ b/lib/mock-helper/mock-helper.ts @@ -51,7 +51,7 @@ export const ngMocks: { find( debugElement: MockedDebugElement | ComponentFixture, component: Type, - notFoundValue: D + notFoundValue: D, ): D | MockedDebugElement; /** @@ -75,7 +75,7 @@ export const ngMocks: { find( debugElement: MockedDebugElement | ComponentFixture, cssSelector: string, - notFoundValue: D + notFoundValue: D, ): D | MockedDebugElement; /** @@ -88,7 +88,7 @@ export const ngMocks: { */ findAll( debugElement: MockedDebugElement | ComponentFixture, - component: Type + component: Type, ): Array>; /** @@ -101,7 +101,7 @@ export const ngMocks: { */ findAll( debugElement: MockedDebugElement | ComponentFixture, - cssSelector: string + cssSelector: string, ): Array>; /** @@ -125,7 +125,7 @@ export const ngMocks: { findInstance( debugNode: MockedDebugNode | ComponentFixture, instanceClass: Type, - notFoundValue: D + notFoundValue: D, ): D | T; /** @@ -172,7 +172,7 @@ export const ngMocks: { | Array | InjectionToken | NgModuleWithProviders | Provider> | null | undefined, - exclude?: AnyType | InjectionToken | Array | InjectionToken> | null | undefined + exclude?: AnyType | InjectionToken | Array | InjectionToken> | null | undefined, ): TestModuleMetadata; /** diff --git a/lib/mock-instance/mock-instance.ts b/lib/mock-instance/mock-instance.ts index 26766d5df2..a95e69f856 100644 --- a/lib/mock-instance/mock-instance.ts +++ b/lib/mock-instance/mock-instance.ts @@ -8,7 +8,7 @@ import ngMocksUniverse from '../common/ng-mocks-universe'; */ export function MockInstance( declaration: Type | AbstractType, - init?: (instance: T, injector: Injector | undefined) => void + init?: (instance: T, injector: Injector | undefined) => void, ): void; /** @@ -18,7 +18,7 @@ export function MockInstance( declaration: Type | AbstractType, config?: { init?(instance: T, injector: Injector | undefined): void; - } + }, ): void; export function MockInstance(declaration: Type | AbstractType, data?: any) { diff --git a/lib/mock-module/mock-module.spec.fixtures.ts b/lib/mock-module/mock-module.spec.fixtures.ts index 6d5f39dc66..534a1077eb 100644 --- a/lib/mock-module/mock-module.spec.fixtures.ts +++ b/lib/mock-module/mock-module.spec.fixtures.ts @@ -8,23 +8,23 @@ import { NgModuleWithProviders } from '../common/func.is-ng-module-def-with-prov export class ExampleDirective implements OnInit { protected node: ElementRef; - constructor(node: ElementRef) { + public constructor(node: ElementRef) { this.node = node; } - ngOnInit(): void { + public ngOnInit(): void { this.node.nativeElement.innerText = 'ExampleDirective'; } } @Pipe({ name: 'examplePipe' }) export class ExamplePipe implements PipeTransform { - transform = (text: string) => `Example: ${text}`; + public transform = (text: string) => `Example: ${text}`; } @Injectable() export class ExampleService { - get = (id: number) => `Got: ${id}`; + public get = (id: number) => `Got: ${id}`; } @Component({ @@ -104,7 +104,7 @@ class RealModuleWithProvidersModule {} // Factory to setup module with provider. /* tslint:disable:no-unnecessary-class */ class ModuleProvider { - static withFlag(flag: boolean): NgModuleWithProviders { + public static withFlag(flag: boolean): NgModuleWithProviders { return { ngModule: RealModuleWithProvidersModule, providers: [ @@ -140,7 +140,7 @@ export class CustomService { export class CustomWithServiceComponent { public name: string; - constructor(service: CustomService) { + public constructor(service: CustomService) { this.name = service.getSomething(); } } diff --git a/lib/mock-module/mock-module.spec.ts b/lib/mock-module/mock-module.spec.ts index 74a1468b43..9bd61fcc50 100644 --- a/lib/mock-module/mock-module.spec.ts +++ b/lib/mock-module/mock-module.spec.ts @@ -1,8 +1,8 @@ import { CommonModule } from '@angular/common'; import { HTTP_INTERCEPTORS } from '@angular/common/http'; import { - APP_INITIALIZER, ApplicationModule, + APP_INITIALIZER, Component, FactoryProvider, InjectionToken, @@ -43,7 +43,7 @@ import { `, }) class ComponentSubject { - test = 'test'; + public test = 'test'; } @Component({ diff --git a/lib/mock-module/mock-module.ts b/lib/mock-module/mock-module.ts index 17b2700c56..ae86cdec03 100644 --- a/lib/mock-module/mock-module.ts +++ b/lib/mock-module/mock-module.ts @@ -178,6 +178,7 @@ export function MockNgDef(ngModuleDef: NgModule, ngModule?: Type): [boolean if (ngMocksUniverse.builtDeclarations.has(def) && ngMocksUniverse.builtDeclarations.get(def) === null) { changed = changed || true; resolutions.set(def, undefined); + return; } @@ -217,6 +218,7 @@ export function MockNgDef(ngModuleDef: NgModule, ngModule?: Type): [boolean resolutions.set(def, mockDef); changed = changed || mockDef !== def; + return mockDef; }; diff --git a/lib/mock-pipe/mock-pipe.spec.ts b/lib/mock-pipe/mock-pipe.spec.ts index 46b526e28a..77330e8e0b 100644 --- a/lib/mock-pipe/mock-pipe.spec.ts +++ b/lib/mock-pipe/mock-pipe.spec.ts @@ -8,12 +8,12 @@ import { MockPipe, MockPipes } from './mock-pipe'; @Pipe({ name: 'mockPipe' }) export class ExamplePipe implements PipeTransform { - transform = (args: string): string => 'hi'; + public transform = (args: string): string => 'hi'; } @Pipe({ name: 'anotherMockPipe' }) export class AnotherExamplePipe implements PipeTransform { - transform = (args: string): string => 'hi'; + public transform = (args: string): string => 'hi'; } @Component({ @@ -24,7 +24,7 @@ export class AnotherExamplePipe implements PipeTransform { `, }) export class ExampleComponent { - someStuff = 'bah'; + public someStuff = 'bah'; } describe('MockPipe', () => { diff --git a/lib/mock-pipe/mock-pipe.ts b/lib/mock-pipe/mock-pipe.ts index 887770d668..bafbeb6235 100644 --- a/lib/mock-pipe/mock-pipe.ts +++ b/lib/mock-pipe/mock-pipe.ts @@ -25,11 +25,11 @@ const defaultTransform = (...args: any[]): void => undefined; */ export function MockPipe( pipe: AnyType, - transform?: TPipe['transform'] + transform?: TPipe['transform'], ): Type>; export function MockPipe( pipe: Type, - transform: TPipe['transform'] = defaultTransform + transform: TPipe['transform'] = defaultTransform, ): Type> { // We are inside of an 'it'. // It's fine to to return a mock copy or to throw an exception if it wasn't replaced with its mock copy in TestBed. diff --git a/lib/mock-provider/mock-provider.ts b/lib/mock-provider/mock-provider.ts index 4511e08257..144aa06160 100644 --- a/lib/mock-provider/mock-provider.ts +++ b/lib/mock-provider/mock-provider.ts @@ -35,6 +35,7 @@ export function MockProvider(provide: any, overrides: any = defaultValue): Provi if (!value) { return overrides; } + return ngMocksStub(value, overrides); }); } diff --git a/lib/mock-render/mock-render.spec.fixtures.ts b/lib/mock-render/mock-render.spec.fixtures.ts index cf32b2cf09..ca57fdd20e 100644 --- a/lib/mock-render/mock-render.spec.fixtures.ts +++ b/lib/mock-render/mock-render.spec.fixtures.ts @@ -6,14 +6,14 @@ import { Component, EventEmitter, Inject, Input, Output } from '@angular/core'; template: '{{ content }}', }) export class RenderRealComponent { - @Output() click = new EventEmitter<{}>(); - @Input() content = ''; + @Output() public click = new EventEmitter<{}>(); + @Input() public content = ''; public readonly document: Document; public realName = ''; - constructor(@Inject(DOCUMENT) document: Document) { + public constructor(@Inject(DOCUMENT) document: Document) { this.document = document; this.document.getElementById('test'); } diff --git a/lib/mock-render/mock-render.spec.ts b/lib/mock-render/mock-render.spec.ts index 1d04e77661..ae98fbfc23 100644 --- a/lib/mock-render/mock-render.spec.ts +++ b/lib/mock-render/mock-render.spec.ts @@ -55,7 +55,7 @@ describe('MockRender', () => { { mockClick: spy, mockContent: 'injected content', - } + }, ); expect(fixture).toBeTruthy(); @@ -84,7 +84,7 @@ describe('MockRender', () => { { mockContent: 'injected content', }, - false + false, ); expect(fixture.debugElement.nativeElement.innerText).not.toContain('injected content'); fixture.detectChanges(); @@ -107,7 +107,7 @@ describe('MockRender', () => { it('returns a pointer with a provided template', () => { const fixture: MockedComponentFixture = MockRender( - `` + ``, ); // because template can include more than 1 component, be wrapped by any html element etc. expect(fixture.point).toBeDefined(); @@ -132,7 +132,7 @@ describe('MockRender', () => { useValue: mock, }, ], - } + }, ); expect(mock.getElementById).toHaveBeenCalledWith('test'); }); diff --git a/lib/mock-render/mock-render.ts b/lib/mock-render/mock-render.ts index 3a4dd4c415..6406ee3723 100644 --- a/lib/mock-render/mock-render.ts +++ b/lib/mock-render/mock-render.ts @@ -20,6 +20,7 @@ function solveOutput(output: any): string { if (output && typeof output === 'object' && output instanceof Subject) { return '.next($event)'; } + return '=$event'; } @@ -29,7 +30,7 @@ function solveOutput(output: any): string { function MockRender>( template: Type, params: TComponent, - detectChanges?: boolean | IMockRenderOptions + detectChanges?: boolean | IMockRenderOptions, ): MockedComponentFixture; /** @@ -38,7 +39,7 @@ function MockRender>( * @see https://github.com/ike18t/ng-mocks#mockrender */ function MockRender>( - template: Type + template: Type, ): MockedComponentFixture; /** @@ -47,7 +48,7 @@ function MockRender>( function MockRender = Record>( template: string, params: TComponent, - detectChanges?: boolean | IMockRenderOptions + detectChanges?: boolean | IMockRenderOptions, ): MockedComponentFixture; /** @@ -60,7 +61,7 @@ function MockRender(template: string): MockedComponentFixture< function MockRender>( template: string | Type, params?: TComponent, - flags: boolean | IMockRenderOptions = true + flags: boolean | IMockRenderOptions = true, ): MockedComponentFixture { const flagsObject: IMockRenderOptions = typeof flags === 'boolean' ? { detectChanges: flags } : flags; const isComponent = typeof template !== 'string'; @@ -126,7 +127,7 @@ function MockRender>( const component = Component(options)( class MockRenderComponent { - constructor() { + public constructor() { for (const key of Object.keys(params || {})) { (this as any)[key] = (params as any)[key]; } @@ -143,7 +144,7 @@ function MockRender>( } } } - } as Type + } as Type, ); // Soft reset of TestBed. diff --git a/lib/mock-service/func.is-class.ts b/lib/mock-service/func.is-class.ts index 1437ec791d..cb61cb1045 100644 --- a/lib/mock-service/func.is-class.ts +++ b/lib/mock-service/func.is-class.ts @@ -12,5 +12,6 @@ export default (value: any): boolean => { if (proto.match(/^class\b/) !== null) { return true; } + return proto.match(/^function\s*\(/) === null; }; diff --git a/lib/mock-service/func.is-func.ts b/lib/mock-service/func.is-func.ts index 2f384d07a7..5ffc52599a 100644 --- a/lib/mock-service/func.is-func.ts +++ b/lib/mock-service/func.is-func.ts @@ -7,5 +7,6 @@ export default (value: any): boolean => { if (proto.match(/^\(/) !== null) { return true; } + return proto.match(/^function\s*\(/) !== null; }; diff --git a/lib/mock-service/func.is-inst.ts b/lib/mock-service/func.is-inst.ts index 4a2a185104..49b6ab3b9d 100644 --- a/lib/mock-service/func.is-inst.ts +++ b/lib/mock-service/func.is-inst.ts @@ -8,5 +8,6 @@ export default (value: any): boolean => { if (value.ngMetadataName === 'InjectionToken') { return false; } + return typeof Object.getPrototypeOf(value) === 'object'; }; diff --git a/lib/mock-service/helper.extract-methods-from-prototype.ts b/lib/mock-service/helper.extract-methods-from-prototype.ts index 27a2530a94..a3d9bee277 100644 --- a/lib/mock-service/helper.extract-methods-from-prototype.ts +++ b/lib/mock-service/helper.extract-methods-from-prototype.ts @@ -16,5 +16,6 @@ export default (service: T): string[] => { } prototype = Object.getPrototypeOf(prototype); } + return result; }; diff --git a/lib/mock-service/helper.extract-properties-from-prototype.ts b/lib/mock-service/helper.extract-properties-from-prototype.ts index 2e05f95b0f..62e7e1aa51 100644 --- a/lib/mock-service/helper.extract-properties-from-prototype.ts +++ b/lib/mock-service/helper.extract-properties-from-prototype.ts @@ -16,5 +16,6 @@ export default (service: T): string[] => { } prototype = Object.getPrototypeOf(prototype); } + return result; }; diff --git a/lib/mock-service/helper.mock-function.ts b/lib/mock-service/helper.mock-function.ts index 10fcdac0ef..7c1affa5a5 100644 --- a/lib/mock-service/helper.mock-function.ts +++ b/lib/mock-service/helper.mock-function.ts @@ -12,6 +12,7 @@ const mockFunction: { if (setValue) { setValue(val); } + return value; }; } diff --git a/lib/mock-service/helper.mock.ts b/lib/mock-service/helper.mock.ts index 6e1adba268..21de4d8866 100644 --- a/lib/mock-service/helper.mock.ts +++ b/lib/mock-service/helper.mock.ts @@ -61,5 +61,6 @@ export default (instance: any, name: string, ...args: string } Object.defineProperty(instance, name, mockDef); + return mock; }; diff --git a/lib/mock-service/helper.replace-with-mocks.ts b/lib/mock-service/helper.replace-with-mocks.ts index 533a01cdb7..03bbd000bf 100644 --- a/lib/mock-service/helper.replace-with-mocks.ts +++ b/lib/mock-service/helper.replace-with-mocks.ts @@ -71,8 +71,10 @@ const replaceWithMocks = (value: any): any => { if (updated) { Object.setPrototypeOf(mock, Object.getPrototypeOf(value)); + return mock; } + return value; }; diff --git a/lib/mock-service/helper.resolve-provider.ts b/lib/mock-service/helper.resolve-provider.ts index d13aa75b05..03193d37a2 100644 --- a/lib/mock-service/helper.resolve-provider.ts +++ b/lib/mock-service/helper.resolve-provider.ts @@ -41,6 +41,7 @@ export default (def: any, resolutions: Map, changed?: (flag: boolean) if (changed) { changed(true); } + return; } @@ -60,6 +61,7 @@ export default (def: any, resolutions: Map, changed?: (flag: boolean) if (changed) { changed(true); } + return; } const interceptor = def.useExisting || def.useClass; @@ -68,6 +70,7 @@ export default (def: any, resolutions: Map, changed?: (flag: boolean) if (changed) { changed(true); } + return; } } diff --git a/lib/mock-service/helper.use-factory.ts b/lib/mock-service/helper.use-factory.ts index 706bfc9f10..9634c9672f 100644 --- a/lib/mock-service/helper.use-factory.ts +++ b/lib/mock-service/helper.use-factory.ts @@ -11,6 +11,7 @@ export default (def: D, mock: () => I): FactoryProvider => ({ if (injector && instance && config && config.init) { config.init(instance, injector); } + return instance; }, }); diff --git a/lib/mock-service/mock-provider.ts b/lib/mock-service/mock-provider.ts index 39703211d8..9b003d333c 100644 --- a/lib/mock-service/mock-provider.ts +++ b/lib/mock-service/mock-provider.ts @@ -49,6 +49,7 @@ export default function (provider: any): Provider | undefined { } } } + return instance; }); } @@ -75,6 +76,7 @@ export default function (provider: any): Provider | undefined { if (ngMocksUniverse.config.has('multi')) { (ngMocksUniverse.config.get('multi') as Set).add(provide); } + return undefined; } diff --git a/lib/mock-service/mock-service.spec.ts b/lib/mock-service/mock-service.spec.ts index bc51edbb62..1020108f03 100644 --- a/lib/mock-service/mock-service.spec.ts +++ b/lib/mock-service/mock-service.spec.ts @@ -1,6 +1,6 @@ // tslint:disable:max-classes-per-file -import { HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http'; +import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http'; import { HttpClientTestingModule } from '@angular/common/http/testing'; import { InjectionToken, NgModule } from '@angular/core'; import { TestBed } from '@angular/core/testing'; @@ -50,11 +50,11 @@ class ChildClass extends ParentClass { class GetterSetterMethodHuetod { public nameValue = 'nameValue'; - get name(): string { + public get name(): string { return `${this.nameValue}${this.nameValue}`; } - set name(value: string) { + public set name(value: string) { this.nameValue = value; } @@ -62,6 +62,7 @@ class GetterSetterMethodHuetod { if (value) { this.name = value; } + return this.name; } } @@ -88,7 +89,7 @@ describe('MockService', () => { const mockService = MockService(() => 0); expect(mockService).toEqual(jasmine.any(Function), 'mockService'); expect(mockService()).toBeUndefined(); - expect(mockService.and.identity()).toBe('func:arrow-function'); + expect(mockService.and.identity).toBe('func:arrow-function'); }); it('should convert normal functions to an empty object because it is a class signature', () => { @@ -108,7 +109,7 @@ describe('MockService', () => { // all methods should be defined as functions which return undefined. expect(mockService.deepParentMethod).toEqual(jasmine.any(Function), 'deepParentMethod'); expect(mockService.deepParentMethod()).toBeUndefined('deepParentMethod()'); - expect(ngMocks.stub(mockService, 'deepParentMethod').and.identity()).toBe('DeepParentClass.deepParentMethod'); + expect(ngMocks.stub(mockService, 'deepParentMethod').and.identity).toBe('DeepParentClass.deepParentMethod'); }); it('should mock own and parent methods of a class', () => { @@ -124,16 +125,16 @@ describe('MockService', () => { // all methods should be defined as functions which return undefined. expect(mockService.deepParentMethod).toEqual(jasmine.any(Function), 'deepParentMethod'); expect(mockService.deepParentMethod()).toBeUndefined('deepParentMethod()'); - expect(ngMocks.stub(mockService, 'deepParentMethod').and.identity()).toBe('ChildClass.deepParentMethod'); + expect(ngMocks.stub(mockService, 'deepParentMethod').and.identity).toBe('ChildClass.deepParentMethod'); expect(mockService.parentMethod).toEqual(jasmine.any(Function), 'parentMethod'); expect(mockService.parentMethod()).toBeUndefined('parentMethod()'); - expect(ngMocks.stub(mockService, 'parentMethod').and.identity()).toBe('ChildClass.parentMethod'); + expect(ngMocks.stub(mockService, 'parentMethod').and.identity).toBe('ChildClass.parentMethod'); expect(mockService.overrideMe).toEqual(jasmine.any(Function), 'overrideMe'); expect(mockService.overrideMe()).toBeUndefined('overrideMe()'); - expect(ngMocks.stub(mockService, 'overrideMe').and.identity()).toBe('ChildClass.overrideMe'); + expect(ngMocks.stub(mockService, 'overrideMe').and.identity).toBe('ChildClass.overrideMe'); expect(mockService.childMethod).toEqual(jasmine.any(Function), 'childMethod'); expect(mockService.childMethod()).toBeUndefined('childMethod()'); - expect(ngMocks.stub(mockService, 'childMethod').and.identity()).toBe('ChildClass.childMethod'); + expect(ngMocks.stub(mockService, 'childMethod').and.identity).toBe('ChildClass.childMethod'); }); it('should mock an instance of a class as an object', () => { @@ -149,16 +150,16 @@ describe('MockService', () => { // all methods should be defined as functions which return undefined. expect(mockService.deepParentMethod).toEqual(jasmine.any(Function), 'deepParentMethod'); expect(mockService.deepParentMethod()).toBeUndefined('deepParentMethod()'); - expect(mockService.deepParentMethod.and.identity()).toBe('ChildClass.deepParentMethod'); + expect(mockService.deepParentMethod.and.identity).toBe('ChildClass.deepParentMethod'); expect(mockService.parentMethod).toEqual(jasmine.any(Function), 'parentMethod'); expect(mockService.parentMethod()).toBeUndefined('parentMethod()'); - expect(mockService.parentMethod.and.identity()).toBe('ChildClass.parentMethod'); + expect(mockService.parentMethod.and.identity).toBe('ChildClass.parentMethod'); expect(mockService.overrideMe).toEqual(jasmine.any(Function), 'overrideMe'); expect(mockService.overrideMe()).toBeUndefined('overrideMe()'); - expect(mockService.overrideMe.and.identity()).toBe('ChildClass.overrideMe'); + expect(mockService.overrideMe.and.identity).toBe('ChildClass.overrideMe'); expect(mockService.childMethod).toEqual(jasmine.any(Function), 'childMethod'); expect(mockService.childMethod()).toBeUndefined('childMethod()'); - expect(mockService.childMethod.and.identity()).toBe('ChildClass.childMethod'); + expect(mockService.childMethod.and.identity).toBe('ChildClass.childMethod'); }); it('should mock own and nested properties of an object', () => { @@ -193,11 +194,11 @@ describe('MockService', () => { }); expect(mockService.child1.child11.func1()).toBeUndefined('func1()'); - expect(mockService.child1.child11.func1.and.identity()).toBe('func:instance.child1.child11.func1'); + expect(mockService.child1.child11.func1.and.identity).toBe('func:instance.child1.child11.func1'); expect(mockService.func2()).toBeUndefined('func2()'); - expect(mockService.func2.and.identity()).toBe('func:instance.func2'); + expect(mockService.func2.and.identity).toBe('func:instance.func2'); expect(mockService.func3()).toBeUndefined('func3()'); - expect(mockService.func3.and.identity()).toBe('func:instance.func3'); + expect(mockService.func3.and.identity).toBe('func:instance.func3'); }); it('mocks getters, setters and methods in a way that jasmine can mock them w/o an issue', () => { @@ -268,7 +269,7 @@ describe('MockService', () => { class B {} class Test { - private member = A; + private readonly member = A; public getMember() { return this.member; diff --git a/lib/mock-service/mock-service.ts b/lib/mock-service/mock-service.ts index 927dcd5597..3dc5664dd1 100644 --- a/lib/mock-service/mock-service.ts +++ b/lib/mock-service/mock-service.ts @@ -39,7 +39,7 @@ export function MockService(service: any, ...args: any[]): any { value = mockServiceHelper.createMockFromPrototype(service.prototype); } else if (isFunc(service)) { value = mockServiceHelper.mockFunction( - `func:${mockNamePrefix ? mockNamePrefix : service.name || 'arrow-function'}` + `func:${mockNamePrefix ? mockNamePrefix : service.name || 'arrow-function'}`, ); } else if (Array.isArray(service)) { value = []; @@ -57,5 +57,6 @@ export function MockService(service: any, ...args: any[]): any { if (overrides) { ngMocksStub(value, overrides); } + return value; } diff --git a/package-lock.json b/package-lock.json index 3162563842..d50ad60a00 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,72 +5,72 @@ "requires": true, "dependencies": { "@angular/animations": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@angular/animations/-/animations-11.0.0.tgz", - "integrity": "sha512-RGaAnZOI73bPnNWrJq/p8sc+hpUBhScq139M6r4qQjQPsPahazL6v6hHAgRhZNemqw164d1oE4K/22O/i0E3Tw==", + "version": "11.0.2", + "resolved": "https://registry.npmjs.org/@angular/animations/-/animations-11.0.2.tgz", + "integrity": "sha512-uF/RlBY1rznbuw+1lm8Q2HKDrBOQQ2Bi2cUPuef+ALn+lxGl501eHlE+PTtBjDEzJcJPfd4pE3Ww3+3Il+D+Tw==", "dev": true, "requires": { "tslib": "^2.0.0" } }, "@angular/common": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@angular/common/-/common-11.0.0.tgz", - "integrity": "sha512-chlbtxR7jpPs3Rc1ymdp3UfUzqEr57OFIxVMG6hROODclPQQk/7oOHdQB4hpUObaF9y4ZTLeKHKWiR/twi21Pg==", + "version": "11.0.2", + "resolved": "https://registry.npmjs.org/@angular/common/-/common-11.0.2.tgz", + "integrity": "sha512-DGJuSBDt+bF77AzJNrLzeaFGSdwQ3OjgP9UUv1eKvaxp9D+lDam8suIJMuBwTsJII/yrDndY75ENPNTEqhmB2A==", "dev": true, "requires": { "tslib": "^2.0.0" } }, "@angular/compiler": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@angular/compiler/-/compiler-11.0.0.tgz", - "integrity": "sha512-I7wVhdqvhtBTQTtW61z0lwPb1LiQQ0NOwjsbfN5sAc7/uwxw7em+Kyb/XJgBwgaTKtAL8bZEzdoQGLdsSKQF2g==", + "version": "11.0.2", + "resolved": "https://registry.npmjs.org/@angular/compiler/-/compiler-11.0.2.tgz", + "integrity": "sha512-deDT5+Lcph4nNhh6sZd0mBS5OkJL3HPbX5upDMI28Wuayt18Pn0UNotWY77/KV6wwIAInmlx9N06PoH3pq3hqg==", "dev": true, "requires": { "tslib": "^2.0.0" } }, "@angular/core": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@angular/core/-/core-11.0.0.tgz", - "integrity": "sha512-FNewyMwYy+kGdw1xWfrtaPD2cSQs3kDVFbl8mNMSzp933W5yMsHDvjXb0+nPFqEb8ywEIdm3MsBMK0y3iBWZQw==", + "version": "11.0.2", + "resolved": "https://registry.npmjs.org/@angular/core/-/core-11.0.2.tgz", + "integrity": "sha512-GyDebks5ZPHDyChDW3VvzJq00Ct0iuesNpb9z/GpKtOXqug3sGr4KgkFDUTbfizKPWyeoaLH9FQYP55215nCKQ==", "dev": true, "requires": { "tslib": "^2.0.0" } }, "@angular/forms": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@angular/forms/-/forms-11.0.0.tgz", - "integrity": "sha512-hP6GF1ZkxKQp7Y+EVbEe9PPDQPrUQNdfVxphCWQYwu3tm8+tn1r91KVXkp2MA3M4Fh6Xo2HQEU2d+VXv4w0iNQ==", + "version": "11.0.2", + "resolved": "https://registry.npmjs.org/@angular/forms/-/forms-11.0.2.tgz", + "integrity": "sha512-Rn17VPviTTwiDn8Yt/UzdkXjFX0LdvjkmTNZoakqOk8/QNnsCG5sUDJAV7BKHk+2nEfUGCopS4kpBiLKLoaBpQ==", "dev": true, "requires": { "tslib": "^2.0.0" } }, "@angular/platform-browser": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-11.0.0.tgz", - "integrity": "sha512-p8sF6JfaBI+YyLpp5OSg6UcCqjtLKRR+Otq1P/tro5SuxrsrBNRVU8j0tl/crkScsMwAvgmJ1joRyUKdI2mUGQ==", + "version": "11.0.2", + "resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-11.0.2.tgz", + "integrity": "sha512-RHPm5/h8g3lSBgdg9OvO7w06juEwwBurvQcugXlk7+AeqznwzBodTWGPIATKzMySXQFmpy3bAZ3IxS0NkRrbWA==", "dev": true, "requires": { "tslib": "^2.0.0" } }, "@angular/platform-browser-dynamic": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@angular/platform-browser-dynamic/-/platform-browser-dynamic-11.0.0.tgz", - "integrity": "sha512-NAmKGhHK+tl7dr/Hcqxvr/813Opec3Mv0IRwIgmKdlpZd7qAwT/mw4RnO4YPSEoDOM6hqGt7GdlWrSDX802duQ==", + "version": "11.0.2", + "resolved": "https://registry.npmjs.org/@angular/platform-browser-dynamic/-/platform-browser-dynamic-11.0.2.tgz", + "integrity": "sha512-iV7xz90FdmYFiXZRLkZtP9Lr+OXXh4bhkX7zN1L5H8SSUF4iOJGBdOts5Fiy5GZjYYILjF1pJoEIicfW/RSHjA==", "dev": true, "requires": { "tslib": "^2.0.0" } }, "@angular/router": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@angular/router/-/router-11.0.0.tgz", - "integrity": "sha512-10ZeobfK3HqVeWS6zjdKU16ccxFtdCHkxT11bnFg3Jwq9vKt+LI5KitAkCI5rYTY3DRfVzasRkqBzZfZMkbftw==", + "version": "11.0.2", + "resolved": "https://registry.npmjs.org/@angular/router/-/router-11.0.2.tgz", + "integrity": "sha512-EU0lQ+3vv1ozly+Z4SgaGj/6CWMIExjnSnA1F7SI2yWmMgMMSb5CsGJ2xzr0V8ex3XZzuU2VuKF74muC58qSyg==", "dev": true, "requires": { "tslib": "^2.0.0" @@ -968,6 +968,19 @@ "integrity": "sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw==", "dev": true }, + "@jest/types": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-26.6.2.tgz", + "integrity": "sha512-fC6QCp7Sc5sX6g8Tvbmj4XUTbyrik0akgRy03yjXbQaBWWNWGE7SGtJk98m0N8nzegD/7SggrUlivxo5ax4KWQ==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^15.0.0", + "chalk": "^4.0.0" + } + }, "@nodelib/fs.scandir": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz", @@ -995,18 +1008,18 @@ } }, "@octokit/auth-token": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.2.tgz", - "integrity": "sha512-jE/lE/IKIz2v1+/P0u4fJqv0kYwXOTujKemJMFr6FeopsxlIK3+wKDCJGnysg81XID5TgZQbIfuJ5J0lnTiuyQ==", + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.3.tgz", + "integrity": "sha512-fdGoOQ3kQJh+hrilc0Plg50xSfaCKOeYN9t6dpJKXN9BxhhfquL0OzoQXg3spLYymL5rm29uPeI3KEXRaZQ9zg==", "dev": true, "requires": { "@octokit/types": "^5.0.0" } }, "@octokit/core": { - "version": "2.5.4", - "resolved": "https://registry.npmjs.org/@octokit/core/-/core-2.5.4.tgz", - "integrity": "sha512-HCp8yKQfTITYK+Nd09MHzAlP1v3Ii/oCohv0/TW9rhSLvzb98BOVs2QmVYuloE6a3l6LsfyGIwb6Pc4ycgWlIQ==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.2.1.tgz", + "integrity": "sha512-XfFSDDwv6tclUenS0EmB6iA7u+4aOHBT1Lz4PtQNQQg3hBbNaR/+Uv5URU+egeIuuGAiMRiDyY92G4GBOWOqDA==", "dev": true, "requires": { "@octokit/auth-token": "^2.4.0", @@ -1014,57 +1027,35 @@ "@octokit/request": "^5.4.0", "@octokit/types": "^5.0.0", "before-after-hook": "^2.1.0", - "universal-user-agent": "^5.0.0" + "universal-user-agent": "^6.0.0" } }, "@octokit/endpoint": { - "version": "6.0.8", - "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.8.tgz", - "integrity": "sha512-MuRrgv+bM4Q+e9uEvxAB/Kf+Sj0O2JAOBA131uo1o6lgdq1iS8ejKwtqHgdfY91V3rN9R/hdGKFiQYMzVzVBEQ==", + "version": "6.0.9", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.9.tgz", + "integrity": "sha512-3VPLbcCuqji4IFTclNUtGdp9v7g+nspWdiCUbK3+iPMjJCZ6LEhn1ts626bWLOn0GiDb6j+uqGvPpqLnY7pBgw==", "dev": true, "requires": { "@octokit/types": "^5.0.0", "is-plain-object": "^5.0.0", "universal-user-agent": "^6.0.0" - }, - "dependencies": { - "is-plain-object": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", - "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", - "dev": true - }, - "universal-user-agent": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz", - "integrity": "sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w==", - "dev": true - } } }, "@octokit/graphql": { - "version": "4.5.6", - "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.5.6.tgz", - "integrity": "sha512-Rry+unqKTa3svswT2ZAuqenpLrzJd+JTv89LTeVa5UM/5OX8o4KTkPL7/1ABq4f/ZkELb0XEK/2IEoYwykcLXg==", + "version": "4.5.7", + "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.5.7.tgz", + "integrity": "sha512-Gk0AR+DcwIK/lK/GX+OQ99UqtenQhcbrhHHfOYlrCQe17ADnX3EKAOKRsAZ9qZvpi5MuwWm/Nm+9aO2kTDSdyA==", "dev": true, "requires": { "@octokit/request": "^5.3.0", "@octokit/types": "^5.0.0", "universal-user-agent": "^6.0.0" - }, - "dependencies": { - "universal-user-agent": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz", - "integrity": "sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w==", - "dev": true - } } }, "@octokit/plugin-paginate-rest": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.4.0.tgz", - "integrity": "sha512-YT6Klz3LLH6/nNgi0pheJnUmTFW4kVnxGft+v8Itc41IIcjl7y1C8TatmKQBbCSuTSNFXO5pCENnqg6sjwpJhg==", + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.6.0.tgz", + "integrity": "sha512-o+O8c1PqsC5++BHXfMZabRRsBIVb34tXPWyQLyp2IXq5MmkxdipS7TXM4Y9ldL1PzY9CTrCsn/lzFFJGM3oRRA==", "dev": true, "requires": { "@octokit/types": "^5.5.0" @@ -1077,30 +1068,19 @@ "dev": true }, "@octokit/plugin-rest-endpoint-methods": { - "version": "3.17.0", - "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-3.17.0.tgz", - "integrity": "sha512-NFV3vq7GgoO2TrkyBRUOwflkfTYkFKS0tLAPym7RNpkwLCttqShaEGjthOsPEEL+7LFcYv3mU24+F2yVd3npmg==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.2.1.tgz", + "integrity": "sha512-QyFr4Bv807Pt1DXZOC5a7L5aFdrwz71UHTYoHVajYV5hsqffWm8FUl9+O7nxRu5PDMtB/IKrhFqTmdBTK5cx+A==", "dev": true, "requires": { - "@octokit/types": "^4.1.6", + "@octokit/types": "^5.5.0", "deprecation": "^2.3.1" - }, - "dependencies": { - "@octokit/types": { - "version": "4.1.10", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-4.1.10.tgz", - "integrity": "sha512-/wbFy1cUIE5eICcg0wTKGXMlKSbaAxEr00qaBXzscLXpqhcwgXeS6P8O0pkysBhRfyjkKjJaYrvR1ExMO5eOXQ==", - "dev": true, - "requires": { - "@types/node": ">= 8" - } - } } }, "@octokit/request": { - "version": "5.4.9", - "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.4.9.tgz", - "integrity": "sha512-CzwVvRyimIM1h2n9pLVYfTDmX9m+KHSgCpqPsY8F1NdEK8IaWqXhSBXsdjOBFZSpEcxNEeg4p0UO9cQ8EnOCLA==", + "version": "5.4.10", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.4.10.tgz", + "integrity": "sha512-egA49HkqEORVGDZGav1mh+VD+7uLgOxtn5oODj6guJk0HCy+YBSYapFkSLFgeYj3Fr18ZULKGURkjyhkAChylw==", "dev": true, "requires": { "@octokit/endpoint": "^6.0.1", @@ -1113,12 +1093,6 @@ "universal-user-agent": "^6.0.0" }, "dependencies": { - "is-plain-object": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", - "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", - "dev": true - }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -1127,19 +1101,13 @@ "requires": { "wrappy": "1" } - }, - "universal-user-agent": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz", - "integrity": "sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w==", - "dev": true } } }, "@octokit/request-error": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.0.2.tgz", - "integrity": "sha512-2BrmnvVSV1MXQvEkrb9zwzP0wXFNbPJij922kYBTLIlIafukrGOb+ABBT2+c6wZiuyWDH1K1zmjGQ0toN/wMWw==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.0.3.tgz", + "integrity": "sha512-GgD5z8Btm301i2zfvJLk/mkhvGCdjQ7wT8xF9ov5noQY8WbKZDH9cOBqXzoeKd1mLr1xH2FwbtGso135zGBgTA==", "dev": true, "requires": { "@octokit/types": "^5.0.1", @@ -1159,15 +1127,15 @@ } }, "@octokit/rest": { - "version": "17.11.2", - "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-17.11.2.tgz", - "integrity": "sha512-4jTmn8WossTUaLfNDfXk4fVJgbz5JgZE8eCs4BvIb52lvIH8rpVMD1fgRCrHbSd6LRPE5JFZSfAEtszrOq3ZFQ==", + "version": "18.0.9", + "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-18.0.9.tgz", + "integrity": "sha512-CC5+cIx974Ygx9lQNfUn7/oXDQ9kqGiKUC6j1A9bAVZZ7aoTF8K6yxu0pQhQrLBwSl92J6Z3iVDhGhGFgISCZg==", "dev": true, "requires": { - "@octokit/core": "^2.4.3", + "@octokit/core": "^3.0.0", "@octokit/plugin-paginate-rest": "^2.2.0", "@octokit/plugin-request-log": "^1.0.0", - "@octokit/plugin-rest-endpoint-methods": "3.17.0" + "@octokit/plugin-rest-endpoint-methods": "4.2.1" } }, "@octokit/types": { @@ -1243,9 +1211,9 @@ }, "dependencies": { "debug": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", - "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", "dev": true, "requires": { "ms": "2.1.2" @@ -1579,12 +1547,12 @@ } }, "@semantic-release/github": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/@semantic-release/github/-/github-7.1.1.tgz", - "integrity": "sha512-w8CLCvGVKNe2FPOYQ68OFxFVNNha7YRzptnwTZYdjXYtgTDKw0XVfnMSd9NlJeQPYGfQmIhIVPNBU/cA6zUY0A==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@semantic-release/github/-/github-7.2.0.tgz", + "integrity": "sha512-tMRnWiiWb43whRHvbDGXq4DGEbKRi56glDpXDJZit4PIiwDPX7Kx3QzmwRtDOcG+8lcpGjpdPabYZ9NBxoI2mw==", "dev": true, "requires": { - "@octokit/rest": "^17.0.0", + "@octokit/rest": "^18.0.0", "@semantic-release/error": "^2.2.0", "aggregate-error": "^3.0.0", "bottleneck": "^2.18.1", @@ -1612,9 +1580,9 @@ } }, "debug": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", - "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", "dev": true, "requires": { "ms": "2.1.2" @@ -1649,13 +1617,21 @@ } }, "jsonfile": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.0.1.tgz", - "integrity": "sha512-jR2b5v7d2vIOust+w3wtFKZIfpC2pnRmFAhAC/BuweZFQR8qZzxH1OyrQ10HmdVYiXWkYUqPVsz91cG7EL2FBg==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", "dev": true, "requires": { "graceful-fs": "^4.1.6", - "universalify": "^1.0.0" + "universalify": "^2.0.0" + }, + "dependencies": { + "universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "dev": true + } } }, "ms": { @@ -1874,9 +1850,9 @@ }, "dependencies": { "debug": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", - "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", "dev": true, "requires": { "ms": "2.1.2" @@ -1961,22 +1937,50 @@ "dev": true }, "@types/core-js": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/@types/core-js/-/core-js-2.5.3.tgz", - "integrity": "sha512-F9RHpjuPSit4dCCRXgi7XcqA01DAjy9QY+v9yICoxXsjXD9cgQpyZyL2eSZnTkBGXGaQnea8waZOZTogLDB+rA==", + "version": "2.5.4", + "resolved": "https://registry.npmjs.org/@types/core-js/-/core-js-2.5.4.tgz", + "integrity": "sha512-Xwy8o12ak+iYgFr/KCVaVK5Sy+jFMiiPAID3+ObvMlBzy26XQJw5xu+a6rlHsrJENXj/AwJOGsJpVohUjAzSKQ==", + "dev": true + }, + "@types/istanbul-lib-coverage": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz", + "integrity": "sha512-sz7iLqvVUg1gIedBOvlkxPlc8/uVzyS5OwGz1cKjXzkl3FpL3al0crU8YGU1WoHkxn0Wxbw5tyi6hvzJKNzFsw==", "dev": true }, + "@types/istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "*" + } + }, + "@types/istanbul-reports": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.0.tgz", + "integrity": "sha512-nwKNbvnwJ2/mndE9ItP/zc2TCzw6uuodnF4EHYWD+gCQDVBuRQL5UzbZD0/ezy1iKsFU2ZQiDqg4M9dN4+wZgA==", + "dev": true, + "requires": { + "@types/istanbul-lib-report": "*" + } + }, "@types/jasmine": { - "version": "2.8.9", - "resolved": "https://registry.npmjs.org/@types/jasmine/-/jasmine-2.8.9.tgz", - "integrity": "sha512-8dPZwjosElZOGGYw1nwTvOEMof4gjwAWNFS93nBI091BoEfd5drnHOLRMiRF/LOPuMTn5LgEdv0bTUO8QFVuHQ==", + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/@types/jasmine/-/jasmine-3.6.2.tgz", + "integrity": "sha512-AzfesNFLvOs6Q1mHzIsVJXSeUnqVh4ZHG8ngygKJfbkcSLwzrBVm/LKa+mR8KrOfnWtUL47112gde1MC0IXqpQ==", "dev": true }, "@types/jest": { - "version": "22.2.3", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-22.2.3.tgz", - "integrity": "sha512-e74sM9W/4qqWB6D4TWV9FQk0WoHtX1X4FJpbjxucMSVJHtFjbQOH3H6yp+xno4br0AKG0wz/kPtaN599GUOvAg==", - "dev": true + "version": "26.0.15", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-26.0.15.tgz", + "integrity": "sha512-s2VMReFXRg9XXxV+CW9e5Nz8fH2K1aEhwgjUqPPbQd7g95T0laAcvLv032EhFHIa5GHsZ8W7iJEQVaJq6k3Gog==", + "dev": true, + "requires": { + "jest-diff": "^26.0.0", + "pretty-format": "^26.0.0" + } }, "@types/minimist": { "version": "1.2.0", @@ -1985,9 +1989,9 @@ "dev": true }, "@types/node": { - "version": "10.17.27", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.27.tgz", - "integrity": "sha512-J0oqm9ZfAXaPdwNXMMgAhylw5fhmXkToJd06vuDUSAgEDZ/n/69/69UmyBZbc+zT34UnShuDSBqvim3SPnozJg==", + "version": "10.17.46", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.46.tgz", + "integrity": "sha512-Tice8a+sJtlP9C1EUo0DYyjq52T37b3LexVu3p871+kfIBIN+OQ7PKPei1oF3MgF39olEpUfxaLtD+QFc1k69Q==", "dev": true }, "@types/normalize-package-data": { @@ -2008,6 +2012,21 @@ "integrity": "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==", "dev": true }, + "@types/yargs": { + "version": "15.0.10", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.10.tgz", + "integrity": "sha512-z8PNtlhrj7eJNLmrAivM7rjBESG6JwC5xP3RVk12i/8HVP7Xnx/sEmERnRImyEuUaJfO942X0qMOYsoupaJbZQ==", + "dev": true, + "requires": { + "@types/yargs-parser": "*" + } + }, + "@types/yargs-parser": { + "version": "15.0.0", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-15.0.0.tgz", + "integrity": "sha512-FA/BWv8t8ZWJ+gEOnLLd8ygxH/2UFbAvgEonyfN6yWGLKc7zVjbpl2Y4CTjid9h2RfgPP6SEt6uHwEOply00yw==", + "dev": true + }, "@types/yauzl": { "version": "2.9.1", "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.9.1.tgz", @@ -2108,9 +2127,9 @@ } }, "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", "dev": true }, "ansi-styles": { @@ -2767,6 +2786,15 @@ "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", "dev": true }, + "cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "dev": true, + "requires": { + "restore-cursor": "^3.1.0" + } + }, "cli-table": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/cli-table/-/cli-table-0.3.1.tgz", @@ -2794,12 +2822,6 @@ "string-width": "^4.2.0" }, "dependencies": { - "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", - "dev": true - }, "is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", @@ -3090,6 +3112,15 @@ "lru-cache": "^6.0.0" } }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, "meow": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/meow/-/meow-8.0.0.tgz", @@ -3236,6 +3267,12 @@ "integrity": "sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw==", "dev": true }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, "yargs-parser": { "version": "20.2.4", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", @@ -3285,9 +3322,9 @@ "dev": true }, "core-js": { - "version": "2.6.11", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.11.tgz", - "integrity": "sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg==", + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.7.0.tgz", + "integrity": "sha512-NwS7fI5M5B85EwpWuIwJN4i/fbisQUwLwiSNUWeXlkAZ0sbBjLEvLvFLf1uzAUV66PcEPt4xCGCmOZSxVf3xzA==", "dev": true }, "core-util-is": { @@ -3297,16 +3334,16 @@ "dev": true }, "cosmiconfig": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-6.0.0.tgz", - "integrity": "sha512-xb3ZL6+L8b9JLLCx3ZdoZy4+2ECphCMo2PwqgP1tlfVq6M6YReyzBJtvWWtbDSpNr9hn96pkCiZqUcFEc+54Qg==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.0.tgz", + "integrity": "sha512-pondGvTuVYDk++upghXJabWzL6Kxu6f26ljFw64Swq9v6sQPUL3EUlVDV56diOjpCayKihL6hVe8exIACU4XcA==", "dev": true, "requires": { "@types/parse-json": "^4.0.0", - "import-fresh": "^3.1.0", + "import-fresh": "^3.2.1", "parse-json": "^5.0.0", "path-type": "^4.0.0", - "yaml": "^1.7.2" + "yaml": "^1.10.0" }, "dependencies": { "parse-json": { @@ -3390,18 +3427,6 @@ "lru-cache": "^4.0.1", "shebang-command": "^1.2.0", "which": "^1.2.9" - }, - "dependencies": { - "lru-cache": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", - "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", - "dev": true, - "requires": { - "pseudomap": "^1.0.2", - "yallist": "^2.1.2" - } - } } }, "crypto-browserify": { @@ -3579,9 +3604,9 @@ } }, "devtools-protocol": { - "version": "0.0.809251", - "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.809251.tgz", - "integrity": "sha512-pf+2OY6ghMDPjKkzSWxHMq+McD+9Ojmq5XVRYpv/kPd9sTMQxzEt21592a31API8qRjro0iYYOc3ag46qF/1FA==", + "version": "0.0.818844", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.818844.tgz", + "integrity": "sha512-AD1hi7iVJ8OD0aMLQU5VK0XH9LDlA1+BcPIgrAxPfaibx2DbWucuyOhc4oyQCbnvDDO68nN6/LcKfqTP343Jjg==", "dev": true }, "di": { @@ -3596,6 +3621,12 @@ "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", "dev": true }, + "diff-sequences": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-26.6.2.tgz", + "integrity": "sha512-Mv/TDa3nZ9sbc5soK+OoA74BsS3mL37yixCvUAQkiuA4Wz6YtwP/K47n2rv2ovzHZvoiQeA5FTQOschKkEwB0Q==", + "dev": true + }, "diffie-hellman": { "version": "5.0.3", "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", @@ -4083,9 +4114,9 @@ }, "dependencies": { "debug": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", - "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", "dev": true, "requires": { "ms": "2.1.2" @@ -4132,51 +4163,6 @@ "merge2": "^1.3.0", "micromatch": "^4.0.2", "picomatch": "^2.2.1" - }, - "dependencies": { - "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "requires": { - "fill-range": "^7.0.1" - } - }, - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true - }, - "micromatch": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", - "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", - "dev": true, - "requires": { - "braces": "^3.0.1", - "picomatch": "^2.0.5" - } - }, - "to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "requires": { - "is-number": "^7.0.0" - } - } } }, "fast-json-stable-stringify": { @@ -4186,9 +4172,9 @@ "dev": true }, "fastq": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.8.0.tgz", - "integrity": "sha512-SMIZoZdLh/fgofivvIkmknUXyPnvxRE3DhtZ5Me3Mrsk5gyPL42F0xr51TdRXskBxHfMp+07bcYzfsYEsSQA9Q==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.9.0.tgz", + "integrity": "sha512-i7FVWL8HhVY+CTkwFxkN2mk3h+787ixS5S63eb78diVRc1MCssarHq3W5cj0av7YDSwmaV928RNag+U1etRQ7w==", "dev": true, "requires": { "reusify": "^1.0.4" @@ -4819,39 +4805,6 @@ "please-upgrade-node": "^3.2.0", "slash": "^3.0.0", "which-pm-runs": "^1.0.0" - }, - "dependencies": { - "cosmiconfig": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.0.tgz", - "integrity": "sha512-pondGvTuVYDk++upghXJabWzL6Kxu6f26ljFw64Swq9v6sQPUL3EUlVDV56diOjpCayKihL6hVe8exIACU4XcA==", - "dev": true, - "requires": { - "@types/parse-json": "^4.0.0", - "import-fresh": "^3.2.1", - "parse-json": "^5.0.0", - "path-type": "^4.0.0", - "yaml": "^1.10.0" - } - }, - "parse-json": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.1.0.tgz", - "integrity": "sha512-+mi/lmVVNKFNVyLXV31ERiy2CY5E1/F6QtJFEzoChPRwwngMNXRDQ9GJ5WdE2Z2P4AujsOi0/+2qHID68KwfIQ==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "error-ex": "^1.3.1", - "json-parse-even-better-errors": "^2.3.0", - "lines-and-columns": "^1.1.6" - } - }, - "yaml": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.0.tgz", - "integrity": "sha512-yr2icI4glYaNG+KWONODapy2/jDdMSDnrONSjblABjD9B4Z5LgiircSt8m8sRZFNi08kG9Sm0uSHtEmP3zaEGg==", - "dev": true - } } }, "iconv-lite": { @@ -4870,9 +4823,9 @@ "dev": true }, "ignore": { - "version": "5.1.4", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.4.tgz", - "integrity": "sha512-MzbUSahkTW1u7JpKKjY7LCARd1fU5W2rLdxlM4kdkayuCwZImjkpluF9CM1aLewYJguPDqewLam18Y6AU69A8A==", + "version": "5.1.8", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", + "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", "dev": true }, "ignore-walk": { @@ -5078,6 +5031,12 @@ "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=", "dev": true }, + "is-plain-object": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", + "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", + "dev": true + }, "is-regex": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.1.tgz", @@ -5317,6 +5276,24 @@ "integrity": "sha512-qjdpeo2yKlYTH7nFdK0vbZWuTCesk4o63v5iVOlhMQPfuIZQfW/HI35SjfhA+4qpg36rnFSvUK5b1m+ckIblQQ==", "dev": true }, + "jest-diff": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-26.6.2.tgz", + "integrity": "sha512-6m+9Z3Gv9wN0WFVasqjCL/06+EFCMTqDEUl/b87HYK2rAPTyfz4ZIuSlPhY51PIQRWx5TaxeF1qmXKe9gfN3sA==", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "diff-sequences": "^26.6.2", + "jest-get-type": "^26.3.0", + "pretty-format": "^26.6.2" + } + }, + "jest-get-type": { + "version": "26.3.0", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-26.3.0.tgz", + "integrity": "sha512-TpfaviN1R2pQWkIihlfEanwOXK0zcxrKEE4MlU6Tn7keoXdN6/3gK/xl0yEh8DOunn5pOVGKf8hB4R9gVh04ig==", + "dev": true + }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -5662,10 +5639,21 @@ } }, "karma-jasmine": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/karma-jasmine/-/karma-jasmine-1.1.2.tgz", - "integrity": "sha1-OU8rJf+0pkS5rabyLUQ+L9CIhsM=", - "dev": true + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/karma-jasmine/-/karma-jasmine-4.0.1.tgz", + "integrity": "sha512-h8XDAhTiZjJKzfkoO1laMH+zfNlra+dEQHUAjpn5JV1zCPtOIVWGQjLBrqhnzQa/hrU2XrZwSyBa6XjEBzfXzw==", + "dev": true, + "requires": { + "jasmine-core": "^3.6.0" + }, + "dependencies": { + "jasmine-core": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.6.0.tgz", + "integrity": "sha512-8uQYa7zJN8hq9z+g8z1bqCfdC8eoDAeVnM5sfqs7KHv9/ifoJ500m018fpFc7RDaO6SWCLCXwo/wPSNcdYTgcw==", + "dev": true + } + } }, "karma-junit-reporter": { "version": "2.0.1", @@ -5819,20 +5807,20 @@ "dev": true }, "lint-staged": { - "version": "10.4.2", - "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-10.4.2.tgz", - "integrity": "sha512-OLCA9K1hS+Sl179SO6kX0JtnsaKj/MZalEhUj5yAgXsb63qPI/Gfn6Ua1KuZdbfkZNEu3/n5C/obYCu70IMt9g==", + "version": "10.5.1", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-10.5.1.tgz", + "integrity": "sha512-fTkTGFtwFIJJzn/PbUO3RXyEBHIhbfYBE7+rJyLcOXabViaO/h6OslgeK6zpeUtzkDrzkgyAYDTLAwx6JzDTHw==", "dev": true, "requires": { "chalk": "^4.1.0", "cli-truncate": "^2.1.0", - "commander": "^6.0.0", + "commander": "^6.2.0", "cosmiconfig": "^7.0.0", - "debug": "^4.1.1", + "debug": "^4.2.0", "dedent": "^0.7.0", "enquirer": "^2.3.6", - "execa": "^4.0.3", - "listr2": "^2.6.0", + "execa": "^4.1.0", + "listr2": "^3.2.2", "log-symbols": "^4.0.0", "micromatch": "^4.0.2", "normalize-path": "^3.0.0", @@ -5841,34 +5829,12 @@ "stringify-object": "^3.3.0" }, "dependencies": { - "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "requires": { - "fill-range": "^7.0.1" - } - }, "commander": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-6.1.0.tgz", - "integrity": "sha512-wl7PNrYWd2y5mp1OK/LhTlv8Ff4kQJQRXXAvF+uU/TPNiVJUxZLRYGj/B0y/lPGAVcSbJqH2Za/cvHmrPMC8mA==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.0.tgz", + "integrity": "sha512-zP4jEKbe8SHzKJYQmq8Y9gYjtO/POJLgIdKgV7B9qNmABVFVc+ctqSX6iXh4mCpJfRBOabiZ2YKPg8ciDw6C+Q==", "dev": true }, - "cosmiconfig": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.0.tgz", - "integrity": "sha512-pondGvTuVYDk++upghXJabWzL6Kxu6f26ljFw64Swq9v6sQPUL3EUlVDV56diOjpCayKihL6hVe8exIACU4XcA==", - "dev": true, - "requires": { - "@types/parse-json": "^4.0.0", - "import-fresh": "^3.2.1", - "parse-json": "^5.0.0", - "path-type": "^4.0.0", - "yaml": "^1.10.0" - } - }, "cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -5881,18 +5847,18 @@ } }, "debug": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", - "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", "dev": true, "requires": { "ms": "2.1.2" } }, "execa": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/execa/-/execa-4.0.3.tgz", - "integrity": "sha512-WFDXGHckXPWZX19t1kCsXzOpqX9LWYNqn4C+HqZlk/V0imTkzJZqf87ZBhvpHaftERYknpk0fjSylnXVlVgI0A==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-4.1.0.tgz", + "integrity": "sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA==", "dev": true, "requires": { "cross-spawn": "^7.0.0", @@ -5906,15 +5872,6 @@ "strip-final-newline": "^2.0.0" } }, - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "requires": { - "to-regex-range": "^5.0.1" - } - }, "get-stream": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", @@ -5924,34 +5881,12 @@ "pump": "^3.0.0" } }, - "is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true - }, "is-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", "dev": true }, - "micromatch": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", - "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", - "dev": true, - "requires": { - "braces": "^3.0.1", - "picomatch": "^2.0.5" - } - }, - "mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true - }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -5967,39 +5902,12 @@ "path-key": "^3.0.0" } }, - "onetime": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", - "dev": true, - "requires": { - "mimic-fn": "^2.1.0" - } - }, - "parse-json": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.1.0.tgz", - "integrity": "sha512-+mi/lmVVNKFNVyLXV31ERiy2CY5E1/F6QtJFEzoChPRwwngMNXRDQ9GJ5WdE2Z2P4AujsOi0/+2qHID68KwfIQ==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "error-ex": "^1.3.1", - "json-parse-even-better-errors": "^2.3.0", - "lines-and-columns": "^1.1.6" - } - }, "path-key": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", "dev": true }, - "path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "dev": true - }, "shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -6015,15 +5923,6 @@ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "dev": true }, - "to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "requires": { - "is-number": "^7.0.0" - } - }, "which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -6032,19 +5931,13 @@ "requires": { "isexe": "^2.0.0" } - }, - "yaml": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.0.tgz", - "integrity": "sha512-yr2icI4glYaNG+KWONODapy2/jDdMSDnrONSjblABjD9B4Z5LgiircSt8m8sRZFNi08kG9Sm0uSHtEmP3zaEGg==", - "dev": true } } }, "listr2": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/listr2/-/listr2-2.6.2.tgz", - "integrity": "sha512-6x6pKEMs8DSIpA/tixiYY2m/GcbgMplMVmhQAaLFxEtNSKLeWTGjtmU57xvv6QCm2XcqzyNXL/cTSVf4IChCRA==", + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/listr2/-/listr2-3.2.2.tgz", + "integrity": "sha512-AajqcZEUikF2ioph6PfH3dIuxJclhr3i3kHgTOP0xeXdWQohrvJAAmqVcV43/GI987HFY/vzT73jYXoa4esDHg==", "dev": true, "requires": { "chalk": "^4.1.0", @@ -6053,7 +5946,7 @@ "indent-string": "^4.0.0", "log-update": "^4.0.0", "p-map": "^4.0.0", - "rxjs": "^6.6.2", + "rxjs": "^6.6.3", "through": "^2.3.8" }, "dependencies": { @@ -6219,61 +6112,12 @@ "wrap-ansi": "^6.2.0" }, "dependencies": { - "ansi-escapes": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.1.tgz", - "integrity": "sha512-JWF7ocqNrp8u9oqpgV+wH5ftbt+cfvv+PTjOvKLT3AdYly/LmORARfEVT1iyjwN+4MqE5UmVKoAdIBqeoCHgLA==", - "dev": true, - "requires": { - "type-fest": "^0.11.0" - } - }, - "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", - "dev": true - }, - "cli-cursor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", - "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", - "dev": true, - "requires": { - "restore-cursor": "^3.1.0" - } - }, "is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true }, - "mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true - }, - "onetime": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", - "dev": true, - "requires": { - "mimic-fn": "^2.1.0" - } - }, - "restore-cursor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", - "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", - "dev": true, - "requires": { - "onetime": "^5.1.0", - "signal-exit": "^3.0.2" - } - }, "slice-ansi": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", @@ -6305,12 +6149,6 @@ "ansi-regex": "^5.0.0" } }, - "type-fest": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.11.0.tgz", - "integrity": "sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ==", - "dev": true - }, "wrap-ansi": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", @@ -6355,28 +6193,15 @@ } }, "lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", + "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", "dev": true, "requires": { - "yallist": "^4.0.0" - }, - "dependencies": { - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - } + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" } }, - "macos-release": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/macos-release/-/macos-release-2.4.1.tgz", - "integrity": "sha512-H/QHeBIN1fIGJX517pvK8IEK53yQOW7YcEI55oYtgjDdoCQQz7eJS94qt5kNrscReEyuD/JcdFCm2XBEcGOITg==", - "dev": true - }, "make-dir": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", @@ -6407,9 +6232,9 @@ "dev": true }, "marked": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/marked/-/marked-1.2.4.tgz", - "integrity": "sha512-6x5TFGCTKSQBLTZtOburGxCxFEBJEGYVLwCMTBCxzvyuisGcC20UNzDSJhCr/cJ/Kmh6ulfJm10g6WWEAJ3kvg==", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/marked/-/marked-1.2.5.tgz", + "integrity": "sha512-2AlqgYnVPOc9WDyWu7S5DJaEZsfk6dNh/neatQ3IHUW4QLutM/VPSH9lG7bif+XjFWc9K9XR3QvR+fXuECmfdA==", "dev": true }, "marked-terminal": { @@ -6735,12 +6560,6 @@ "integrity": "sha1-5tq3/r9a2Bbqgc9cYpxaDr3nLBo=", "dev": true }, - "nice-try": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", - "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", - "dev": true - }, "node-emoji": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-1.10.0.tgz", @@ -10416,16 +10235,6 @@ "mem": "^1.1.0" } }, - "os-name": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/os-name/-/os-name-3.1.0.tgz", - "integrity": "sha512-h8L+8aNjNcMpo/mAIBPn5PXCM16iyPGjHNWo6U1YO8sJTMHtEtyczI6QJnLoplswm6goopQkqc7OAnjhWcugVg==", - "dev": true, - "requires": { - "macos-release": "^2.2.0", - "windows-release": "^3.1.0" - } - }, "p-each-series": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-each-series/-/p-each-series-2.2.0.tgz", @@ -10454,10 +10263,21 @@ "dev": true }, "p-limit": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.1.0.tgz", - "integrity": "sha1-sH/y2aXYi+yAYDWJWiurZqJ5iLw=", - "dev": true + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "requires": { + "p-try": "^1.0.0" + }, + "dependencies": { + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "dev": true + } + } }, "p-locate": { "version": "2.0.0", @@ -10713,11 +10533,23 @@ } }, "prettier": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.1.2.tgz", - "integrity": "sha512-16c7K+x4qVlJg9rEbXl7HEGmQyZlG4R9AgP+oHKRMsMsuk8s+ATStlf1NpDqyBI1HpVyfjLOeMhH2LvuNvV5Vg==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.0.tgz", + "integrity": "sha512-yYerpkvseM4iKD/BXLYUkQV5aKt4tQPqaGW6EsZjzyu0r7sVZZNPJW4Y8MyKmicp6t42XUPcBVA+H6sB3gqndw==", "dev": true }, + "pretty-format": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-26.6.2.tgz", + "integrity": "sha512-7AeGuCYNGmycyQbCqd/3PWH4eOoX/OiCa0uphp57NVTeAGdJGaAliecxwBDHYQCIvrW7aDBZCYeNTP/WX69mkg==", + "dev": true, + "requires": { + "@jest/types": "^26.6.2", + "ansi-regex": "^5.0.0", + "ansi-styles": "^4.0.0", + "react-is": "^17.0.1" + } + }, "process": { "version": "0.11.10", "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", @@ -10799,13 +10631,13 @@ "dev": true }, "puppeteer": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-5.4.0.tgz", - "integrity": "sha512-LgTqVW2ClEP4XGAT64FLQ0QWVhdNSRwJp9HfMFVfoJlZHGQu3HUbuBhR1hBow3DXZH1K3b/WfHxt1n8hr2uayw==", + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-5.5.0.tgz", + "integrity": "sha512-OM8ZvTXAhfgFA7wBIIGlPQzvyEETzDjeRa4mZRCRHxYL+GNH5WAuYUQdja3rpWZvkX/JKqmuVgbsxDNsDFjMEg==", "dev": true, "requires": { "debug": "^4.1.0", - "devtools-protocol": "0.0.809251", + "devtools-protocol": "0.0.818844", "extract-zip": "^2.0.0", "https-proxy-agent": "^4.0.0", "node-fetch": "^2.6.1", @@ -10819,9 +10651,9 @@ }, "dependencies": { "debug": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", - "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", "dev": true, "requires": { "ms": "2.1.2" @@ -10914,6 +10746,12 @@ "strip-json-comments": "~2.0.1" } }, + "react-is": { + "version": "17.0.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.1.tgz", + "integrity": "sha512-NAnt2iGDXohE5LI7uBnLnqvLQMtzhkiAOLXTmv+qnF9Ky7xAPcX8Up/xWIhxvLVGJvuLiNc4xQLtuqDRzb4fSA==", + "dev": true + }, "read-pkg": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", @@ -10980,7 +10818,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -11116,6 +10954,16 @@ "global-dirs": "^0.1.1" } }, + "restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "dev": true, + "requires": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + } + }, "retry": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", @@ -11154,24 +11002,24 @@ } }, "run-parallel": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.1.9.tgz", - "integrity": "sha512-DEqnSRTDw/Tc3FXf49zedI638Z9onwUotBMiUFKmrO2sdFKIbXamXGQ3Axd4qgphxKB4kw/qP1w5kTxnfU1B9Q==", + "version": "1.1.10", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.1.10.tgz", + "integrity": "sha512-zb/1OuZ6flOlH6tQyMPUrE3x3Ulxjlo9WIVXR4yVYi4H9UXQaeIsPbLn2R3O3vQCnDKkAl2qHiuocKKX4Tz/Sw==", "dev": true }, "rxjs": { - "version": "6.5.5", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.5.tgz", - "integrity": "sha512-WfQI+1gohdf0Dai/Bbmk5L5ItH5tYqm3ki2c5GdWhKjalzjg93N3avFjVStyZZz+A2Em+ZxKH5bNghw9UeylGQ==", + "version": "6.6.3", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.3.tgz", + "integrity": "sha512-trsQc+xYYXZ3urjOiJOuCOa5N3jAZ3eiSpQB5hIT8zGlL2QfnHLJ2r7GMkBGuIausdJN1OneaI6gQlsqNHHmZQ==", "dev": true, "requires": { "tslib": "^1.9.0" }, "dependencies": { "tslib": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz", - "integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==", + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true } } @@ -11189,9 +11037,9 @@ "dev": true }, "semantic-release": { - "version": "17.2.3", - "resolved": "https://registry.npmjs.org/semantic-release/-/semantic-release-17.2.3.tgz", - "integrity": "sha512-MY1MlowGQrkOR7+leOD8ICkVOC6i1szbwDODdbJ0UdshtMx8Ms0bhpRQmEEliqYKEb5PLv/dqs6zKKuHT7UxTg==", + "version": "17.2.4", + "resolved": "https://registry.npmjs.org/semantic-release/-/semantic-release-17.2.4.tgz", + "integrity": "sha512-NcYFT+duzg+eE57s9lZYRRkxzyiXGvwFdPvS4U+8TYo+vb0UZpQuFi63hFgoLAOF4lo5yj2v79GsG9hDC66EQw==", "dev": true, "requires": { "@semantic-release/commit-analyzer": "^8.0.0", @@ -11224,12 +11072,6 @@ "yargs": "^15.0.1" }, "dependencies": { - "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", - "dev": true - }, "cliui": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", @@ -11241,6 +11083,19 @@ "wrap-ansi": "^6.2.0" } }, + "cosmiconfig": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-6.0.0.tgz", + "integrity": "sha512-xb3ZL6+L8b9JLLCx3ZdoZy4+2ECphCMo2PwqgP1tlfVq6M6YReyzBJtvWWtbDSpNr9hn96pkCiZqUcFEc+54Qg==", + "dev": true, + "requires": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.1.0", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.7.2" + } + }, "cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -11253,9 +11108,9 @@ } }, "debug": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", - "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", "dev": true, "requires": { "ms": "2.1.2" @@ -11314,6 +11169,15 @@ "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", "dev": true }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -11457,6 +11321,12 @@ "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", "dev": true }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, "yargs": { "version": "15.4.1", "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", @@ -12140,6 +12010,14 @@ "dev": true, "requires": { "ansi-regex": "^2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + } } }, "strip-bom": { @@ -12217,15 +12095,15 @@ } }, "tar-fs": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.0.tgz", - "integrity": "sha512-9uW5iDvrIMCVpvasdFHW0wJPez0K4JnMZtsuIeDI7HyMGJNxmDZDOCQROr7lXyS+iL/QMpj07qcjGYTSdRFXUg==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz", + "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==", "dev": true, "requires": { "chownr": "^1.1.1", "mkdirp-classic": "^0.5.2", "pump": "^3.0.0", - "tar-stream": "^2.0.0" + "tar-stream": "^2.1.4" } }, "tar-stream": { @@ -12590,9 +12468,9 @@ } }, "typescript": { - "version": "3.9.7", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.7.tgz", - "integrity": "sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.2.tgz", + "integrity": "sha512-thGloWsGH3SOxv1SoY7QojKi0tc+8FnOmiarEGMbd/lar7QOEd3hvlx3Fp5y6FlDUGl9L+pd4n2e+oToGMmhRQ==", "dev": true }, "ua-parser-js": { @@ -12628,13 +12506,10 @@ } }, "universal-user-agent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-5.0.0.tgz", - "integrity": "sha512-B5TPtzZleXyPrUMKCpEHFmVhMN6EhmJYjG5PQna9s7mXeSqGTLap4OpqLl5FCEFUI3UBmllkETwKf/db66Y54Q==", - "dev": true, - "requires": { - "os-name": "^3.1.0" - } + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz", + "integrity": "sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w==", + "dev": true }, "universalify": { "version": "0.1.2", @@ -12834,60 +12709,6 @@ } } }, - "windows-release": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/windows-release/-/windows-release-3.3.3.tgz", - "integrity": "sha512-OSOGH1QYiW5yVor9TtmXKQvt2vjQqbYS+DqmsZw+r7xDwLXEeT3JGW0ZppFmHx4diyXmxt238KFR3N9jzevBRg==", - "dev": true, - "requires": { - "execa": "^1.0.0" - }, - "dependencies": { - "cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "dev": true, - "requires": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, - "execa": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", - "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", - "dev": true, - "requires": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - }, - "get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", - "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - } - } - }, "wordwrap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", diff --git a/package.json b/package.json index 2d9100c453..94e5a062db 100644 --- a/package.json +++ b/package.json @@ -53,8 +53,8 @@ "e2e": "npm run build && npm run i:a && npm run clear:a && npm run s:a && npm run s:test:a && npm run test:a", "clean": "rm -rf dist test-reports tmp", "commit": "npx git-cz", - "lint": "tslint --project tsconfig.json", - "lint:fix": "tslint --project tsconfig.json --fix", + "lint": "tslint --project tsconfig.spec.json", + "lint:fix": "tslint --project tsconfig.spec.json --fix", "prettier:repo": "prettier --write \"**/*.*\"", "prettier:check": "prettier -c \"**/*.*\"", "prettier:stage": "pretty-quick --staged", @@ -75,7 +75,7 @@ }, "repository": { "type": "git", - "url": "github.com:ike18t/ng-mocks.git" + "url": "https://github.com/ike18t/ng-mocks.git" }, "keywords": [ "angular unit tests", @@ -110,7 +110,7 @@ "bugs": { "url": "https://github.com/ike18t/ng-mocks/issues" }, - "homepage": "https://www.npmjs.com/package/ng-mocks", + "homepage": "https://ng-mocks.github.io/", "peerDependencies": { "@angular/compiler": ">=5.x <=11.x", "@angular/core": ">=5.x <=11.x", @@ -118,26 +118,26 @@ "@angular/platform-browser": ">=5.x <=11.x" }, "devDependencies": { - "@angular/animations": "^11.0.0", - "@angular/common": "^11.0.0", - "@angular/compiler": "^11.0.0", - "@angular/core": "^11.0.0", - "@angular/forms": "^11.0.0", - "@angular/platform-browser": "^11.0.0", - "@angular/platform-browser-dynamic": "^11.0.0", - "@angular/router": "^11.0.0", + "@angular/animations": "^11.0.2", + "@angular/common": "^11.0.2", + "@angular/compiler": "^11.0.2", + "@angular/core": "^11.0.2", + "@angular/forms": "^11.0.2", + "@angular/platform-browser": "^11.0.2", + "@angular/platform-browser-dynamic": "^11.0.2", + "@angular/router": "^11.0.2", "@commitlint/cli": "^11.0.0", "@commitlint/config-conventional": "^11.0.0", "@semantic-release/changelog": "^5.0.1", "@semantic-release/exec": "^5.0.0", "@semantic-release/git": "^9.0.0", - "@semantic-release/github": "^7.1.1", - "@types/core-js": "^2.5.3", - "@types/jasmine": "2.8.9", - "@types/jest": "^22.2.3", - "@types/node": "^10.17.27", + "@semantic-release/github": "^7.2.0", + "@types/core-js": "^2.5.4", + "@types/jasmine": "^3.6.2", + "@types/jest": "^26.0.15", + "@types/node": "^10.17.46", "codecov": "^3.8.1", - "core-js": "^2.6.11", + "core-js": "^3.7.0", "coveralls": "^3.1.0", "husky": "^4.3.0", "jasmine-ts": "~0.2.1", @@ -145,18 +145,18 @@ "karma-chrome-launcher": "^3.1.0", "karma-coverage": "^2.0.3", "karma-ie-launcher": "^1.0.0", - "karma-jasmine": "^1.1.2", + "karma-jasmine": "^4.0.1", "karma-junit-reporter": "^2.0.1", "karma-typescript": "^5.2.0", - "lint-staged": "^10.4.2", - "prettier": "^2.1.2", - "puppeteer": "~5.4.0", - "rxjs": "~6.5.5", - "semantic-release": "^17.2.1", + "lint-staged": "^10.5.1", + "prettier": "^2.2.0", + "puppeteer": "~5.5.0", + "rxjs": "~6.6.3", + "semantic-release": "^17.2.4", "tslib": "^2.0.3", - "tslint": "~6.1.3", + "tslint": "^6.1.3", "tslint-jasmine-rules": "^1.6.1", - "typescript": "~3.9.7", + "typescript": "~4.1.2", "zone.js": "~0.10.3" }, "husky": { diff --git a/tests/NG_MOCKS_ROOT_PROVIDERS/test.spec.ts b/tests/NG_MOCKS_ROOT_PROVIDERS/test.spec.ts index da0291995f..512eaca096 100644 --- a/tests/NG_MOCKS_ROOT_PROVIDERS/test.spec.ts +++ b/tests/NG_MOCKS_ROOT_PROVIDERS/test.spec.ts @@ -21,7 +21,7 @@ class Target1Service { class Target1Component { public readonly service: Target1Service; - constructor(service: Target1Service) { + public constructor(service: Target1Service) { this.service = service; } } @@ -46,7 +46,7 @@ class Target2Service { class Target2Component { public readonly service: Target2Service; - constructor(service: Target2Service) { + public constructor(service: Target2Service) { this.service = service; } } diff --git a/tests/abstract-methods-provider/test.spec.ts b/tests/abstract-methods-provider/test.spec.ts index b92143c0c7..33d18f783a 100644 --- a/tests/abstract-methods-provider/test.spec.ts +++ b/tests/abstract-methods-provider/test.spec.ts @@ -4,14 +4,14 @@ import { MockBuilder } from 'ng-mocks'; @Injectable() abstract class LoggerInterface { - abstract log(message: string): void; + public abstract log(message: string): void; } @Injectable() class Logger implements LoggerInterface { public lastMessage = ''; - log(message: string): void { + public log(message: string): void { this.lastMessage = message; } } diff --git a/tests/context-with-directives/context-with-directives.spec.ts b/tests/context-with-directives/context-with-directives.spec.ts index 4f0d8f1e56..e9ca1f93e0 100644 --- a/tests/context-with-directives/context-with-directives.spec.ts +++ b/tests/context-with-directives/context-with-directives.spec.ts @@ -32,17 +32,17 @@ describe('context-with-directives:real', () => { // template should be rendered under .template expect(ngMocks.find(fixture.debugElement, '.template').nativeElement.innerHTML.replace(/\s+/gm, ' ')).toContain( - ' template w/ directive w/o binding ' + ' template w/ directive w/o binding ', ); // template1 should be rendered under .template1 expect(ngMocks.find(fixture.debugElement, '.template1').nativeElement.innerHTML.replace(/\s+/gm, ' ')).toContain( - ' template w/ directive w/ binding 1 ' + ' template w/ directive w/ binding 1 ', ); // template2 should not be rendered expect(fixture.nativeElement.innerHTML.replace(/\s+/gm, ' ')).not.toContain( - ' template w/ directive w/ binding w/o render ' + ' template w/ directive w/ binding w/o render ', ); // unused ng-templates shouldn't be rendered at all @@ -51,10 +51,10 @@ describe('context-with-directives:real', () => { // ng-content contains header and footer expect(ngMocks.find(fixture.debugElement, '.nested').nativeElement.innerHTML.replace(/\s+/, ' ')).toContain( - '
header
' + '
header
', ); expect(ngMocks.find(fixture.debugElement, '.nested').nativeElement.innerHTML.replace(/\s+/, ' ')).toContain( - '
footer
' + '
footer
', ); }); }); diff --git a/tests/context-with-directives/custom-root.component.ts b/tests/context-with-directives/custom-root.component.ts index d9abe87d15..d9dff1cd2a 100644 --- a/tests/context-with-directives/custom-root.component.ts +++ b/tests/context-with-directives/custom-root.component.ts @@ -22,9 +22,9 @@ export class CustomRootComponent implements AfterContentInit { public template: TemplateRef; public template1: TemplateRef; public template2: TemplateRef; - @ContentChildren(CustomTypeDirective) templates: QueryList; + @ContentChildren(CustomTypeDirective) public templates: QueryList; - ngAfterContentInit(): void { + public ngAfterContentInit(): void { this.templates.forEach((template: CustomTypeDirective) => { switch (template.type) { case 'template1': diff --git a/tests/context-with-directives/custom-type.directive.ts b/tests/context-with-directives/custom-type.directive.ts index aaeaed26e1..4949247e75 100644 --- a/tests/context-with-directives/custom-type.directive.ts +++ b/tests/context-with-directives/custom-type.directive.ts @@ -5,9 +5,9 @@ import { Directive, Input, TemplateRef } from '@angular/core'; }) export class CustomTypeDirective { public template: TemplateRef; - @Input('type') type: string; + @Input('type') public type: string; - constructor(template: TemplateRef) { + public constructor(template: TemplateRef) { this.template = template; } } diff --git a/tests/control-value-accessor-form-control/fixtures.ts b/tests/control-value-accessor-form-control/fixtures.ts index 5bf4d5500f..72c9a3b041 100644 --- a/tests/control-value-accessor-form-control/fixtures.ts +++ b/tests/control-value-accessor-form-control/fixtures.ts @@ -26,29 +26,29 @@ export class ControlComponent implements ControlValueAccessor { public value: any; public change: any = () => undefined; - changeTouch(): void { + public changeTouch(): void { this.touch(); } - changeValue(obj: any): void { + public changeValue(obj: any): void { this.change(obj); } - registerOnChange(fn: any): void { + public registerOnChange(fn: any): void { this.change = fn; } - registerOnTouched(fn: any): void { + public registerOnTouched(fn: any): void { this.touch = fn; } - setDisabledState(isDisabled: boolean): void { + public setDisabledState(isDisabled: boolean): void { this.isDisabled = isDisabled; } public touch: any = () => undefined; - writeValue(obj: any): void { + public writeValue(obj: any): void { this.value = obj; } } diff --git a/tests/control-value-accessor-ng-model/fixtures.ts b/tests/control-value-accessor-ng-model/fixtures.ts index c423dfcbe3..bb4b17d6ab 100644 --- a/tests/control-value-accessor-ng-model/fixtures.ts +++ b/tests/control-value-accessor-ng-model/fixtures.ts @@ -35,29 +35,29 @@ export class ControlComponent implements ControlValueAccessor { public value: any; public change: any = () => undefined; - changeTouch(): void { + public changeTouch(): void { this.touch(); } - changeValue(obj: any): void { + public changeValue(obj: any): void { this.change(obj); } - registerOnChange(fn: any): void { + public registerOnChange(fn: any): void { this.change = fn; } - registerOnTouched(fn: any): void { + public registerOnTouched(fn: any): void { this.touch = fn; } - setDisabledState(isDisabled: boolean): void { + public setDisabledState(isDisabled: boolean): void { this.isDisabled = isDisabled; } public touch: any = () => undefined; - writeValue(obj: any): void { + public writeValue(obj: any): void { this.value = obj; } } diff --git a/tests/correct-module-exports-11/test.spec.ts b/tests/correct-module-exports-11/test.spec.ts index ef63f130d6..016d853061 100644 --- a/tests/correct-module-exports-11/test.spec.ts +++ b/tests/correct-module-exports-11/test.spec.ts @@ -43,7 +43,7 @@ describe('correct-module-exports-11:proper', () => { beforeEach(() => TestBed.configureTestingModule({ imports: [MockModule(TargetModule)], - }).compileComponents() + }).compileComponents(), ); it('fails on not exported module', () => { diff --git a/tests/double-decorator/example-1.spec.ts b/tests/double-decorator/example-1.spec.ts index 05ed6f58d1..80d4352beb 100644 --- a/tests/double-decorator/example-1.spec.ts +++ b/tests/double-decorator/example-1.spec.ts @@ -26,7 +26,7 @@ class TargetProvider extends TargetDirective { class TargetComponent { public readonly service: TargetProvider; - constructor(service: TargetProvider) { + public constructor(service: TargetProvider) { this.service = service; } } @@ -42,7 +42,7 @@ describe('double-decorator:example-1', () => { beforeEach(() => TestBed.configureTestingModule({ imports: [TargetModule], - }).compileComponents() + }).compileComponents(), ); it('provides correct service', () => { diff --git a/tests/double-decorator/example-2.spec.ts b/tests/double-decorator/example-2.spec.ts index 38212a1951..018875bf6a 100644 --- a/tests/double-decorator/example-2.spec.ts +++ b/tests/double-decorator/example-2.spec.ts @@ -26,7 +26,7 @@ class TargetProvider extends TargetDirective { class TargetComponent { public readonly service: TargetProvider; - constructor(service: TargetProvider) { + public constructor(service: TargetProvider) { this.service = service; } } @@ -42,7 +42,7 @@ describe('double-decorator:example-2', () => { beforeEach(() => TestBed.configureTestingModule({ imports: [TargetModule], - }).compileComponents() + }).compileComponents(), ); it('provides correct service', () => { diff --git a/tests/double-decorator/example-3.spec.ts b/tests/double-decorator/example-3.spec.ts index 45782b128d..b2683a4d80 100644 --- a/tests/double-decorator/example-3.spec.ts +++ b/tests/double-decorator/example-3.spec.ts @@ -1,3 +1,5 @@ +// tslint:disable:no-void-expression + import { Component, Directive as DirectiveSource, Injectable, NgModule } from '@angular/core'; import { TestBed } from '@angular/core/testing'; import { MockBuilder, MockInstance, MockRender, MockReset, ngMocks } from 'ng-mocks'; @@ -22,7 +24,7 @@ class BaseClass { class MyComponent { public readonly service: BaseClass; - constructor(service: BaseClass) { + public constructor(service: BaseClass) { this.service = service; } } diff --git a/tests/double-decorator/with-selector.spec.ts b/tests/double-decorator/with-selector.spec.ts index 0cc2a53807..92c5f3e1d9 100644 --- a/tests/double-decorator/with-selector.spec.ts +++ b/tests/double-decorator/with-selector.spec.ts @@ -1,3 +1,5 @@ +// tslint:disable:no-void-expression + import { Component, Directive as DirectiveSource, Injectable, NgModule } from '@angular/core'; import { TestBed } from '@angular/core/testing'; import { MockBuilder, MockInstance, MockRender, MockReset, ngMocks } from 'ng-mocks'; @@ -26,7 +28,7 @@ class MyProvider extends BaseClass {} class MyComponent { public readonly service: MyProvider; - constructor(service: MyProvider) { + public constructor(service: MyProvider) { this.service = service; } } diff --git a/tests/double-decorator/without-selector-ivy.spec.ts b/tests/double-decorator/without-selector-ivy.spec.ts index 0bc95e5e4a..c99767a847 100644 --- a/tests/double-decorator/without-selector-ivy.spec.ts +++ b/tests/double-decorator/without-selector-ivy.spec.ts @@ -1,3 +1,5 @@ +// tslint:disable:no-duplicate-imports + import * as core from '@angular/core'; import { Component, Directive as DirectiveSource, Injectable, NgModule } from '@angular/core'; import { TestBed } from '@angular/core/testing'; @@ -25,7 +27,7 @@ class MyProvider extends BaseClass {} class MyComponent { public readonly service: MyProvider; - constructor(service: MyProvider) { + public constructor(service: MyProvider) { this.service = service; } } diff --git a/tests/double-decorator/without-selector.spec.ts b/tests/double-decorator/without-selector.spec.ts index b39505da07..a0928e170f 100644 --- a/tests/double-decorator/without-selector.spec.ts +++ b/tests/double-decorator/without-selector.spec.ts @@ -1,3 +1,5 @@ +// tslint:disable:no-duplicate-imports + import { Component, Directive as DirectiveSource, Injectable, NgModule } from '@angular/core'; import * as core from '@angular/core'; import { TestBed } from '@angular/core/testing'; @@ -25,7 +27,7 @@ class MyProvider extends BaseClass {} class MyComponent { public readonly service: MyProvider; - constructor(service: MyProvider) { + public constructor(service: MyProvider) { this.service = service; } } diff --git a/tests/export-all/test.spec.ts b/tests/export-all/test.spec.ts index b7d769d735..150ac371f6 100644 --- a/tests/export-all/test.spec.ts +++ b/tests/export-all/test.spec.ts @@ -50,7 +50,7 @@ describe('export-all', () => { // The goal is to get access to declarations of the mock TargetModule // when TargetComponent is used externally. describe('valid', () => { - beforeEach(() => { + beforeEach(async () => { // Thanks A5 for any const ngModule: any = MockBuilder() .mock(TargetModule, { @@ -85,14 +85,14 @@ describe('export-all', () => { fail('an error expected'); } catch (e) { expect(e.message).toMatch( - /Multiple components match node with tagname target|The pipe 'target' could not be found/ + /Multiple components match node with tagname target|The pipe 'target' could not be found/, ); } }); }); describe('no-exclude', () => { - beforeEach(() => { + beforeEach(async () => { // Thanks A5 for any const ngModule: any = MockBuilder() .mock(TargetModule, { @@ -108,7 +108,7 @@ describe('export-all', () => { it('fails on no exclude due to a conflict in declarations', () => { expect(() => MockRender(TargetComponent)).toThrowError( - /Multiple components match node with tagname target|Conflicting components: MockOfTargetComponent,TargetComponent/ + /Multiple components match node with tagname target|Conflicting components: MockOfTargetComponent,TargetComponent/, ); }); }); diff --git a/tests/get-inputs-and-outputs/fixtures.ts b/tests/get-inputs-and-outputs/fixtures.ts index 88000035aa..72b656cfe9 100644 --- a/tests/get-inputs-and-outputs/fixtures.ts +++ b/tests/get-inputs-and-outputs/fixtures.ts @@ -5,25 +5,25 @@ import { Component, Directive, EventEmitter, Input, NgModule, Output } from '@an template: '{{ input }}', }) export class TargetComponent { - @Input('input1') input: string; - @Output('output1') output = new EventEmitter(); + @Input('input1') public input: string; + @Output('output1') public output = new EventEmitter(); } @Directive({ selector: 'target', }) export class Target2Directive { - @Input('input2') input: string; - @Input('inputUnused') input2: undefined; - @Output('output2') output = new EventEmitter(); + @Input('input2') public input: string; + @Input('inputUnused') public input2: undefined; + @Output('output2') public output = new EventEmitter(); } @Directive({ selector: 'target', }) export class Target3Directive { - @Input('input3') input: string; - @Output('output3') output = new EventEmitter(); + @Input('input3') public input: string; + @Output('output3') public output = new EventEmitter(); } @NgModule({ diff --git a/tests/get-inputs-and-outputs/test.spec.ts b/tests/get-inputs-and-outputs/test.spec.ts index a019ec808d..812ed40e25 100644 --- a/tests/get-inputs-and-outputs/test.spec.ts +++ b/tests/get-inputs-and-outputs/test.spec.ts @@ -1,3 +1,5 @@ +// tslint:disable:strict-type-predicates + import { MockBuilder, MockRender, ngMocks } from 'ng-mocks'; import { Target2Directive, Target3Directive, TargetComponent, TargetModule } from './fixtures'; @@ -22,7 +24,7 @@ describe('get-inputs-and-outputs', () => { (output2)="output2($event)" (output3)="output3($event)" >`, - params + params, ); const componentElement = fixture.point; @@ -63,7 +65,7 @@ describe('get-inputs-and-outputs', () => { expect(ngMocks.input(componentElement, 'input2')).toEqual('2'); expect(ngMocks.input(componentElement, 'inputUnused')).toEqual(undefined); expect(() => ngMocks.input(componentElement, 'inputUndefined')).toThrowError( - 'Cannot find inputUndefined input via ngMocks.input' + 'Cannot find inputUndefined input via ngMocks.input', ); expect(ngMocks.input(componentElement, 'input3')).toEqual('3'); if ((params.output1 as any).mockReset) { @@ -89,7 +91,7 @@ describe('get-inputs-and-outputs', () => { ngMocks.output(componentElement, 'output3').emit(); expect(params.output3).toHaveBeenCalled(); expect(() => ngMocks.output(componentElement, 'outputUndefined')).toThrowError( - 'Cannot find outputUndefined output via ngMocks.output' + 'Cannot find outputUndefined output via ngMocks.output', ); }); }); diff --git a/tests/injected-ng-templates/custom-injection.component.ts b/tests/injected-ng-templates/custom-injection.component.ts index 453f894806..4042b18dc0 100644 --- a/tests/injected-ng-templates/custom-injection.component.ts +++ b/tests/injected-ng-templates/custom-injection.component.ts @@ -12,7 +12,7 @@ import { staticFalse } from '..'; `, }) export class CustomInjectionComponent { - @ContentChild('block', { ...staticFalse }) injectedBlock: TemplateRef; - @Input() items?: T[]; - @ViewChild('child', { ...staticFalse }) ownChild: ViewContainerRef; + @ContentChild('block', { ...staticFalse }) public injectedBlock: TemplateRef; + @Input() public items?: T[]; + @ViewChild('child', { ...staticFalse }) public ownChild: ViewContainerRef; } diff --git a/tests/injected-ng-templates/injected-ng-templates.spec.ts b/tests/injected-ng-templates/injected-ng-templates.spec.ts index 7167acf5f9..2cb9ffb1ba 100644 --- a/tests/injected-ng-templates/injected-ng-templates.spec.ts +++ b/tests/injected-ng-templates/injected-ng-templates.spec.ts @@ -16,7 +16,7 @@ describe('injected-ng-templates:real', () => { `, { values: ['string1', 'string2', 'string3'], - } + }, ); // every value should be rendered correctly. @@ -44,7 +44,7 @@ describe('structural-directive-as-ng-for:mock', () => { { outside: 'string0', values: ['string1', 'string2', 'string3'], - } + }, ); // By default @ContentChild('block') shouldn't be rendered at all. diff --git a/tests/interceptor-kept-mocked/test.spec.ts b/tests/interceptor-kept-mocked/test.spec.ts index e4bde41245..a6003f8d38 100644 --- a/tests/interceptor-kept-mocked/test.spec.ts +++ b/tests/interceptor-kept-mocked/test.spec.ts @@ -1,11 +1,11 @@ import { - HTTP_INTERCEPTORS, HttpClient, HttpClientModule, HttpEvent, HttpHandler, HttpInterceptor, HttpRequest, + HTTP_INTERCEPTORS, } from '@angular/common/http'; import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; import { Injectable, NgModule } from '@angular/core'; @@ -23,7 +23,7 @@ class Target1Interceptor implements HttpInterceptor { setHeaders: { target1: this.value, }, - }) + }), ); } } @@ -38,7 +38,7 @@ class Target2Interceptor implements HttpInterceptor { setHeaders: { target2: this.value, }, - }) + }), ); } } @@ -68,7 +68,7 @@ describe('interceptor-kept-mock', () => { beforeEach(() => MockBuilder(Target1Interceptor, TargetModule) .keep(HTTP_INTERCEPTORS) - .replace(HttpClientModule, HttpClientTestingModule) + .replace(HttpClientModule, HttpClientTestingModule), ); beforeAll(() => { diff --git a/tests/issue-142/test.spec.ts b/tests/issue-142/test.spec.ts index 2c92ee86d8..f4eb9c2c44 100644 --- a/tests/issue-142/test.spec.ts +++ b/tests/issue-142/test.spec.ts @@ -21,7 +21,7 @@ export class TargetModule { public readonly targetToken: boolean = false; - constructor(@Inject(TARGET_TOKEN) targetToken: boolean) { + public constructor(@Inject(TARGET_TOKEN) targetToken: boolean) { this.targetToken = targetToken; } } @@ -37,7 +37,7 @@ describe('issue-142', () => { TestBed.configureTestingModule({ declarations: [TargetComponent], imports: [MockModule(TargetModule.forRoot())], - }).compileComponents() + }).compileComponents(), ); it('test', () => { diff --git a/tests/issue-151/test.spec.ts b/tests/issue-151/test.spec.ts index 36a35552b3..3ab0013df9 100644 --- a/tests/issue-151/test.spec.ts +++ b/tests/issue-151/test.spec.ts @@ -12,8 +12,8 @@ describe('issue-151', () => { describe('mock AppRoutingModule', () => { beforeEach(() => TestBed.configureTestingModule( - MockBuilder(AppComponent, AppModule).keep(RouterModule).keep(RouterTestingModule).build() - ) + MockBuilder(AppComponent, AppModule).keep(RouterModule).keep(RouterTestingModule).build(), + ), ); beforeEach(async () => { diff --git a/tests/issue-157/test.spec.ts b/tests/issue-157/test.spec.ts index 857a4cbe18..120901c6b8 100644 --- a/tests/issue-157/test.spec.ts +++ b/tests/issue-157/test.spec.ts @@ -4,8 +4,8 @@ import { ControlValueAccessor, FormControl, FormGroup, - NG_VALUE_ACCESSOR, NgControl, + NG_VALUE_ACCESSOR, ReactiveFormsModule, } from '@angular/forms'; import { MockBuilder, MockRender } from 'ng-mocks'; @@ -23,7 +23,7 @@ export class ActualEmptyComponent {} export class ActualInjectionComponent implements ControlValueAccessor { protected value: any = undefined; - constructor(@Self() @Optional() ngControl: NgControl) { + public constructor(@Self() @Optional() ngControl: NgControl) { if (ngControl) { ngControl.valueAccessor = this; } @@ -109,7 +109,7 @@ describe('issue-157:real', () => { TestBed.configureTestingModule({ declarations: [ActualEmptyComponent, ActualInjectionComponent, ActualTokenComponent, ActualTokenDirective], imports: [ReactiveFormsModule], - }).compileComponents() + }).compileComponents(), ); it('does not throw on both declarations of valueAccessor', () => { @@ -126,8 +126,8 @@ describe('issue-157:real', () => { form: new FormGroup({ field: new FormControl(), }), - } - ) + }, + ), ).not.toThrow(); }); @@ -143,8 +143,8 @@ describe('issue-157:real', () => { form: new FormGroup({ field: new FormControl(), }), - } - ) + }, + ), ).toThrow(); }); @@ -160,8 +160,8 @@ describe('issue-157:real', () => { form: new FormGroup({ field: new FormControl(), }), - } - ) + }, + ), ).not.toThrow(); }); @@ -177,8 +177,8 @@ describe('issue-157:real', () => { form: new FormGroup({ field: new FormControl(), }), - } - ) + }, + ), ).toThrow(); }); @@ -194,8 +194,8 @@ describe('issue-157:real', () => { form: new FormGroup({ field: new FormControl(), }), - } - ) + }, + ), ).not.toThrow(); }); @@ -211,8 +211,8 @@ describe('issue-157:real', () => { form: new FormGroup({ field: new FormControl(), }), - } - ) + }, + ), ).toThrow(); }); }); @@ -223,7 +223,7 @@ describe('issue-157:mock', () => { .mock(ActualEmptyComponent) .mock(ActualInjectionComponent) .mock(ActualTokenComponent) - .mock(ActualTokenDirective) + .mock(ActualTokenDirective), ); it('does not throw on both declarations of valueAccessor', () => { @@ -240,8 +240,8 @@ describe('issue-157:mock', () => { form: new FormGroup({ field: new FormControl(), }), - } - ) + }, + ), ).not.toThrow(); }); @@ -257,8 +257,8 @@ describe('issue-157:mock', () => { form: new FormGroup({ field: new FormControl(), }), - } - ) + }, + ), ).toThrow(); }); @@ -274,8 +274,8 @@ describe('issue-157:mock', () => { form: new FormGroup({ field: new FormControl(), }), - } - ) + }, + ), ).not.toThrow(); }); @@ -291,8 +291,8 @@ describe('issue-157:mock', () => { form: new FormGroup({ field: new FormControl(), }), - } - ) + }, + ), ).toThrow(); }); @@ -308,8 +308,8 @@ describe('issue-157:mock', () => { form: new FormGroup({ field: new FormControl(), }), - } - ) + }, + ), ).not.toThrow(); }); @@ -325,8 +325,8 @@ describe('issue-157:mock', () => { form: new FormGroup({ field: new FormControl(), }), - } - ) + }, + ), ).toThrow(); }); }); diff --git a/tests/issue-162/test.spec.ts b/tests/issue-162/test.spec.ts index e7617bd806..06517d47c0 100644 --- a/tests/issue-162/test.spec.ts +++ b/tests/issue-162/test.spec.ts @@ -1,3 +1,5 @@ +// tslint:disable:strict-type-predicates + import { Component, NgModule, RendererFactory2 } from '@angular/core'; import { TestBed } from '@angular/core/testing'; import { BrowserModule, EventManager } from '@angular/platform-browser'; @@ -8,7 +10,7 @@ import { MockBuilder, MockRender, ngMocks } from 'ng-mocks'; template: `click`, }) export class AppComponent { - title = 'ng-routing-test'; + public title = 'ng-routing-test'; } @Component({ @@ -16,7 +18,7 @@ export class AppComponent { template: `click`, }) export class MockComponent { - title = 'ng-routing-test'; + public title = 'ng-routing-test'; } @NgModule({ diff --git a/tests/issue-166/test.spec.ts b/tests/issue-166/test.spec.ts index 193e23b99c..abd9b549fe 100644 --- a/tests/issue-166/test.spec.ts +++ b/tests/issue-166/test.spec.ts @@ -1,4 +1,5 @@ // tslint:enable:no-any no-unsafe-any +// tslint:disable:strict-type-predicates import { MockService, ngMocks } from 'ng-mocks'; import { Observable, Subject } from 'rxjs'; diff --git a/tests/issue-167/NG_VALIDATORS.spec.ts b/tests/issue-167/NG_VALIDATORS.spec.ts index d543526cc0..02ef4db2e1 100644 --- a/tests/issue-167/NG_VALIDATORS.spec.ts +++ b/tests/issue-167/NG_VALIDATORS.spec.ts @@ -1,4 +1,4 @@ -// tslint:disable: prefer-function-over-method variable-name +// tslint:disable:prefer-function-over-method variable-name import { Component, Directive, forwardRef, NgModule } from '@angular/core'; import { TestBed } from '@angular/core/testing'; @@ -25,6 +25,7 @@ export class TargetDirective implements Validator { public validate(): ValidationErrors { this.__validate = []; + return { validator: true, }; @@ -50,7 +51,7 @@ describe('issue-167:NG_VALIDATORS:real', () => { beforeEach(() => TestBed.configureTestingModule({ imports: [TargetModule], - }).compileComponents() + }).compileComponents(), ); it('should trigger validation w/o an error', () => { diff --git a/tests/issue-167/component.spec.ts b/tests/issue-167/component.spec.ts index 6ad4a88048..5f63e9476b 100644 --- a/tests/issue-167/component.spec.ts +++ b/tests/issue-167/component.spec.ts @@ -1,4 +1,4 @@ -// tslint:disable: prefer-function-over-method variable-name +// tslint:disable:prefer-function-over-method variable-name import { Component, forwardRef, NgModule } from '@angular/core'; import { TestBed } from '@angular/core/testing'; @@ -55,6 +55,7 @@ export class TargetComponent implements ControlValueAccessor, Validator { public validate(): ValidationErrors { this.__validate = []; + return { mock: true, }; @@ -87,7 +88,7 @@ describe('issue-167:component:real', () => { beforeEach(() => TestBed.configureTestingModule({ imports: [TargetModule], - }).compileComponents() + }).compileComponents(), ); it('should create an instance', () => { diff --git a/tests/issue-167/directive.spec.ts b/tests/issue-167/directive.spec.ts index 1758346d71..4d6ecf7ac9 100644 --- a/tests/issue-167/directive.spec.ts +++ b/tests/issue-167/directive.spec.ts @@ -1,4 +1,4 @@ -// tslint:disable: prefer-function-over-method variable-name +// tslint:disable:prefer-function-over-method variable-name import { Component, Directive, forwardRef, NgModule } from '@angular/core'; import { TestBed } from '@angular/core/testing'; @@ -54,6 +54,7 @@ export class TargetDirective implements ControlValueAccessor, Validator { public validate(): ValidationErrors { this.__validate = []; + return { mock: true, }; @@ -86,7 +87,7 @@ describe('issue-167:directive:real', () => { beforeEach(() => TestBed.configureTestingModule({ imports: [TargetModule], - }).compileComponents() + }).compileComponents(), ); it('should create an instance', () => { diff --git a/tests/issue-170/test.spec.ts b/tests/issue-170/test.spec.ts index cb512110ad..11cc8d0191 100644 --- a/tests/issue-170/test.spec.ts +++ b/tests/issue-170/test.spec.ts @@ -12,7 +12,7 @@ export class TargetChildService { export class TargetService { public child: TargetChildService; - constructor(child: TargetChildService) { + public constructor(child: TargetChildService) { this.child = child; } @@ -29,7 +29,7 @@ export class TargetService { export class TargetComponent { public service: TargetService; - constructor(service: TargetService) { + public constructor(service: TargetService) { this.service = service; } @@ -48,7 +48,7 @@ export class RealComponent implements AfterViewInit { } as any) protected child: TargetComponent; - ngAfterViewInit() { + public ngAfterViewInit() { this.child.service.print(); this.child.service.child.print(); } diff --git a/tests/issue-172/test.spec.ts b/tests/issue-172/test.spec.ts index 160057f5b2..030bea842f 100644 --- a/tests/issue-172/test.spec.ts +++ b/tests/issue-172/test.spec.ts @@ -31,7 +31,7 @@ class TargetComponent implements OnInit { protected readonly target1Service: Target1Service; protected readonly target2Service: Target2Service; - constructor(target1Service: Target1Service, target2Service: Target2Service) { + public constructor(target1Service: Target1Service, target2Service: Target2Service) { this.target1Service = target1Service; this.target2Service = target2Service; } @@ -51,7 +51,7 @@ describe('issue-172:real', () => { beforeEach(() => TestBed.configureTestingModule({ imports: [TargetModule], - }).compileComponents() + }).compileComponents(), ); it('renders echo', () => { @@ -64,7 +64,7 @@ describe('issue-172:test', () => { beforeEach(() => TestBed.configureTestingModule({ imports: [TargetModule], - }).compileComponents() + }).compileComponents(), ); it('renders echo', () => { @@ -92,7 +92,7 @@ describe('issue-172:mock', () => { beforeEach(() => MockBuilder(TargetComponent, TargetModule).mock(Target1Service, { echo: () => 'MockService', - }) + }), ); it('renders the mock echo', () => { @@ -105,7 +105,7 @@ describe('issue-172:restore', () => { beforeEach(() => TestBed.configureTestingModule({ imports: [TargetModule], - }).compileComponents() + }).compileComponents(), ); it('renders echo', () => { diff --git a/tests/issue-175/test.spec.ts b/tests/issue-175/test.spec.ts index 4efcd63b77..c9e683994a 100644 --- a/tests/issue-175/test.spec.ts +++ b/tests/issue-175/test.spec.ts @@ -18,7 +18,7 @@ class Target2Service {} class Target1Component { public service: Target1Service; - constructor(service: Target1Service) { + public constructor(service: Target1Service) { this.service = service; } } @@ -30,7 +30,7 @@ class Target1Component { class Target2Component { public service: Target2Service; - constructor(service: Target2Service) { + public constructor(service: Target2Service) { this.service = service; } } @@ -42,7 +42,7 @@ class Target2Component { class Target1Directive { public service: Target1Service; - constructor(service: Target1Service) { + public constructor(service: Target1Service) { this.service = service; } } @@ -53,7 +53,7 @@ class Target1Directive { class Target2Directive { public service: Target2Service; - constructor(service: Target2Service) { + public constructor(service: Target2Service) { this.service = service; } } @@ -64,7 +64,7 @@ class Target2Directive { class Target1Pipe implements PipeTransform { protected name = 'pip1'; - transform(): string { + public transform(): string { return this.name; } } @@ -75,7 +75,7 @@ class Target1Pipe implements PipeTransform { class Target2Pipe implements PipeTransform { protected name = 'pip2'; - transform(): string { + public transform(): string { return this.name; } } diff --git a/tests/issue-177/test.spec.ts b/tests/issue-177/test.spec.ts index ad5790bdb0..f72ec3efbc 100644 --- a/tests/issue-177/test.spec.ts +++ b/tests/issue-177/test.spec.ts @@ -1,25 +1,25 @@ -// tslint:disable: prefer-function-over-method no-string-literal +// tslint:disable:prefer-function-over-method no-string-literal -import { MockService } from 'ng-mocks'; +import { MockService, ngMocks } from 'ng-mocks'; class Example { - private _dynamicGet = 'return value from dynamicGet'; + private readonly privateDynamicGet = 'return value from dynamicGet'; - private _dynamicMethod = 'return value from dynamicMethod'; + private readonly privateDynamicMethod = 'return value from dynamicMethod'; - get dynamicGet() { - return this._dynamicGet; + public get dynamicGet() { + return this.privateDynamicGet; } - get hardCodedGet() { + public get hardCodedGet() { return 'return value from hardCodedGet'; } - dynamicMethod() { - return this._dynamicMethod; + public dynamicMethod() { + return this.privateDynamicMethod; } - hardCodedMethod() { + public hardCodedMethod() { return 'return value from hardCodedMethod'; } } @@ -31,7 +31,9 @@ describe('issue-177', () => { // Properties expect(mockExample.hardCodedGet).toBeUndefined(); expect(mockExample.dynamicGet).toBeUndefined(); - mockExample['_dynamicGet'] = 'value set in test to _dynamicGet'; + ngMocks.stub(mockExample, { + privateDynamicGet: 'value set in test to _dynamicGet', + } as any); expect(mockExample.dynamicGet).toBeUndefined(); (mockExample as any).dynamicGet = 'test'; expect(mockExample.dynamicGet).toBe('test'); @@ -39,7 +41,9 @@ describe('issue-177', () => { // Methods expect(mockExample.hardCodedMethod()).toBeUndefined(); expect(mockExample.dynamicMethod()).toBeUndefined(); - mockExample['_dynamicMethod'] = 'value set in test to _dynamicMethod'; + ngMocks.stub(mockExample, { + privateDynamicMethod: 'value set in test to _dynamicMethod', + } as any); expect(mockExample.dynamicMethod()).toBeUndefined(); }); }); diff --git a/tests/issue-178/test.spec.ts b/tests/issue-178/test.spec.ts index 2fb42507d6..3e3cd44e42 100644 --- a/tests/issue-178/test.spec.ts +++ b/tests/issue-178/test.spec.ts @@ -41,7 +41,7 @@ class HelloModule {} describe('issue-178', () => { beforeEach( - () => MockBuilder(HelloComponent, HelloModule).replace(RouterModule, RouterTestingModule) // <- causes the issue + () => MockBuilder(HelloComponent, HelloModule).replace(RouterModule, RouterTestingModule), // <- causes the issue ); it('should create the component', () => { diff --git a/tests/issue-181/test.spec.ts b/tests/issue-181/test.spec.ts index b498962337..d78fc1a6aa 100644 --- a/tests/issue-181/test.spec.ts +++ b/tests/issue-181/test.spec.ts @@ -1,4 +1,4 @@ -// tslint:disable: no-parameter-properties +// tslint:disable:no-parameter-properties import { CommonModule } from '@angular/common'; import { ContentChild, Directive, NgModule } from '@angular/core'; diff --git a/tests/issue-186/test.spec.ts b/tests/issue-186/test.spec.ts index 353cf08852..8fd08763a6 100644 --- a/tests/issue-186/test.spec.ts +++ b/tests/issue-186/test.spec.ts @@ -4,7 +4,7 @@ import { MockModule } from 'ng-mocks'; @Injectable() class ExampleProvider { - a: number; + public a: number; } @NgModule({ providers: [ExampleProvider], diff --git a/tests/issue-197/with-providers.spec.ts b/tests/issue-197/with-providers.spec.ts index 26ec06d9dd..d9aaa821cb 100644 --- a/tests/issue-197/with-providers.spec.ts +++ b/tests/issue-197/with-providers.spec.ts @@ -15,7 +15,7 @@ class DependencyService { @NgModule({}) class DependencyModule { - static withProviders(): NgModuleWithProviders { + public static withProviders(): NgModuleWithProviders { return { ngModule: DependencyModule, providers: [ @@ -31,7 +31,7 @@ class DependencyModule { public readonly service: DependencyService; - constructor(service: DependencyService) { + public constructor(service: DependencyService) { this.service = service; } } @@ -43,7 +43,7 @@ class DependencyModule { class TargetComponent { public readonly service: DependencyService; - constructor(service: DependencyService) { + public constructor(service: DependencyService) { this.service = service; } } @@ -54,12 +54,12 @@ class TargetComponent { class TargetModule {} describe('issue-197:with-providers:manually-injection', () => { - beforeEach(() => { + beforeEach(async () => { const module = MockBuilder(TargetComponent, TargetModule).build(); return TestBed.configureTestingModule({ declarations: module.declarations, - imports: [...module.imports, DependencyModule.withProviders()], + imports: [...(module.imports || []), DependencyModule.withProviders()], providers: module.providers, }).compileComponents(); }); diff --git a/tests/issue-218/test.spec.ts b/tests/issue-218/test.spec.ts index 7ce4fa6dc2..8b3d939ead 100644 --- a/tests/issue-218/test.spec.ts +++ b/tests/issue-218/test.spec.ts @@ -18,7 +18,7 @@ const TOKEN_PREFIX = new InjectionToken('PREFIX'); class PrefixService { public readonly prefix: string; - constructor(@Inject(TOKEN_PREFIX) prefix: string) { + public constructor(@Inject(TOKEN_PREFIX) prefix: string) { this.prefix = prefix; } } @@ -29,11 +29,11 @@ class PrefixService { class TargetPipe implements PipeTransform { protected prefix: string; - constructor(service: PrefixService) { + public constructor(service: PrefixService) { this.prefix = service.prefix; } - transform(value: string): string { + public transform(value: string): string { return `${this.prefix}:${value}`; } } @@ -44,15 +44,15 @@ class TargetPipe implements PipeTransform { }) class TargetComponent implements OnInit { public piped: string; - @Input() value: string; + @Input() public value: string; protected pipe: TargetPipe; - constructor(pipe: TargetPipe) { + public constructor(pipe: TargetPipe) { this.pipe = pipe; } - ngOnInit(): void { + public ngOnInit(): void { this.piped = this.pipe.transform(this.value); } } @@ -120,7 +120,7 @@ describe('issue-218:guts:mock', () => { describe('issue-218:guts:keep', () => { beforeEach(() => - TestBed.configureTestingModule(ngMocks.guts([TargetComponent, TargetPipe], TargetModule)).compileComponents() + TestBed.configureTestingModule(ngMocks.guts([TargetComponent, TargetPipe], TargetModule)).compileComponents(), ); it('renders how we replaced it with a mock copy', () => { diff --git a/tests/issue-222/common-module.spec.ts b/tests/issue-222/common-module.spec.ts index 017adf4a89..847123c2d6 100644 --- a/tests/issue-222/common-module.spec.ts +++ b/tests/issue-222/common-module.spec.ts @@ -20,7 +20,7 @@ describe('issue-222:CommonModule', () => { beforeEach(() => TestBed.configureTestingModule({ imports: [CommonModule, MockModule(CommonModule), MockModule(TargetModule)], - }) + }), ); it('correctly handles kept and the mock CommonModule', () => { diff --git a/tests/issue-222/dom-shared-styles-host.spec.ts b/tests/issue-222/dom-shared-styles-host.spec.ts index 1f1f6b0b12..04323ffd2a 100644 --- a/tests/issue-222/dom-shared-styles-host.spec.ts +++ b/tests/issue-222/dom-shared-styles-host.spec.ts @@ -14,7 +14,7 @@ import { MockBuilder, MockRender, ngMocks } from 'ng-mocks'; backgroundColor: 'yellow', height: '200px', opacity: 1, - }) + }), ), state( 'closed', @@ -22,7 +22,7 @@ import { MockBuilder, MockRender, ngMocks } from 'ng-mocks'; backgroundColor: 'green', height: '100px', opacity: 0.5, - }) + }), ), transition('open => closed', [animate('1s')]), transition('closed => open', [animate('0.5s')]), @@ -32,9 +32,9 @@ import { MockBuilder, MockRender, ngMocks } from 'ng-mocks'; template: `
The box is now {{ isOpen ? 'Open' : 'Closed' }}!
`, }) class TargetComponent { - isOpen = true; + public isOpen = true; - toggle() { + public toggle() { this.isOpen = !this.isOpen; } } diff --git a/tests/issue-222/injector-scope.spec.ts b/tests/issue-222/injector-scope.spec.ts index 75314cb108..ef14954036 100644 --- a/tests/issue-222/injector-scope.spec.ts +++ b/tests/issue-222/injector-scope.spec.ts @@ -16,7 +16,7 @@ function Injectable(...args: any[]): any { class KeepService { public readonly id: any; - constructor(@Inject(PLATFORM_ID) id: any) { + public constructor(@Inject(PLATFORM_ID) id: any) { this.id = id; } @@ -27,7 +27,7 @@ class KeepService { @NgModule({}) class KeepModule { - constructor(service: KeepService) { + public constructor(service: KeepService) { service.echo(); } } diff --git a/tests/issue-222/injector.spec.ts b/tests/issue-222/injector.spec.ts index 729294d415..e8798ea8ab 100644 --- a/tests/issue-222/injector.spec.ts +++ b/tests/issue-222/injector.spec.ts @@ -12,7 +12,7 @@ class MockService {} class TargetComponent { public readonly service: MockService; - constructor(service: MockService) { + public constructor(service: MockService) { this.service = service; } } diff --git a/tests/issue-222/kept-root-injection.spec.ts b/tests/issue-222/kept-root-injection.spec.ts index 3ef0fbca84..7d558728a3 100644 --- a/tests/issue-222/kept-root-injection.spec.ts +++ b/tests/issue-222/kept-root-injection.spec.ts @@ -23,14 +23,14 @@ class TargetService { @NgModule({}) class MockModule { - constructor(service: TargetService) { + public constructor(service: TargetService) { service.echo(); } } @NgModule({}) class KeepModule { - constructor(service: TargetService) { + public constructor(service: TargetService) { service.echo(); } } diff --git a/tests/mock-builder-keeps-application-module/test.spec.ts b/tests/mock-builder-keeps-application-module/test.spec.ts index 362f105e5e..3144d6cde8 100644 --- a/tests/mock-builder-keeps-application-module/test.spec.ts +++ b/tests/mock-builder-keeps-application-module/test.spec.ts @@ -3,7 +3,7 @@ import { TestBed } from '@angular/core/testing'; import { MockBuilder, MockRender, ngMocks } from 'ng-mocks'; import { TargetComponent } from './fixtures.components'; -import { TARGET_TOKEN, TargetModule } from './fixtures.modules'; +import { TargetModule, TARGET_TOKEN } from './fixtures.modules'; describe('MockBuilderKeepsApplicationModule:real', () => { beforeEach(() => MockBuilder(TargetModule)); diff --git a/tests/mock-render-all-properties/test.spec.ts b/tests/mock-render-all-properties/test.spec.ts index 7e15b34f90..1dd97c70e5 100644 --- a/tests/mock-render-all-properties/test.spec.ts +++ b/tests/mock-render-all-properties/test.spec.ts @@ -1,4 +1,4 @@ -// tslint:disable: member-ordering +// tslint:disable:member-ordering import { Component } from '@angular/core'; import { MockBuilder, MockRender } from 'ng-mocks'; @@ -35,6 +35,7 @@ class ParentClass { if (value !== undefined) { this.pubParentPropSet = value; } + return this.pubParentPropGet; } @@ -46,6 +47,7 @@ class ParentClass { if (value !== undefined) { this.proParentPropSet = value; } + return this.proParentPropGet; } @@ -96,6 +98,7 @@ class TargetComponent extends ParentClass { if (value !== undefined) { this.pubChildPropSet = value; } + return this.pubChildPropGet; } @@ -107,6 +110,7 @@ class TargetComponent extends ParentClass { if (value !== undefined) { this.proChildPropSet = value; } + return this.proChildPropGet; } diff --git a/tests/mock-render-mirrors-component/test.spec.ts b/tests/mock-render-mirrors-component/test.spec.ts index 7063d1aa95..c17d8d1fdb 100644 --- a/tests/mock-render-mirrors-component/test.spec.ts +++ b/tests/mock-render-mirrors-component/test.spec.ts @@ -28,7 +28,7 @@ export class TargetComponent { protected readonly cdf: ChangeDetectorRef; protected var3 = ''; - constructor(cdf: ChangeDetectorRef) { + public constructor(cdf: ChangeDetectorRef) { this.cdf = cdf; } @@ -114,7 +114,7 @@ describe('mock-render-mirrors-component', () => { { input1: '1', input3: '3', - } + }, ); expect(fixture3).toBeDefined(); expect(fixture3.componentInstance.input3).toBe('3'); diff --git a/tests/module-with-factory-tokens/fixtures.ts b/tests/module-with-factory-tokens/fixtures.ts index 3ad0365843..e4e7faf1ac 100644 --- a/tests/module-with-factory-tokens/fixtures.ts +++ b/tests/module-with-factory-tokens/fixtures.ts @@ -14,9 +14,9 @@ export const MY_TOKEN_MULTI = new (InjectionToken as any)(/* A5 */ 'MY_TOKEN_MUL template: '{{ tokenSingle | json }} {{ tokenMulti | json }}', }) export class TargetComponent { - constructor( + public constructor( @Inject(MY_TOKEN_SINGLE) public readonly tokenSingle: string, - @Inject(MY_TOKEN_MULTI) public readonly tokenMulti: string[] + @Inject(MY_TOKEN_MULTI) public readonly tokenMulti: string[], ) {} } diff --git a/tests/module-with-factory-tokens/test.spec.ts b/tests/module-with-factory-tokens/test.spec.ts index 69c84b727a..8a0aaec427 100644 --- a/tests/module-with-factory-tokens/test.spec.ts +++ b/tests/module-with-factory-tokens/test.spec.ts @@ -11,12 +11,13 @@ describe('module-with-factory-tokens:real', () => { it('renders all tokens', () => { if (parseInt(VERSION.major, 10) <= 5) { pending('Need Angular > 5'); + return; } const fixture = MockRender(TargetComponent); expect(fixture.nativeElement.innerHTML).toEqual( - '"MY_TOKEN_SINGLE" "MY_TOKEN_MULTI"' + '"MY_TOKEN_SINGLE" "MY_TOKEN_MULTI"', ); }); }); @@ -29,12 +30,13 @@ describe('module-with-factory-tokens:keep', () => { it('renders all tokens', () => { if (parseInt(VERSION.major, 10) <= 5) { pending('Need Angular > 5'); + return; } const fixture = MockRender(TargetComponent); expect(fixture.nativeElement.innerHTML).toEqual( - '"MY_TOKEN_SINGLE" "MY_TOKEN_MULTI"' + '"MY_TOKEN_SINGLE" "MY_TOKEN_MULTI"', ); }); }); @@ -52,7 +54,7 @@ describe('module-with-factory-tokens:mock-0', () => { multi: true, provide: MY_TOKEN_MULTI, useValue: 'V2', - }) + }), ); it('fails to render all tokens', () => { @@ -79,13 +81,13 @@ describe('module-with-factory-tokens:mock-2', () => { beforeEach(() => MockBuilder(TargetComponent, TargetModule) .mock(MY_TOKEN_SINGLE, 'MOCK_MY_TOKEN_SINGLE') - .mock(MY_TOKEN_MULTI, 'MOCK_MY_TOKEN_MULTI') + .mock(MY_TOKEN_MULTI, 'MOCK_MY_TOKEN_MULTI'), ); it('renders all tokens', () => { const fixture = MockRender(TargetComponent); expect(fixture.nativeElement.innerHTML).toEqual( - '"MOCK_MY_TOKEN_SINGLE" "MOCK_MY_TOKEN_MULTI"' + '"MOCK_MY_TOKEN_SINGLE" "MOCK_MY_TOKEN_MULTI"', ); }); }); @@ -102,12 +104,13 @@ describe('module-with-factory-tokens:mock-3', () => { it('renders all tokens', () => { if (parseInt(VERSION.major, 10) <= 5) { pending('Need Angular > 5'); + return; } const fixture = MockRender(TargetComponent); expect(fixture.nativeElement.innerHTML).toEqual( - '"MY_TOKEN_SINGLE" "MY_TOKEN_MULTI"' + '"MY_TOKEN_SINGLE" "MY_TOKEN_MULTI"', ); }); }); diff --git a/tests/module-with-tokens/fixtures.ts b/tests/module-with-tokens/fixtures.ts index e39123fde0..3a8ffb1821 100644 --- a/tests/module-with-tokens/fixtures.ts +++ b/tests/module-with-tokens/fixtures.ts @@ -10,9 +10,9 @@ export const MY_TOKEN_MULTI = new InjectionToken('MY_TOKEN_MULTI'); template: '{{ tokenSingle | json }} {{ tokenMulti | json }}', }) export class TargetComponent { - constructor( + public constructor( @Inject(MY_TOKEN_SINGLE) public readonly tokenSingle: string, - @Inject(MY_TOKEN_MULTI) public readonly tokenMulti: string[] + @Inject(MY_TOKEN_MULTI) public readonly tokenMulti: string[], ) {} } diff --git a/tests/module-with-tokens/test.spec.ts b/tests/module-with-tokens/test.spec.ts index f8131b003e..a502ed1d81 100644 --- a/tests/module-with-tokens/test.spec.ts +++ b/tests/module-with-tokens/test.spec.ts @@ -20,13 +20,13 @@ describe('module-with-tokens:mock-0', () => { multi: true, provide: MY_TOKEN_MULTI, useValue: 'V3', - }) + }), ); it('fails to render all tokens', () => { const fixture = MockRender(TargetComponent); expect(fixture.nativeElement.innerHTML.replace(/\s+/gm, ' ')).toEqual( - '"V1" [ "V2", "V3" ]' + '"V1" [ "V2", "V3" ]', ); }); }); @@ -39,7 +39,7 @@ describe('module-with-tokens:mock-1', () => { it('renders all tokens', () => { const fixture = MockRender(TargetComponent); expect(fixture.nativeElement.innerHTML.replace(/\s+/gm, ' ')).toEqual( - ' [ null, null ]' + ' [ null, null ]', ); }); }); @@ -49,13 +49,15 @@ describe('module-with-tokens:mock-2', () => { beforeEach(() => MockBuilder(TargetComponent, TargetModule) .mock(MY_TOKEN_SINGLE, 'MOCK_MY_TOKEN_SINGLE') - .mock(MY_TOKEN_MULTI, 'MOCK_MY_TOKEN_MULTI') + .mock(MY_TOKEN_MULTI, 'MOCK_MY_TOKEN_MULTI'), ); it('renders all tokens', () => { const fixture = MockRender(TargetComponent); expect(fixture.nativeElement.innerHTML.replace(/\s+/gm, ' ')).toEqual( - '"MOCK_MY_TOKEN_SINGLE" [ "MOCK_MY_TOKEN_MULTI", "MOCK_MY_TOKEN_MULTI" ]' + '' + + '"MOCK_MY_TOKEN_SINGLE" [ "MOCK_MY_TOKEN_MULTI", "MOCK_MY_TOKEN_MULTI" ]' + + '', ); }); }); @@ -87,7 +89,7 @@ describe('module-with-tokens:real', () => { it('renders all tokens', () => { const fixture = MockRender(TargetComponent); expect(fixture.nativeElement.innerHTML.replace(/\s+/gm, ' ')).toEqual( - '"MY_TOKEN_SINGLE" [ "MY_TOKEN_MULTI", "MY_TOKEN_MULTI_2" ]' + '"MY_TOKEN_SINGLE" [ "MY_TOKEN_MULTI", "MY_TOKEN_MULTI_2" ]', ); }); }); @@ -99,7 +101,7 @@ describe('module-with-tokens:keep', () => { it('renders all tokens', () => { const fixture = MockRender(TargetComponent); expect(fixture.nativeElement.innerHTML.replace(/\s+/gm, ' ')).toEqual( - '"MY_TOKEN_SINGLE" [ "MY_TOKEN_MULTI", "MY_TOKEN_MULTI_2" ]' + '"MY_TOKEN_SINGLE" [ "MY_TOKEN_MULTI", "MY_TOKEN_MULTI_2" ]', ); }); }); diff --git a/tests/multi-tokens/test.spec.ts b/tests/multi-tokens/test.spec.ts index 2e196a88d8..1b685eb77a 100644 --- a/tests/multi-tokens/test.spec.ts +++ b/tests/multi-tokens/test.spec.ts @@ -8,7 +8,7 @@ const TARGET_TOKEN = new InjectionToken('MY_TOKEN_SINGLE'); class TargetService { public readonly tokens: string[] = []; - constructor(@Inject(TARGET_TOKEN) tokens: string[]) { + public constructor(@Inject(TARGET_TOKEN) tokens: string[]) { this.tokens = tokens; } } @@ -62,7 +62,7 @@ describe('multi-tokens:real', () => { useFactory: () => '6', }, ], - }).compileComponents() + }).compileComponents(), ); it('returns all provided tokens', () => { @@ -85,7 +85,7 @@ describe('multi-tokens:builder', () => { multi: true, provide: TARGET_TOKEN, useFactory: () => '6', - }) + }), ); it('returns all provided tokens', () => { @@ -108,7 +108,7 @@ describe('multi-tokens:builder:mock', () => { multi: true, provide: TARGET_TOKEN, useFactory: () => '6', - }) + }), ); it('returns all provided tokens', () => { diff --git a/tests/nested-before-each/test.spec.ts b/tests/nested-before-each/test.spec.ts index 0e911651bc..1960ab43e9 100644 --- a/tests/nested-before-each/test.spec.ts +++ b/tests/nested-before-each/test.spec.ts @@ -11,6 +11,7 @@ describe('nested-before-each', () => { beforeEach(() => { level = 0; mock = MockComponent(InternalComponent); + return MockBuilder(mock); }); @@ -45,6 +46,7 @@ describe('nested-before-all', () => { level = 0; mock = MockComponent(InternalComponent); TestBed.resetTestingModule(); + return MockBuilder(mock); }); diff --git a/tests/ng-mocks-search-with-no-fixture/test.spec.ts b/tests/ng-mocks-search-with-no-fixture/test.spec.ts index 1138a86bcf..a8d5ad5601 100644 --- a/tests/ng-mocks-search-with-no-fixture/test.spec.ts +++ b/tests/ng-mocks-search-with-no-fixture/test.spec.ts @@ -29,7 +29,7 @@ class TargetModule {} describe('ng-mocks-search-with-no-fixture:no-fixture', () => { it('.find type', () => { expect(() => ngMocks.find(TargetComponent)).toThrowError( - /Cannot find an element via ngMocks.find\(TargetComponent\)/ + /Cannot find an element via ngMocks.find\(TargetComponent\)/, ); expect(ngMocks.find(TargetComponent, undefined)).toBeUndefined(); }); @@ -51,7 +51,7 @@ describe('ng-mocks-search-with-no-fixture:no-fixture', () => { it('.findInstance', () => { expect(() => ngMocks.findInstance(TargetComponent)).toThrowError( - /Cannot find an instance via ngMocks.findInstance\(TargetComponent\)/ + /Cannot find an instance via ngMocks.findInstance\(TargetComponent\)/, ); expect(ngMocks.findInstance(TargetComponent, undefined)).toBeUndefined(); }); @@ -77,7 +77,7 @@ describe('ng-mocks-search-with-no-fixture:fixture', () => { expect(ngMocks.find(MissedComponent, undefined)).toBeUndefined(); expect(() => ngMocks.find(MissedComponent)).toThrowError( - /Cannot find an element via ngMocks.find\(MissedComponent\)/ + /Cannot find an element via ngMocks.find\(MissedComponent\)/, ); }); @@ -88,7 +88,7 @@ describe('ng-mocks-search-with-no-fixture:fixture', () => { expect(ngMocks.find('missed', undefined)).toBeUndefined(); expect(() => ngMocks.find('missed')).toThrowError( - /Cannot find an element via ngMocks.find\(missed\)/ + /Cannot find an element via ngMocks.find\(missed\)/, ); }); @@ -115,7 +115,7 @@ describe('ng-mocks-search-with-no-fixture:fixture', () => { expect(ngMocks.findInstance(MissedComponent, undefined)).toBeUndefined(); expect(() => ngMocks.findInstance(MissedComponent)).toThrowError( - /Cannot find an instance via ngMocks.findInstance\(MissedComponent\)/ + /Cannot find an instance via ngMocks.findInstance\(MissedComponent\)/, ); }); @@ -136,7 +136,7 @@ describe('ng-mocks-search-with-no-fixture:fixture', () => { expect(ngMocks.find(fixture, MissedComponent, undefined)).toBeUndefined(); expect(() => ngMocks.find(fixture, MissedComponent)).toThrowError( - /Cannot find an element via ngMocks.find\(MissedComponent\)/ + /Cannot find an element via ngMocks.find\(MissedComponent\)/, ); }); @@ -147,7 +147,7 @@ describe('ng-mocks-search-with-no-fixture:fixture', () => { expect(ngMocks.find(fixture, 'missed', undefined)).toBeUndefined(); expect(() => ngMocks.find(fixture, 'missed')).toThrowError( - /Cannot find an element via ngMocks.find\(missed\)/ + /Cannot find an element via ngMocks.find\(missed\)/, ); }); @@ -174,7 +174,7 @@ describe('ng-mocks-search-with-no-fixture:fixture', () => { expect(ngMocks.findInstance(fixture, MissedComponent, undefined)).toBeUndefined(); expect(() => ngMocks.findInstance(fixture, MissedComponent)).toThrowError( - /Cannot find an instance via ngMocks.findInstance\(MissedComponent\)/ + /Cannot find an instance via ngMocks.findInstance\(MissedComponent\)/, ); }); @@ -195,7 +195,7 @@ describe('ng-mocks-search-with-no-fixture:fixture', () => { expect(ngMocks.find(fixture.debugElement, MissedComponent, undefined)).toBeUndefined(); expect(() => ngMocks.find(fixture.debugElement, MissedComponent)).toThrowError( - /Cannot find an element via ngMocks.find\(MissedComponent\)/ + /Cannot find an element via ngMocks.find\(MissedComponent\)/, ); }); @@ -206,7 +206,7 @@ describe('ng-mocks-search-with-no-fixture:fixture', () => { expect(ngMocks.find(fixture.debugElement, 'missed', undefined)).toBeUndefined(); expect(() => ngMocks.find(fixture.debugElement, 'missed')).toThrowError( - /Cannot find an element via ngMocks.find\(missed\)/ + /Cannot find an element via ngMocks.find\(missed\)/, ); }); @@ -233,7 +233,7 @@ describe('ng-mocks-search-with-no-fixture:fixture', () => { expect(ngMocks.findInstance(fixture.debugElement, MissedComponent, undefined)).toBeUndefined(); expect(() => ngMocks.findInstance(fixture.debugElement, MissedComponent)).toThrowError( - /Cannot find an instance via ngMocks.findInstance\(MissedComponent\)/ + /Cannot find an instance via ngMocks.findInstance\(MissedComponent\)/, ); }); diff --git a/tests/normal-usage-after-mock-builder/fixtures.components.ts b/tests/normal-usage-after-mock-builder/fixtures.components.ts index 78929f1109..48a1caafa5 100644 --- a/tests/normal-usage-after-mock-builder/fixtures.components.ts +++ b/tests/normal-usage-after-mock-builder/fixtures.components.ts @@ -9,7 +9,7 @@ import { TargetService } from './fixtures.services'; export class TargetComponent { public readonly service: TargetService; - constructor(service: TargetService) { + public constructor(service: TargetService) { this.service = service; } } diff --git a/tests/normal-usage-after-mock-builder/fixtures.modules.ts b/tests/normal-usage-after-mock-builder/fixtures.modules.ts index dcf1791fe4..7383d2f12b 100644 --- a/tests/normal-usage-after-mock-builder/fixtures.modules.ts +++ b/tests/normal-usage-after-mock-builder/fixtures.modules.ts @@ -11,7 +11,7 @@ import { TargetService } from './fixtures.services'; export class TargetModule { protected service: TargetService; - constructor(service: TargetService) { + public constructor(service: TargetService) { this.service = service; this.service.call(); } diff --git a/tests/on-push/on-push.spec.ts b/tests/on-push/on-push.spec.ts index 52cfa53542..5b5e5a0a7b 100644 --- a/tests/on-push/on-push.spec.ts +++ b/tests/on-push/on-push.spec.ts @@ -7,7 +7,7 @@ import { MockBuilder, MockRender } from 'ng-mocks'; template: '{{items.length}}', }) export class ItemListComponent { - @Input() items: string[]; + @Input() public items: string[]; } describe('ChangeDetectionStrategy.OnPush:real', () => { diff --git a/tests/performance/test.spec.ts b/tests/performance/test.spec.ts index 0feff64129..1b0668ca5a 100644 --- a/tests/performance/test.spec.ts +++ b/tests/performance/test.spec.ts @@ -6,7 +6,7 @@ import { MockBuilder, ngMocks } from 'ng-mocks'; @Injectable() class TargetService { public count = 0; - constructor() { + public constructor() { this.count += 1; } } @@ -18,7 +18,7 @@ class TargetService { class TargetComponent { public readonly service: TargetService; - constructor(service: TargetService) { + public constructor(service: TargetService) { this.service = service; } } @@ -72,7 +72,7 @@ describe('performance:wrong', () => { beforeEach(() => MockBuilder(TargetComponent, TargetModule).mock(TargetService, { count: 5, - }) + }), ); it('creates a module on first call', () => { diff --git a/tests/pipe-as-service/test.spec.ts b/tests/pipe-as-service/test.spec.ts index 9c613fc8c9..b02f3b48bd 100644 --- a/tests/pipe-as-service/test.spec.ts +++ b/tests/pipe-as-service/test.spec.ts @@ -1,3 +1,5 @@ +// tslint:disable:no-void-expression + import { Component, Injectable, NgModule, Pipe, PipeTransform } from '@angular/core'; import { TestBed } from '@angular/core/testing'; import { MockBuilder, MockInstance, MockRender, MockReset, ngMocks } from 'ng-mocks'; @@ -29,7 +31,7 @@ class TargetPipe implements PipeTransform { class TargetComponent { public readonly service: TargetPipe; - constructor(service: TargetPipe) { + public constructor(service: TargetPipe) { this.service = service; } } @@ -77,8 +79,8 @@ describe('pipe-as-service', () => { echo: () => 'echo', name: 'mock', transform: () => 'transform', - }) - ) + }), + ), ); afterAll(MockReset); @@ -114,8 +116,8 @@ describe('pipe-as-service', () => { echo: () => 'echo', name: 'mock', transform: () => 'transform', - }) - ) + }), + ), ); afterAll(MockReset); @@ -147,7 +149,7 @@ describe('pipe-as-service', () => { MockBuilder(TargetComponent, TargetModule).mock(TargetPipe, { name: 'test', transform: () => 'transform', - }) + }), ); it('fails because of the missed function', () => { @@ -161,7 +163,7 @@ describe('pipe-as-service', () => { echo: () => 'echo', name: 'test', transform: () => 'transform', - }) + }), ); it('renders correctly', () => { diff --git a/tests/provider-with-custom-dependencies/test.spec.ts b/tests/provider-with-custom-dependencies/test.spec.ts index 19b65e8cc6..0208c301df 100644 --- a/tests/provider-with-custom-dependencies/test.spec.ts +++ b/tests/provider-with-custom-dependencies/test.spec.ts @@ -34,7 +34,7 @@ class TargetService { public readonly optional?: { name: string }; public readonly service: { name: string }; - constructor(service: Dep1Service, optional: Dep1Service, flag?: undefined) { + public constructor(service: Dep1Service, optional: Dep1Service, flag?: undefined) { this.service = service; this.optional = optional; this.flag = flag; @@ -52,7 +52,7 @@ class TargetService { class TargetComponent { public readonly service: TargetService; - constructor(service: TargetService) { + public constructor(service: TargetService) { this.service = service; } } @@ -85,7 +85,7 @@ describe('provider-with-custom-dependencies', () => { beforeEach(() => TestBed.configureTestingModule({ imports: [TargetModule], - }).compileComponents() + }).compileComponents(), ); it('creates component with custom dependencies', () => { @@ -118,7 +118,7 @@ describe('provider-with-custom-dependencies', () => { beforeEach(() => MockBuilder(TargetComponent, TargetModule).keep(TargetService).keep(Dep2Service, { dependency: true, - }) + }), ); it('creates component with kept Dep2Service', () => { diff --git a/tests/provider-with-dependency/fixtures.components.ts b/tests/provider-with-dependency/fixtures.components.ts index ec2df5b5c2..460a0faad1 100644 --- a/tests/provider-with-dependency/fixtures.components.ts +++ b/tests/provider-with-dependency/fixtures.components.ts @@ -9,7 +9,7 @@ import { ServiceChild } from './fixtures.services'; export class InternalComponent { public readonly child: ServiceChild; - constructor(child: ServiceChild) { + public constructor(child: ServiceChild) { this.child = child; } } diff --git a/tests/provider-with-dependency/fixtures.services.ts b/tests/provider-with-dependency/fixtures.services.ts index 15266dde1d..0d02ab2dfe 100644 --- a/tests/provider-with-dependency/fixtures.services.ts +++ b/tests/provider-with-dependency/fixtures.services.ts @@ -18,7 +18,7 @@ export class ServiceReplacedParent extends ServiceParent { export class ServiceChild { public readonly parent: ServiceParent; - constructor(parent: ServiceParent) { + public constructor(parent: ServiceParent) { this.parent = parent; } } diff --git a/tests/provider-with-dependency/test.spec.ts b/tests/provider-with-dependency/test.spec.ts index 7720fc7457..7e7ccc99ad 100644 --- a/tests/provider-with-dependency/test.spec.ts +++ b/tests/provider-with-dependency/test.spec.ts @@ -16,10 +16,11 @@ class ServiceMock { } describe('provider-with-dependency:real', () => { - beforeEach(() => { + beforeEach(async () => { TestBed.configureTestingModule({ imports: [TargetModule], }); + return TestBed.compileComponents(); }); @@ -30,7 +31,7 @@ describe('provider-with-dependency:real', () => { }); describe('provider-with-dependency:provided', () => { - beforeEach(() => { + beforeEach(async () => { TestBed.configureTestingModule({ imports: [TargetModule], providers: [ @@ -40,6 +41,7 @@ describe('provider-with-dependency:provided', () => { }, ], }); + return TestBed.compileComponents(); }); @@ -50,7 +52,7 @@ describe('provider-with-dependency:provided', () => { }); describe('provider-with-dependency:mock', () => { - beforeEach(() => { + beforeEach(async () => { const ngModule = MockBuilder() .keep(TargetModule) .provide({ @@ -59,6 +61,7 @@ describe('provider-with-dependency:mock', () => { }) .build(); TestBed.configureTestingModule(ngModule); + return TestBed.compileComponents(); }); diff --git a/tests/replace-service-wherever/test.spec.ts b/tests/replace-service-wherever/test.spec.ts index da2224c90f..4ec4989fca 100644 --- a/tests/replace-service-wherever/test.spec.ts +++ b/tests/replace-service-wherever/test.spec.ts @@ -9,6 +9,7 @@ class TargetService { public echo(): string { this.called = true; + return this.name; } } @@ -20,6 +21,7 @@ class ReplacementService { public echo(): string { this.called = true; + return this.name; } } @@ -31,7 +33,7 @@ class ReplacementService { class TargetComponent { public readonly service: TargetService; - constructor(service: TargetService) { + public constructor(service: TargetService) { this.service = service; } } @@ -44,7 +46,7 @@ class TargetComponent { class TargetModule { protected service: TargetService; - constructor(service: TargetService) { + public constructor(service: TargetService) { this.service = service; this.service.echo(); } @@ -54,7 +56,7 @@ describe('replace-service-wherever:real', () => { beforeEach(() => TestBed.configureTestingModule({ imports: [TargetModule], - }).compileComponents() + }).compileComponents(), ); it('uses service everywhere', () => { @@ -70,7 +72,7 @@ describe('replace-service-wherever:mock', () => { MockBuilder(TargetComponent, TargetModule).provide({ provide: TargetService, useClass: ReplacementService, - }) + }), ); it('uses service everywhere', () => { diff --git a/tests/rerender-rendered-content-child/fixtures.components.ts b/tests/rerender-rendered-content-child/fixtures.components.ts index 53bac0df8a..a0864a60ed 100644 --- a/tests/rerender-rendered-content-child/fixtures.components.ts +++ b/tests/rerender-rendered-content-child/fixtures.components.ts @@ -7,5 +7,5 @@ import { staticFalse } from '..'; template: ``, }) export class ContentChildComponent { - @ContentChild('block', { ...staticFalse }) injectedBlock: TemplateRef; + @ContentChild('block', { ...staticFalse }) public injectedBlock: TemplateRef; } diff --git a/tests/rerender-rendered-content-child/test.spec.ts b/tests/rerender-rendered-content-child/test.spec.ts index 0d05a76dcd..ed2756eb70 100644 --- a/tests/rerender-rendered-content-child/test.spec.ts +++ b/tests/rerender-rendered-content-child/test.spec.ts @@ -20,7 +20,7 @@ describe('Rerender of a rendered @ContentChild', () => { `, { outside: '1', - } + }, ); expect(fixture).toBeDefined(); expect(fixture.debugElement.nativeElement.innerHTML).toContain('$implicit 1'); diff --git a/tests/root-provider-in-depths/test.spec.ts b/tests/root-provider-in-depths/test.spec.ts index 6a499f3231..bd3683cb2f 100644 --- a/tests/root-provider-in-depths/test.spec.ts +++ b/tests/root-provider-in-depths/test.spec.ts @@ -34,7 +34,7 @@ class TargetService { class TargetComponent { public readonly service: TargetService; - constructor(service: TargetService) { + public constructor(service: TargetService) { this.service = service; } } @@ -51,7 +51,7 @@ describe('root-provider-in-depths', () => { beforeEach(() => TestBed.configureTestingModule({ imports: [TargetModule], - }).compileComponents() + }).compileComponents(), ); it('creates component with very nested service', () => { diff --git a/tests/root-provider-with-root-dep/test.spec.ts b/tests/root-provider-with-root-dep/test.spec.ts index 717023dbe1..37f79cd039 100644 --- a/tests/root-provider-with-root-dep/test.spec.ts +++ b/tests/root-provider-with-root-dep/test.spec.ts @@ -21,7 +21,7 @@ class TargetService { public readonly name2: string; public readonly name3: string; - constructor(@Inject(TOKEN) name: string, @Inject(TOKEN) name2: string, @Inject(TOKEN) name3: string) { + public constructor(@Inject(TOKEN) name: string, @Inject(TOKEN) name2: string, @Inject(TOKEN) name3: string) { this.name = name; this.name2 = name2; this.name3 = name3; @@ -35,7 +35,7 @@ class TargetService { class TargetComponent { public readonly service: TargetService; - constructor(service: TargetService) { + public constructor(service: TargetService) { this.service = service; } } @@ -57,7 +57,7 @@ describe('root-provider-with-root-dep', () => { beforeEach(() => TestBed.configureTestingModule({ imports: [TargetModule], - }).compileComponents() + }).compileComponents(), ); it('finds tokens', () => { diff --git a/tests/root-provider-with-string-dep/test.spec.ts b/tests/root-provider-with-string-dep/test.spec.ts index 5261ca0297..25360a5d9c 100644 --- a/tests/root-provider-with-string-dep/test.spec.ts +++ b/tests/root-provider-with-string-dep/test.spec.ts @@ -9,7 +9,7 @@ import { MockBuilder, MockRender } from 'ng-mocks'; class TargetComponent { public readonly name: string; - constructor(@Inject('name') service: string) { + public constructor(@Inject('name') name: string) { this.name = name; } } @@ -31,7 +31,7 @@ describe('root-provider-with-string-dep', () => { beforeEach(() => TestBed.configureTestingModule({ imports: [TargetModule], - }).compileComponents() + }).compileComponents(), ); it('finds tokens', () => { diff --git a/tests/root-providers/test.spec.ts b/tests/root-providers/test.spec.ts index 106d849cd4..221843a817 100644 --- a/tests/root-providers/test.spec.ts +++ b/tests/root-providers/test.spec.ts @@ -14,7 +14,7 @@ import { import { TestBed } from '@angular/core/testing'; import { BrowserModule } from '@angular/platform-browser'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; -import { MockBuilder, MockRender, NG_MOCKS_ROOT_PROVIDERS, ngMocks } from 'ng-mocks'; +import { MockBuilder, MockRender, ngMocks, NG_MOCKS_ROOT_PROVIDERS } from 'ng-mocks'; // Because of A5 we need to cast Injectable to any type. // But because of A10+ we need to do it via a middle function. @@ -67,13 +67,13 @@ class TargetComponent { public readonly service: TargetService; public readonly token: string; - constructor( + public constructor( @Inject(FakeService) fake: TargetService, @Optional() @Inject(TOKEN) @SkipSelf() token: string, @Optional() @SkipSelf() service: TargetService, @Inject(TOKEN) @Optional() @SkipSelf() token2: string, provided: ProvidedService, - injector: Injector + injector: Injector, ) { this.fake = fake; this.service = service; @@ -90,7 +90,7 @@ class TargetComponent { class ModuleComponent { public readonly module: ModuleService; - constructor(module: ModuleService) { + public constructor(module: ModuleService) { this.module = module; } } @@ -114,7 +114,7 @@ describe('root-providers', () => { beforeEach(() => TestBed.configureTestingModule({ imports: [TargetModule], - }).compileComponents() + }).compileComponents(), ); it('finds tokens', () => { @@ -157,7 +157,7 @@ describe('root-providers', () => { beforeEach(() => MockBuilder(TargetComponent, TargetModule).mock(TargetService, TargetService, { dependency: true, - }) + }), ); it('uses mock providers', () => { @@ -213,7 +213,7 @@ describe('root-providers', () => { beforeEach(() => MockBuilder(TargetComponent, TargetModule).keep(TargetService, { dependency: true, - }) + }), ); it('uses mock providers', () => { diff --git a/tests/shared-mocked-module/test.spec.ts b/tests/shared-mocked-module/test.spec.ts index 376f85fa8d..61cf0f8598 100644 --- a/tests/shared-mocked-module/test.spec.ts +++ b/tests/shared-mocked-module/test.spec.ts @@ -11,10 +11,10 @@ describe('SharedMockModule:real', () => { expect(fixture).toBeDefined(); const content = fixture.debugElement.nativeElement.innerHTML; expect(content).toContain( - 'child:1 real content' + 'child:1 real content', ); expect(content).toContain( - 'child:2 real content' + 'child:2 real content', ); }); }); diff --git a/tests/spies/test.spec.ts b/tests/spies/test.spec.ts index e20da1db32..f74a9a9d4f 100644 --- a/tests/spies/test.spec.ts +++ b/tests/spies/test.spec.ts @@ -1,3 +1,5 @@ +// tslint:disable:strict-type-predicates + import { Component, Injectable, NgModule } from '@angular/core'; import { inject } from '@angular/core/testing'; import { MockBuilder, MockRender, MockService, ngMocks } from 'ng-mocks'; @@ -18,7 +20,7 @@ class TargetService { class TargetComponent { protected service: TargetService; - constructor(service: TargetService) { + public constructor(service: TargetService) { this.service = service; this.service.echo('constructor'); } diff --git a/tests/structural-directives/custom-ng-for-with-of.directive.ts b/tests/structural-directives/custom-ng-for-with-of.directive.ts index 5919cf22c1..9db38246e7 100644 --- a/tests/structural-directives/custom-ng-for-with-of.directive.ts +++ b/tests/structural-directives/custom-ng-for-with-of.directive.ts @@ -11,7 +11,14 @@ export interface ICustomNgForContext { selector: '[customNgForWithOf]', }) export class CustomNgForWithOfDirective { - @Input('customNgForWithOfOf') set setItems(items: string[]) { + protected templateRef: TemplateRef; + protected viewContainerRef: ViewContainerRef; + + public constructor(templateRef: TemplateRef, viewContainerRef: ViewContainerRef) { + this.templateRef = templateRef; + this.viewContainerRef = viewContainerRef; + } + @Input('customNgForWithOfOf') public set setItems(items: string[]) { this.viewContainerRef.clear(); items.forEach((value, index) => @@ -20,15 +27,7 @@ export class CustomNgForWithOfDirective { myFirst: index === 0, myIndex: index, myLast: index + 1 === items.length, - }) + }), ); } - - protected templateRef: TemplateRef; - protected viewContainerRef: ViewContainerRef; - - constructor(templateRef: TemplateRef, viewContainerRef: ViewContainerRef) { - this.templateRef = templateRef; - this.viewContainerRef = viewContainerRef; - } } diff --git a/tests/structural-directives/custom-ng-for-without-of.directive.ts b/tests/structural-directives/custom-ng-for-without-of.directive.ts index 618fcbfecd..1188ca18df 100644 --- a/tests/structural-directives/custom-ng-for-without-of.directive.ts +++ b/tests/structural-directives/custom-ng-for-without-of.directive.ts @@ -11,7 +11,14 @@ export interface ICustomNgForContext { selector: '[customNgForWithoutOf]', }) export class CustomNgForWithoutOfDirective { - @Input('customNgForWithoutOf') set setItems(items: string[]) { + protected templateRef: TemplateRef; + protected viewContainerRef: ViewContainerRef; + + public constructor(templateRef: TemplateRef, viewContainerRef: ViewContainerRef) { + this.templateRef = templateRef; + this.viewContainerRef = viewContainerRef; + } + @Input('customNgForWithoutOf') public set setItems(items: string[]) { this.viewContainerRef.clear(); items.forEach((value, index) => @@ -20,15 +27,7 @@ export class CustomNgForWithoutOfDirective { myFirst: index === 0, myIndex: index, myLast: index + 1 === items.length, - }) + }), ); } - - protected templateRef: TemplateRef; - protected viewContainerRef: ViewContainerRef; - - constructor(templateRef: TemplateRef, viewContainerRef: ViewContainerRef) { - this.templateRef = templateRef; - this.viewContainerRef = viewContainerRef; - } } diff --git a/tests/structural-directives/custom-ng-if.directive.ts b/tests/structural-directives/custom-ng-if.directive.ts index 2158c1d72a..e34d02fe80 100644 --- a/tests/structural-directives/custom-ng-if.directive.ts +++ b/tests/structural-directives/custom-ng-if.directive.ts @@ -4,19 +4,18 @@ import { Directive, Input, TemplateRef, ViewContainerRef } from '@angular/core'; selector: '[customNgIf]', }) export class CustomNgIfDirective { - @Input('customNgIf') set setValue(value: any) { - if (value) { - this.viewContainerRef.createEmbeddedView(this.templateRef); - } else { - this.viewContainerRef.clear(); - } - } - protected templateRef: TemplateRef; protected viewContainerRef: ViewContainerRef; - constructor(templateRef: TemplateRef, viewContainerRef: ViewContainerRef) { + public constructor(templateRef: TemplateRef, viewContainerRef: ViewContainerRef) { this.templateRef = templateRef; this.viewContainerRef = viewContainerRef; } + @Input('customNgIf') public set setValue(value: any) { + if (value) { + this.viewContainerRef.createEmbeddedView(this.templateRef); + } else { + this.viewContainerRef.clear(); + } + } } diff --git a/tests/structural-directives/structural-directives.spec.ts b/tests/structural-directives/structural-directives.spec.ts index 0c0e256309..a4f0a593db 100644 --- a/tests/structural-directives/structural-directives.spec.ts +++ b/tests/structural-directives/structural-directives.spec.ts @@ -1,3 +1,5 @@ +// tslint:disable:no-void-expression + import { MockBuilder, MockDirective, MockedDirective, MockRender, ngMocks } from 'ng-mocks'; import { CustomNgForWithOfDirective } from './custom-ng-for-with-of.directive'; @@ -6,7 +8,7 @@ import { CustomNgIfDirective } from './custom-ng-if.directive'; describe('structural-directive-as-ng-for:real', () => { beforeEach(() => - MockBuilder().keep(CustomNgForWithOfDirective).keep(CustomNgForWithoutOfDirective).keep(CustomNgIfDirective) + MockBuilder().keep(CustomNgForWithOfDirective).keep(CustomNgForWithoutOfDirective).keep(CustomNgIfDirective), ); it('renders customNgForWithOf properly', () => { @@ -19,7 +21,7 @@ describe('structural-directive-as-ng-for:real', () => { `, { values: ['string1', 'string2', 'string3'], - } + }, ); // every value should be rendered correctly. @@ -38,7 +40,7 @@ describe('structural-directive-as-ng-for:real', () => { `, { values: ['string1', 'string2', 'string3'], - } + }, ); // every value should be rendered correctly. @@ -56,7 +58,7 @@ describe('structural-directive-as-ng-for:real', () => { `, { values: ['string1', 'string2', 'string3'], - } + }, ); // only first div should be rendered. @@ -67,7 +69,7 @@ describe('structural-directive-as-ng-for:real', () => { describe('structural-directive-as-ng-for:mock', () => { beforeEach(() => - MockBuilder().mock(CustomNgIfDirective).mock(CustomNgForWithOfDirective).mock(CustomNgForWithoutOfDirective) + MockBuilder().mock(CustomNgIfDirective).mock(CustomNgForWithOfDirective).mock(CustomNgForWithoutOfDirective), ); it('mocks customNgIf properly', () => { @@ -80,7 +82,7 @@ describe('structural-directive-as-ng-for:mock', () => { `, { values: ['string1', 'string2', 'string3'], - } + }, ); // we need to render mock structural directives manually @@ -89,7 +91,7 @@ describe('structural-directive-as-ng-for:mock', () => { .forEach((item: MockedDirective) => item.__render(undefined, { fromDirective: undefined, - }) + }), ); fixture.detectChanges(); @@ -133,7 +135,7 @@ describe('structural-directive-as-ng-for:mock', () => { `, { values: ['string1', 'string2', 'string3'], - } + }, ); // we need to render mock structural directives manually @@ -187,7 +189,7 @@ describe('structural-directive-as-ng-for:mock', () => { `, { values: ['string1', 'string2', 'string3'], - } + }, ); // we need to render mock structural directives manually @@ -249,7 +251,7 @@ describe('structural-directive-as-ng-for:mock', () => { { values1: ['string1', 'string2', 'string3'], values2: ['string4', 'string5', 'string6'], - } + }, ); // we need to render mock structural directives manually @@ -264,14 +266,14 @@ describe('structural-directive-as-ng-for:mock', () => { // Looking for first directive. mockDirective = ngMocks.get( ngMocks.find(fixture.debugElement, '[data-type="node-1"]'), - MockDirective(CustomNgForWithoutOfDirective) + MockDirective(CustomNgForWithoutOfDirective), ); expect(mockDirective.setItems).toEqual(['string1', 'string2', 'string3']); // Looking for second directive. mockDirective = ngMocks.get( ngMocks.find(fixture.debugElement, '[data-type="node-2"]'), - MockDirective(CustomNgForWithoutOfDirective) + MockDirective(CustomNgForWithoutOfDirective), ); expect(mockDirective.setItems).toEqual(['string4', 'string5', 'string6']); }); diff --git a/tests/tokens-class/test.spec.ts b/tests/tokens-class/test.spec.ts index d626074be3..410ba5ad03 100644 --- a/tests/tokens-class/test.spec.ts +++ b/tests/tokens-class/test.spec.ts @@ -6,7 +6,7 @@ import { MockBuilder, ngMocks } from 'ng-mocks'; class Class1Service { public readonly name: string = 'class1'; - constructor(name: string) { + public constructor(name: string) { this.name = name; } } diff --git a/tslint.json b/tslint.json index 289ea3b140..79e02d6100 100644 --- a/tslint.json +++ b/tslint.json @@ -1,7 +1,6 @@ { "extends": ["tslint:all", "tslint-jasmine-rules"], "rules": { - "align": false, "arrow-parens": false, "comment-format": false, "completed-docs": false, @@ -9,8 +8,6 @@ "deprecation": false, "file-name-casing": false, "max-classes-per-file": false, - "member-access": false, - "newline-before-return": false, "newline-per-chained-call": false, "no-any": false, "no-default-export": false, @@ -20,24 +17,31 @@ "no-floating-promises": false, "no-focused-tests": true, "no-implicit-dependencies": [true, "dev", ["ng-mocks"]], - "no-inferred-empty-object-type": false, "no-magic-numbers": false, "no-null-keyword": false, "no-null-undefined-union": false, - "no-require-imports": false, + "no-parameter-properties": false, + "no-redundant-jsdoc": false, "no-submodule-imports": false, "no-unbound-method": false, "no-unsafe-any": false, - "no-use-before-declare": false, "only-arrow-functions": false, + "prefer-function-over-method": false, "quotemark": [true, "single"], "semicolon": [true, "always", "strict-bound-class-methods"], - "space-before-function-paren": false, + "space-before-function-paren": [ + true, + { + "anonymous": "always", + "named": "never", + "asyncArrow": "always", + "method": "never", + "constructor": "never" + } + ], "strict-boolean-expressions": false, "strict-comparisons": [true, { "allow-object-equal-comparison": true }], - "trailing-comma": [true, { "esSpecCompliant": true }], "typedef": false, - "unified-signatures": false, - "variable-name": [true, "allow-leading-underscore"] + "unified-signatures": false } }