Skip to content

Commit

Permalink
chore: enable tests in CI (#141)
Browse files Browse the repository at this point in the history
* chore: enable tests in CI

* chore(ci): ad 5 min timeout to CI build

* tests: fix test lib tests not running

* tests: add conf for CI tests and optimize CI pipeline (fail early, build what's necessary)

* chore(package): upgrade & dedupe dependencies (cherry-picked from master)

* chore: this doesn't seem to be needed...

* chore(workflows): build sooner
  • Loading branch information
Limon Monte authored and toverux committed Dec 3, 2019
1 parent 6f90f2a commit f4c826d
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 9 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,17 @@ jobs:
- name: Install npm dependencies
run: yarn install

- name: Build
run: yarn build
- name: Build library package
run: yarn build:lib

# - name: Run tests
# run: yarn test
- name: Copy readme and license files
run: yarn build:copy-files

- name: Run library tests
run: yarn test:lib --configuration=ci

- name: Run demo app tests
run: yarn test:demo --configuration=ci

- name: Run automated release process with semantic-release
if: github.event_name == 'push' && contains(github.ref, 'master')
Expand Down
14 changes: 14 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@
"main": "projects/ngx-sweetalert2/src/test.ts",
"tsConfig": "projects/ngx-sweetalert2/tsconfig.spec.json",
"karmaConfig": "projects/ngx-sweetalert2/karma.conf.js"
},
"configurations": {
"ci": {
"watch": false,
"progress": false,
"browsers": "ChromeHeadlessCI"
}
}
},
"lint": {
Expand Down Expand Up @@ -127,6 +134,13 @@
"projects/ngx-sweetalert2-demo/src/styles.css"
],
"scripts": []
},
"configurations": {
"ci": {
"watch": false,
"progress": false,
"browsers": "ChromeHeadlessCI"
}
}
},
"lint": {
Expand Down
8 changes: 7 additions & 1 deletion projects/ngx-sweetalert2-demo/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ module.exports = function (config) {
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
restartOnFileChange: true,
customLaunchers: {
ChromeHeadlessCI: {
base: 'ChromeHeadless',
flags: ['--no-sandbox', '--disable-gpu']
}
}
});
};
4 changes: 3 additions & 1 deletion projects/ngx-sweetalert2-demo/src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ describe('AppComponent', () => {
RouterModule.forRoot([]),
SweetAlert2Module.forRoot()
]
}).compileComponents();
});

TestBed.compileComponents();
}));

it('should create the app', () => {
Expand Down
8 changes: 7 additions & 1 deletion projects/ngx-sweetalert2/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ module.exports = function (config) {
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
restartOnFileChange: true,
customLaunchers: {
ChromeHeadlessCI: {
base: 'ChromeHeadless',
flags: ['--no-sandbox', '--disable-gpu']
}
}
});
};
12 changes: 10 additions & 2 deletions projects/ngx-sweetalert2/src/lib/swal.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { dismissOnDestroyToken, swalProviderToken } from './di';

import { SwalComponent } from './swal.component';
import { SweetAlert2LoaderService } from './sweetalert2-loader.service';

describe('NgxSweetalert2Component', () => {
let component: SwalComponent;
let fixture: ComponentFixture<SwalComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
providers: [
SweetAlert2LoaderService,
{ provide: swalProviderToken, useValue: () => import('sweetalert2') },
{ provide: dismissOnDestroyToken, useValue: true }
],
declarations: [SwalComponent]
})
.compileComponents();
});

TestBed.compileComponents();
}));

beforeEach(() => {
Expand Down

0 comments on commit f4c826d

Please sign in to comment.