Skip to content

Commit 1d89218

Browse files
committed
Add minimal karma setup
1 parent b08d69c commit 1d89218

File tree

3 files changed

+42
-1
lines changed

3 files changed

+42
-1
lines changed

package.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,20 @@
1414
"author": "Andreas Hocevar",
1515
"license": "BSD-2-Clause",
1616
"scripts": {
17+
"karma": "karma start test/karma.conf.js",
1718
"lint": "eslint *.js"
1819
},
1920
"devDependencies": {
2021
"eslint": "^5.15.0",
21-
"eslint-config-openlayers": "^11.0.0"
22+
"eslint-config-openlayers": "^11.0.0",
23+
"karma": "^4.0.1",
24+
"karma-chrome-launcher": "^2.2.0",
25+
"karma-mocha": "^1.3.0",
26+
"karma-webpack": "^3.0.5",
27+
"mocha": "^6.0.2",
28+
"puppeteer": "^1.13.0",
29+
"should": "^13.2.3",
30+
"sinon": "^7.2.7",
31+
"webpack": "^4.29.6"
2232
}
2333
}

test/index.test.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import should from 'should';
2+
import parseFont from '../index';
3+
4+
describe('mapbox-to-css-font', function() {
5+
6+
describe('parseFont', function() {
7+
it('handle font-weight', function() {
8+
should(parseFont('Noto Sans', 16)).eql('normal 400 16px "Noto Sans"');
9+
should(parseFont('Noto Sans Bold', 16)).eql('normal 700 16px "Noto Sans"');
10+
should(parseFont('Noto Sans SemiBold Italic', 16)).eql('italic 600 16px "Noto Sans"');
11+
});
12+
});
13+
14+
});

test/karma.conf.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const path = require('path');
2+
3+
module.exports = function(karma) {
4+
karma.set({
5+
frameworks: ['mocha'],
6+
files: [{
7+
pattern: path.resolve(__dirname, './index.test.js')
8+
}],
9+
preprocessors: {
10+
'**/*.js': ['webpack']
11+
},
12+
webpack: {
13+
mode: 'development'
14+
},
15+
browsers: ['ChromeHeadless']
16+
});
17+
};

0 commit comments

Comments
 (0)