diff --git a/lint-staged.config.js b/lint-staged.config.js new file mode 100644 index 0000000..23d1877 --- /dev/null +++ b/lint-staged.config.js @@ -0,0 +1,8 @@ +const micromatch = require('micromatch') +module.exports = { + '*.{ts,tsx}': files => { + const match = micromatch.not(files, '**/__tests__/*.{ts,tsx}') + return match.map(file => 'npm run lint') + } +} + diff --git a/package.json b/package.json index e932ad3..7f9580d 100644 --- a/package.json +++ b/package.json @@ -71,14 +71,6 @@ "pre-commit": "lint-staged" } }, - "lint-staged": { - "linters": { - "*.{ts,tsx}": "npm run lint" - }, - "ignore": [ - "**/__tests__/*.{ts,tsx}" - ] - }, "release": { "branch": "stable", "verifyConditions": [ diff --git a/schematics/component/files/__name@dasherize@if-flat__/__name@dasherize__.component.spec.ts b/schematics/component/files/__name@dasherize@if-flat__/__name@dasherize__.component.spec.ts index b74195f..bea487d 100644 --- a/schematics/component/files/__name@dasherize@if-flat__/__name@dasherize__.component.spec.ts +++ b/schematics/component/files/__name@dasherize@if-flat__/__name@dasherize__.component.spec.ts @@ -1,5 +1,5 @@ -import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { IonicModule } from '@ionic/angular'; import { <%= classify(name) %>Component } from './<%= dasherize(name) %>.component'; @@ -10,16 +10,13 @@ describe('<%= classify(name) %>Component', () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ <%= classify(name) %>Component ], - schemas: [CUSTOM_ELEMENTS_SCHEMA], - }) - .compileComponents(); - })); + imports: [IonicModule.forRoot()] + }).compileComponents(); - beforeEach(() => { fixture = TestBed.createComponent(<%= classify(name) %>Component); component = fixture.componentInstance; fixture.detectChanges(); - }); + })); it('should create', () => { expect(component).toBeTruthy(); diff --git a/schematics/page/files/__name@dasherize@if-flat__/__name@dasherize__.page.spec.ts b/schematics/page/files/__name@dasherize@if-flat__/__name@dasherize__.page.spec.ts index 4b40b77..20422d0 100644 --- a/schematics/page/files/__name@dasherize@if-flat__/__name@dasherize__.page.spec.ts +++ b/schematics/page/files/__name@dasherize@if-flat__/__name@dasherize__.page.spec.ts @@ -1,5 +1,5 @@ -import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { IonicModule } from '@ionic/angular'; import { <%= classify(name) %>Page } from './<%= dasherize(name) %>.page'; @@ -10,16 +10,13 @@ describe('<%= classify(name) %>Page', () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ <%= classify(name) %>Page ], - schemas: [CUSTOM_ELEMENTS_SCHEMA], - }) - .compileComponents(); - })); + imports: [IonicModule.forRoot()] + }).compileComponents(); - beforeEach(() => { fixture = TestBed.createComponent(<%= classify(name) %>Page); component = fixture.componentInstance; fixture.detectChanges(); - }); + })); it('should create', () => { expect(component).toBeTruthy();