Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
js-frontend-tutorial
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ci-general
js-frontend-tutorial
Wiki
Confirure unit tests for gitlab runner
Changes
Page history
New page
Templates
Clone repository
Create unit tests runner
authored
6 years ago
by
Taras Gaidukov
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Confirure-unit-tests-for-gitlab-runner.md
+53
-0
53 additions, 0 deletions
Confirure-unit-tests-for-gitlab-runner.md
with
53 additions
and
0 deletions
Confirure-unit-tests-for-gitlab-runner.md
0 → 100644
View page @
c9548835
# Confirure unit tests for gitlab runner
1.
Create another Karma config file
`karma-ci.conf.js`
that will be used by gitlab-runner. In this configuration we will use
`puppeteer`
instead of usual Chrome browser:
karma-ci.conf.js
```
process.env.CHROME_BIN = require('puppeteer').executablePath();
module.exports = config => {
config.set({
basePath: './js',
frameworks: ['jasmine'],
files: [
'**/*.js'
],
exclude: [
'main.js'
],
preprocessors: {},
reporters: ['progress'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
customLaunchers: {
Chrome: {
base: 'ChromeHeadless',
flags: ['--no-sandbox']
}
},
singleRun: true,
concurrency: Infinity
});
};
```
2.
Add
`test-ci`
command to
`package.json`
```
"scripts": {
"test": "karma start karma.conf.js",
"protractor": "protractor e2e-tests/protractor.conf.js",
"start": "http-server . -a localhost -p 8000 -c-1",
"test-ci": "karma start karma-ci.conf.js"
},
```
3.
Push changes to the repository, then you can see a new pipeline:


\ No newline at end of file
This diff is collapsed.
Click to expand it.