Skip to content

Commit 4159e59

Browse files
kensodemannmhartington
authored andcommitted
fix(unit-tests): allow the components to hydrate (#173)
1 parent 6586dd4 commit 4159e59

File tree

4 files changed

+16
-22
lines changed

4 files changed

+16
-22
lines changed

lint-staged.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const micromatch = require('micromatch')
2+
module.exports = {
3+
'*.{ts,tsx}': files => {
4+
const match = micromatch.not(files, '**/__tests__/*.{ts,tsx}')
5+
return match.map(file => 'npm run lint')
6+
}
7+
}
8+

package.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,6 @@
7171
"pre-commit": "lint-staged"
7272
}
7373
},
74-
"lint-staged": {
75-
"linters": {
76-
"*.{ts,tsx}": "npm run lint"
77-
},
78-
"ignore": [
79-
"**/__tests__/*.{ts,tsx}"
80-
]
81-
},
8274
"release": {
8375
"branch": "stable",
8476
"verifyConditions": [

schematics/component/files/__name@dasherize@if-flat__/__name@dasherize__.component.spec.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
21
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2+
import { IonicModule } from '@ionic/angular';
33

44
import { <%= classify(name) %>Component } from './<%= dasherize(name) %>.component';
55

@@ -10,16 +10,13 @@ describe('<%= classify(name) %>Component', () => {
1010
beforeEach(async(() => {
1111
TestBed.configureTestingModule({
1212
declarations: [ <%= classify(name) %>Component ],
13-
schemas: [CUSTOM_ELEMENTS_SCHEMA],
14-
})
15-
.compileComponents();
16-
}));
13+
imports: [IonicModule.forRoot()]
14+
}).compileComponents();
1715

18-
beforeEach(() => {
1916
fixture = TestBed.createComponent(<%= classify(name) %>Component);
2017
component = fixture.componentInstance;
2118
fixture.detectChanges();
22-
});
19+
}));
2320

2421
it('should create', () => {
2522
expect(component).toBeTruthy();

schematics/page/files/__name@dasherize@if-flat__/__name@dasherize__.page.spec.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
21
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2+
import { IonicModule } from '@ionic/angular';
33

44
import { <%= classify(name) %>Page } from './<%= dasherize(name) %>.page';
55

@@ -10,16 +10,13 @@ describe('<%= classify(name) %>Page', () => {
1010
beforeEach(async(() => {
1111
TestBed.configureTestingModule({
1212
declarations: [ <%= classify(name) %>Page ],
13-
schemas: [CUSTOM_ELEMENTS_SCHEMA],
14-
})
15-
.compileComponents();
16-
}));
13+
imports: [IonicModule.forRoot()]
14+
}).compileComponents();
1715

18-
beforeEach(() => {
1916
fixture = TestBed.createComponent(<%= classify(name) %>Page);
2017
component = fixture.componentInstance;
2118
fixture.detectChanges();
22-
});
19+
}));
2320

2421
it('should create', () => {
2522
expect(component).toBeTruthy();

0 commit comments

Comments
 (0)