Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/node:latest-browsers

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/mongo:3.4.4

working_directory: ~/repo

steps:
- checkout

# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-

- run: npm install

- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}

# run tests!
- run: npm test
16 changes: 14 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,22 @@
"author": "Andreas Hocevar",
"license": "BSD-2-Clause",
"scripts": {
"lint": "eslint *.js"
"karma": "karma start test/karma.conf.js",
"lint": "eslint *.js",
"pretest": "npm run lint",
"test": "npm run karma -- --single-run --log-level error"
},
"devDependencies": {
"eslint": "^5.15.0",
"eslint-config-openlayers": "^11.0.0"
"eslint-config-openlayers": "^11.0.0",
"karma": "^4.0.1",
"karma-chrome-launcher": "^2.2.0",
"karma-mocha": "^1.3.0",
"karma-webpack": "^3.0.5",
"mocha": "^6.0.2",
"puppeteer": "^1.13.0",
"should": "^13.2.3",
"sinon": "^7.2.7",
"webpack": "^4.29.6"
}
}
14 changes: 14 additions & 0 deletions test/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import should from 'should';
import parseFont from '../index';

describe('mapbox-to-css-font', function() {

describe('parseFont', function() {
it('handle font-weight', function() {
should(parseFont('Noto Sans', 16)).eql('normal 400 16px "Noto Sans"');
should(parseFont('Noto Sans Bold', 16)).eql('normal 700 16px "Noto Sans"');
should(parseFont('Noto Sans SemiBold Italic', 16)).eql('italic 600 16px "Noto Sans"');
});
});

});
17 changes: 17 additions & 0 deletions test/karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const path = require('path');

module.exports = function(karma) {
karma.set({
frameworks: ['mocha'],
files: [{
pattern: path.resolve(__dirname, './index.test.js')
}],
preprocessors: {
'**/*.js': ['webpack']
},
webpack: {
mode: 'development'
},
browsers: ['ChromeHeadless']
});
};