-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: unit test via karma jasmine
* ChromeHeadlessCustom mode * apt install chrome
- Loading branch information
Showing
8 changed files
with
12,057 additions
and
7,424 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Karma Jasmine Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
units: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build Docker image | ||
run: docker build -t jasmine -f ./docker-build/docker-actions/Dockerfile | ||
|
||
- name: Run test | ||
run: docker run jasmine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
FROM node:16.17.1-buster | ||
|
||
# Install necessary dependencies | ||
RUN apt-get update \ | ||
&& apt-get install -y wget gnupg \ | ||
&& wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - \ | ||
&& echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \ | ||
&& apt-get update \ | ||
&& apt-get install -y google-chrome-stable \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN mkdir /palladium-view | ||
WORKDIR /palladium-view | ||
COPY . /palladium-view | ||
|
||
RUN npm install | ||
|
||
CMD ["npm" "run" "ng" "test"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
const { Server } = require("karma"); | ||
|
||
module.exports = function (config) { | ||
config.set({ | ||
basePath: "", | ||
frameworks: ["jasmine", "@angular-devkit/build-angular"], | ||
plugins: [ | ||
require("karma-jasmine"), | ||
require("karma-chrome-launcher"), | ||
require("karma-jasmine-html-reporter"), | ||
require("karma-coverage-istanbul-reporter"), | ||
require("@angular-devkit/build-angular/plugins/karma"), | ||
], | ||
client: { | ||
clearContext: false, // leave Jasmine Spec Runner output visible in browser | ||
}, | ||
coverageIstanbulReporter: { | ||
dir: require("path").join(__dirname, "./coverage/palladium"), | ||
reports: ["html", "lcovonly", "text-summary"], | ||
fixWebpackSourcePaths: true, | ||
}, | ||
reporters: ["progress", "kjhtml"], | ||
port: 9876, | ||
colors: true, | ||
logLevel: config.LOG_INFO, | ||
autoWatch: true, | ||
browsers: ["Chrome"], | ||
singleRun: true, | ||
customLaunchers: { | ||
ChromeHeadlessCustom: { | ||
base: "ChromeHeadless", | ||
flags: [ | ||
"--disable-gpu", // Disable hardware acceleration | ||
"--no-sandbox", // Needed when running as root user in Docker | ||
"--headless", | ||
"--disable-dev-shm-usage", // Fixes issues with Docker memory limitations | ||
"--disable-setuid-sandbox", // not recommended for security reasons but sometimes necessary | ||
], | ||
}, | ||
}, | ||
browsers: ['ChromeHeadlessCustom'], | ||
restartOnFileChange: true, | ||
files: [ | ||
{ | ||
pattern: "src/**/*.spec.ts", | ||
watched: true, | ||
included: false, | ||
served: false, | ||
}, | ||
], | ||
httpsServerOptions: { // disable SSL certificate checks | ||
key: '', | ||
cert: '', | ||
ca: '', | ||
requestCert: false, | ||
rejectUnauthorized: false | ||
} | ||
}); | ||
}; |
Oops, something went wrong.