Skip to content

Commit 3673af1

Browse files
committed
Basic setup with unit tests using karma for actual browser testing
0 parents  commit 3673af1

11 files changed

+5906
-0
lines changed

.babelrc

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"presets": [
3+
["@babel/env", {
4+
"targets": {
5+
"browsers": ["last 2 versions", "IE >= 11"]
6+
}
7+
}]
8+
],
9+
"comments" : false
10+
}

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
dist
3+
.vscode

demo.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Paste this code into chrome://downloads console to try it out :)
2+
3+
console.log(querySelectorDeep('downloads-item:nth-child(4) #remove'));
4+
console.log(querySelectorDeep('#downloads-list .is-active a[href^="https://"]'));
5+
console.log(querySelectorDeep('#downloads-list div#title-area + a'));

karma.conf.js

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// Karma configuration
2+
// Generated on Sun Jul 01 2018 21:22:40 GMT+0100 (GMT Summer Time)
3+
4+
module.exports = function(config) {
5+
config.set({
6+
7+
// base path that will be used to resolve all patterns (eg. files, exclude)
8+
basePath: '',
9+
10+
11+
// frameworks to use
12+
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
13+
frameworks: ['jasmine'],
14+
15+
16+
// list of files / patterns to load in the browser
17+
files: [
18+
{ pattern: 'node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js', served: true, included: true },
19+
'dist/testbundle.js'
20+
],
21+
22+
23+
// list of files / patterns to exclude
24+
exclude: [],
25+
26+
27+
// preprocess matching files before serving them to the browser
28+
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
29+
preprocessors: {},
30+
31+
32+
// test results reporter to use
33+
// possible values: 'dots', 'progress'
34+
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
35+
reporters: ['progress'],
36+
37+
38+
// web server port
39+
port: 9876,
40+
41+
42+
// enable / disable colors in the output (reporters and logs)
43+
colors: true,
44+
45+
46+
// level of logging
47+
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
48+
logLevel: config.LOG_INFO,
49+
50+
51+
// enable / disable watching file and executing tests whenever any file changes
52+
autoWatch: true,
53+
54+
55+
// start these browsers
56+
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
57+
browsers: ['Chrome', 'Firefox'],
58+
59+
60+
// Continuous Integration mode
61+
// if true, Karma captures browsers, runs the tests and exits
62+
singleRun: true,
63+
64+
// Concurrency level
65+
// how many browser should be started simultaneous
66+
concurrency: Infinity
67+
})
68+
}

0 commit comments

Comments
 (0)