From 57cde56e43003f6b404d4b3d9d76b74aafaeeec8 Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Mon, 10 Sep 2018 23:07:20 -0600 Subject: [PATCH] fix tests --- .babelrc | 13 +++++++++++++ .travis.yml | 5 ++--- Makefile | 14 +++++++++++--- karma.conf.js | 4 ++-- package.json | 3 +++ test/debug-spec.js => test.js | 2 +- 6 files changed, 32 insertions(+), 9 deletions(-) create mode 100644 .babelrc rename test/debug-spec.js => test.js (98%) diff --git a/.babelrc b/.babelrc new file mode 100644 index 00000000..b2799de4 --- /dev/null +++ b/.babelrc @@ -0,0 +1,13 @@ +{ + "presets": [ + [ + "@babel/preset-env", + { + "targets": { + "chrome": "58", + "ie": "8" + } + } + ] + ] +} diff --git a/.travis.yml b/.travis.yml index 05f3dbb2..fca0ce19 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,11 +8,10 @@ node_js: - "10" install: - - make install + - npm install script: - - make lint - - make test + - make all matrix: include: diff --git a/Makefile b/Makefile index 48e66bc7..3651a92d 100644 --- a/Makefile +++ b/Makefile @@ -17,17 +17,25 @@ BROWSERIFY ?= $(NODE) $(BIN)/browserify all: lint test -browser: dist/debug.js +browser: dist/debug.js dist/test.js dist/debug.js: src/*.js @mkdir -p dist - @$(BROWSERIFY) --standalone debug . > dist/debug.js + @$(BROWSERIFY) --standalone debug . > $@.es6.js + @babel $@.es6.js > $@ + @rm $@.es6.js + +dist/test.js: test.js + @mkdir -p dist + @cp $< $@.es6.js + @babel $@.es6.js > $@ + @rm $@.es6.js lint: @xo test-node: - @istanbul cover node_modules/mocha/bin/_mocha -- test/**.js + @istanbul cover node_modules/mocha/bin/_mocha -- test.js @cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js test-browser: diff --git a/karma.conf.js b/karma.conf.js index 82f90691..e503df20 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -9,12 +9,12 @@ module.exports = function (config) { // Frameworks to use // available frameworks: https://npmjs.org/browse/keyword/karma-adapter - frameworks: ['mocha', 'chai', 'sinon'], + frameworks: ['mocha', 'chai'], // List of files / patterns to load in the browser files: [ 'dist/debug.js', - 'test/*spec.js' + 'dist/test.js' ], // List of files to exclude diff --git a/package.json b/package.json index c6f613c2..6a15aed3 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,9 @@ "ms": "^2.1.1" }, "devDependencies": { + "@babel/cli": "^7.0.0", + "@babel/core": "^7.0.0", + "@babel/preset-env": "^7.0.0", "browserify": "14.4.0", "chai": "^3.5.0", "concurrently": "^3.1.0", diff --git a/test/debug-spec.js b/test.js similarity index 98% rename from test/debug-spec.js rename to test.js index 6862497e..675d0825 100644 --- a/test/debug-spec.js +++ b/test.js @@ -10,7 +10,7 @@ let debug; if (typeof module !== 'undefined') { chai = require('chai'); expect = chai.expect; - debug = require('../src'); + debug = require('./src'); } describe('debug', () => {