Closed mfdeveloper closed 8 years ago
Hi @mfdeveloper and thank you for this PR!
New file create-index.ts that create src/index.ts file with import statements. This file is included by karma-shim.ts. This file always exists because is created/overrided "on the fly" every time that you run the unit tests
This feature already exists, but is implemented in a different way. Note: in commit https://github.com/marcoturi/ionic2-boilerplate/commit/ab97c5efc144aff9522b6c944a1010f8f8cc6eab i added this feature to npm run test
too (previously it was working only with npm run test:watch
). I prefer to not write any automatic file in src, as it implies the dev to know another thing. If you don't like the replace method (i understand it :)) you can use a different file and import it like you did in this PR.
Change the scss-lint discontinued package to sass-lint.
I'm not an expert on sass/scss. The reason why I'm using scss-lint instead of sass-lint it's because the scss.-lint.yml is more supported and has more supported rules, that you will lose if you convert it by using tools like this. Looking to https://github.com/brigade/scss-lint and https://github.com/sasstools/sass-lint I feel the first one more reliable. If you have any link/resource that shows why sass-lint > scss-lint could be better, I will be happy to read it and update the project.
New generic class ComponentTest that encapsulate TestBed configs and params that repeat in every test. This is to minimize DRY, and centralize test details. Added mocks.ts file to mocking Ionic2 dependencies stack. This is needed to formControl of ReactiveForm, even using CUSTOM_ELEMENTS_SCHEMA. To verify this, create a new empty project with sidemenu scaffold.
This is a real nice idea! And i will be glad to add this to the optional libraries if you will put it on npm. But i think it's out of the scope of this project to include it yet. Also please consider to add a second parameter to the init method to mock providers as it is not usable with the current implementation IMHO.
Generate extra coverage file cobertura.xml to Jenkins report
As you already know coverage is disabled right now. However even if it wasn't, as for the previous point, i can't merge it because it's out of the scope of the boilerplate (i can't support all CI systems, specially the ones I don't know). But if you want you can edit the Readme and add instructions in the tip section about how to use Jenkins instead on Gitlab, and I will be glad to merge them.
Again thank you for this PR, and feel free to sand other PR in the future.
Closes #3
Some changes to unit test structure:
create-index.ts
that createsrc/index.ts
file withimport
statements. This file is included bykarma-shim.ts
. This file always exists because is created/overrided "on the fly" every time that you run the unit testsscss-lint
discontinued package tosass-lint
.ComponentTest
that encapsulateTestBed
configs and params that repeat in every test. This is to minimize DRY, and centralize test details.cobertura.xml
to Jenkins reportmocks.ts
file to mocking Ionic2 dependencies stack. This is needed toformControl
ofReactiveForm
, even usingCUSTOM_ELEMENTS_SCHEMA
. To verify this, create a new empty project withsidemenu
scaffold.Obs: This is fixes the problem defined on issue #3