Przeglądaj źródła

Merge pull request #142 from achillesrasquinha/unit-testing

Setup Unit Testing and Coverage
tags/1.2.0
Prateeksha Singh 7 lat temu
committed by GitHub
rodzic
commit
fad5afe70d
Nie znaleziono w bazie danych klucza dla tego podpisu ID klucza GPG: 4AEE18F83AFDEB23
12 zmienionych plików z 1383 dodań i 95 usunięć
  1. +5
    -1
      .babelrc
  2. +14
    -0
      .travis.yml
  3. +42
    -1
      Makefile
  4. +6
    -1
      README.md
  5. +1
    -1
      dist/frappe-charts.min.cjs.js
  6. +1
    -1
      dist/frappe-charts.min.esm.js
  7. +1
    -1
      dist/frappe-charts.min.iife.js.map
  8. +1
    -1
      docs/assets/js/frappe-charts.min.js.map
  9. +8
    -1
      package.json
  10. +2
    -1
      rollup.config.js
  11. +10
    -0
      src/js/utils/test/helpers.test.js
  12. +1292
    -86
      yarn.lock

+ 5
- 1
.babelrc Wyświetl plik

@@ -6,5 +6,9 @@
}
}]
],
"plugins": ["external-helpers"]
"env": {
"test": {
"presets": ["env"]
}
}
}

+ 14
- 0
.travis.yml Wyświetl plik

@@ -0,0 +1,14 @@
language: node_js

node_js:
- "6"
- "8"

before_install:
- make install

script:
- make test

after_success:
- make coveralls

+ 42
- 1
Makefile Wyświetl plik

@@ -1,4 +1,45 @@
-include .env

BASEDIR = $(realpath .)
BASEDIR = $(realpath .)

SRCDIR = $(BASEDIR)/src
DISTDIR = $(BASEDIR)/dist
DOCSDIR = $(BASEDIR)/docs

PROJECT = frappe-charts

NODEMOD = $(BASEDIR)/node_modules
NODEBIN = $(NODEMOD)/.bin

build: clean install
$(NODEBIN)/rollup \
--config $(BASEDIR)/rollup.config.js \
--watch=$(watch)

clean:
rm -rf \
$(BASEDIR)/.nyc_output \
$(BASEDIR)/.yarn-error.log

clear

install.dep:
ifeq ($(shell command -v yarn),)
@echo "Installing yarn..."
npm install -g yarn
endif

install: install.dep
yarn --cwd $(BASEDIR)

test: clean
$(NODEBIN)/cross-env \
NODE_ENV=test \
$(NODEBIN)/nyc \
$(NODEBIN)/mocha \
--require $(NODEMOD)/babel-register \
--recursive \
$(SRCDIR)/js/**/test/*.test.js

coveralls:
$(NODEBIN)/nyc report --reporter text-lcov | $(NODEBIN)/coveralls

+ 6
- 1
README.md Wyświetl plik

@@ -1,6 +1,8 @@
<div align="center">
<img src="https://github.com/frappe/design/blob/master/logos/charts-logo.svg" height="128">
<h2>Frappe Charts</h2>
<a href="https://frappe.github.io/charts">
<h2>Frappe Charts</h2>
</a>
<p align="center">
<p>GitHub-inspired modern, intuitive and responsive charts with zero dependencies</p>
<a href="https://frappe.github.io/charts">
@@ -10,6 +12,9 @@
</div>

<p align="center">
<a href="https://travis-ci.org/frappe/charts">
<img src="https://img.shields.io/travis/frappe/charts.svg?style=flat-square">
</a>
<a href="http://github.com/frappe/charts/tree/master/dist/js/frappe-charts.min.iife.js">
<img src="http://img.badgesize.io/frappe/charts/master/dist/frappe-charts.min.iife.js.svg?compression=gzip">
</a>


+ 1
- 1
dist/frappe-charts.min.cjs.js
Plik diff jest za duży
Wyświetl plik


+ 1
- 1
dist/frappe-charts.min.esm.js
Plik diff jest za duży
Wyświetl plik


+ 1
- 1
dist/frappe-charts.min.iife.js.map
Plik diff jest za duży
Wyświetl plik


+ 1
- 1
docs/assets/js/frappe-charts.min.js.map
Plik diff jest za duży
Wyświetl plik


+ 8
- 1
package.json Wyświetl plik

@@ -36,16 +36,22 @@
"autoprefixer": "^8.2.0",
"babel-core": "^6.26.0",
"babel-plugin-external-helpers": "^6.22.0",
"babel-plugin-istanbul": "^4.1.5",
"babel-preset-env": "^1.6.1",
"babel-preset-latest": "^6.24.1",
"clean-css": "^4.1.11",
"babel-register": "^6.26.0",
"coveralls": "^3.0.0",
"cross-env": "^5.1.4",
"cssnano": "^3.10.0",
"eslint": "^4.18.2",
"fs": "0.0.1-security",
"livereload": "^0.6.3",
"mocha": "^5.0.5",
"node-sass": "^4.7.2",
"npm-run-all": "^4.1.1",
"postcss": "^6.0.21",
"nyc": "^11.6.0",
"postcss-cssnext": "^3.0.2",
"postcss-nested": "^2.1.2",
"precss": "^3.1.2",
@@ -59,5 +65,6 @@
"rollup-plugin-uglify-es": "0.0.1",
"rollup-watch": "^4.3.1"
},
"dependencies": {}
"dependencies": {
}
}

+ 2
- 1
rollup.config.js Wyświetl plik

@@ -72,7 +72,8 @@ export default [
]
}),
babel({
exclude: 'node_modules/**'
exclude: 'node_modules/**',
plugins: ['external-helpers']
}),
replace({
exclude: 'node_modules/**',


+ 10
- 0
src/js/utils/test/helpers.test.js Wyświetl plik

@@ -0,0 +1,10 @@
const assert = require('assert')
const helpers = require('../helpers')

describe('utils.helpers', () => {
it('should return a value fixed upto 2 decimals', () => {
assert.equal(helpers.floatTwo(1.234), 1.23);
assert.equal(helpers.floatTwo(1.456), 1.46);
assert.equal(helpers.floatTwo(1), 1.00);
});
});

+ 1292
- 86
yarn.lock
Plik diff jest za duży
Wyświetl plik


Ładowanie…
Anuluj
Zapisz