Skip to content

Commit b123445

Browse files
authored
fix: enable test stage (#437) (#439)
1 parent ef7384c commit b123445

File tree

13 files changed

+1646
-194
lines changed

13 files changed

+1646
-194
lines changed

.github/workflows/CI.yml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,25 @@ jobs:
2222
with:
2323
name: demo
2424
path: ./dist/gh-pages-deploy
25-
# test:
26-
# runs-on: ubuntu-latest
27-
# steps:
28-
# - uses: actions/checkout@v1
29-
# - name: Install project dependencies
30-
# run: npm i
31-
# - name: Build atft library
32-
# run: npx ng build atft
33-
# - name: Test
34-
# run: |
35-
# sudo apt-get update
36-
# sudo apt-get install -y xvfb
37-
# Xvfb :99 &
38-
# export DISPLAY=:99
39-
# npx ng test --watch=false --code-coverage
40-
# - name: Code coverage
41-
# run: npx codecov
42-
# env:
43-
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
25+
test:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v1
29+
- name: Install project dependencies
30+
run: npm i
31+
- name: Build atft library
32+
run: npx ng build atft
33+
- name: Test
34+
run: |
35+
sudo apt-get update
36+
sudo apt-get install -y xvfb
37+
Xvfb :99 &
38+
export DISPLAY=:99
39+
npx ng test --watch=false --code-coverage
40+
- name: Code coverage
41+
run: npx codecov
42+
env:
43+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
4444
lint:
4545
runs-on: ubuntu-latest
4646
steps:
@@ -79,7 +79,7 @@ jobs:
7979
path: ./dist/gh-pages-deploy
8080
publish:
8181
runs-on: ubuntu-latest
82-
needs: [demo, storybook, doc, lint]
82+
needs: [demo, test, storybook, doc, lint]
8383
if: github.ref == 'refs/heads/master'
8484
steps:
8585
- name: Download demo

angular.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@
4242
"budgets": [
4343
{
4444
"type": "initial",
45-
"maximumWarning": "500kb",
46-
"maximumError": "1mb"
45+
"maximumWarning": "1500kb",
46+
"maximumError": "10mb"
4747
},
4848
{
4949
"type": "anyComponentStyle",
50-
"maximumWarning": "2kb",
51-
"maximumError": "4kb"
50+
"maximumWarning": "20kb",
51+
"maximumError": "40kb"
5252
}
5353
],
5454
"outputHashing": "all"
@@ -90,6 +90,7 @@
9090
"zone.js/testing"
9191
],
9292
"tsConfig": "tsconfig.spec.json",
93+
"karmaConfig": "karma.conf.js",
9394
"inlineStyleLanguage": "scss",
9495
"assets": [
9596
"src/favicon.ico",
@@ -161,9 +162,13 @@
161162
"builder": "@angular-devkit/build-angular:karma",
162163
"options": {
163164
"tsConfig": "projects/atft/tsconfig.spec.json",
165+
"karmaConfig": "projects/atft/karma.conf.js",
164166
"polyfills": [
165167
"zone.js",
166168
"zone.js/testing"
169+
],
170+
"assets": [
171+
{"glob": "**/*", "input": "src/assets", "output": "/assets"}
167172
]
168173
}
169174
},

karma.conf.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// Karma configuration file, see link for more information
2+
// https://karma-runner.github.io/1.0/config/configuration-file.html
3+
4+
module.exports = function (config) {
5+
config.set({
6+
basePath: 'src',
7+
frameworks: ['jasmine', '@angular-devkit/build-angular'],
8+
plugins: [
9+
require('karma-jasmine'),
10+
require('karma-chrome-launcher'),
11+
require('karma-jasmine-html-reporter'),
12+
require('karma-coverage'),
13+
require('@angular-devkit/build-angular/plugins/karma')
14+
],
15+
client: {
16+
jasmine: {
17+
// you can add configuration options for Jasmine here
18+
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
19+
// for example, you can disable the random execution with `random: false`
20+
// or set a specific seed with `seed: 4321`
21+
},
22+
clearContext: false // leave Jasmine Spec Runner output visible in browser
23+
},
24+
customLaunchers: {
25+
ChromeHeadlessCustom: {
26+
base: 'ChromeHeadless',
27+
flags: ['--no-sandbox', '--disable-gpu']
28+
}
29+
},
30+
jasmineHtmlReporter: {
31+
suppressAll: true // removes the duplicated traces
32+
},
33+
coverageReporter: {
34+
dir: require('path').join(__dirname, './coverage/app'),
35+
subdir: '.',
36+
reporters: [
37+
{ type: 'html' },
38+
{ type: 'text-summary' },
39+
{ type: 'lcov', subdir: 'report-lcov' },
40+
]
41+
},
42+
preprocessors: {
43+
'src/**/*.ts': 'coverage'
44+
},
45+
reporters: ['progress', 'kjhtml', 'coverage'],
46+
port: 9876,
47+
colors: true,
48+
logLevel: config.LOG_INFO,
49+
autoWatch: true,
50+
browsers: ['Chrome'],
51+
singleRun: false,
52+
restartOnFileChange: true
53+
});
54+
};

0 commit comments

Comments
 (0)