Skip to content

Commit

Permalink
chore: jasmine now uses babel to avoid the need to bundle the code fo…
Browse files Browse the repository at this point in the history
…r testing

This brings the project inline with the d3fc archetype.
  • Loading branch information
ColinEberhardt committed Jul 13, 2016
1 parent ac5c621 commit 48c93bf
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .babelrc
@@ -1,3 +1,3 @@
{
"presets": ["es2015-rollup"]
"presets": ["es2015"]
}
5 changes: 3 additions & 2 deletions package.json
Expand Up @@ -17,17 +17,18 @@
},
"scripts": {
"bundle": "rimraf build && rollup -c && uglifyjs build/d3fc-label-layout.js --compress --mangle -o build/d3fc-label-layout.min.js",
"test": "npm run bundle && eslint index.js src/**/*.js test/**/*.js && jasmine JASMINE_CONFIG_PATH=test/support/jasmine.json",
"test": "eslint index.js src/**/*.js test/**/*.js && jasmine JASMINE_CONFIG_PATH=test/support/jasmine.json",
"semantic-release": "semantic-release pre && npm publish && semantic-release post",
"site": "npm run test && mkdirp site/lib && ncp build/d3fc-label-layout.js site/lib/d3fc-label-layout.js",
"dev": "npm run site && watch -p '{src,test}/**/*.js' -c 'npm run site'",
"deploy-site": "npm run site && bash ./site/deploy.sh"
},
"devDependencies": {
"babel-preset-es2015": "^6.9.0",
"babel-preset-es2015-rollup": "^1.1.1",
"babel-register": "^6.9.0",
"d3fc": "^7.0.0",
"eslint": "^2.2.0",
"eslint-config-airbnb": "^6.0.2",
"eslint-config-standard": "^5.1.0",
"eslint-plugin-promise": "^1.1.0",
"eslint-plugin-standard": "^1.3.2",
Expand Down
7 changes: 6 additions & 1 deletion rollup.config.js
Expand Up @@ -4,7 +4,12 @@ export default {
entry: 'index.js',
moduleName: 'fc',
format: 'umd',
plugins: [ babel() ],
plugins: [
babel({
babelrc: false,
presets: ['es2015-rollup']
})
],
dest: 'build/d3fc-label-layout.js',
globals: {
'd3': 'd3',
Expand Down
6 changes: 3 additions & 3 deletions test/annealingSpec.js
@@ -1,5 +1,5 @@
require('d3');
const label = require('../build/d3fc-label-layout');
import d3 from 'd3';
import annealing from '../src/annealing';

describe('annealing', function() {

Expand All @@ -19,7 +19,7 @@ describe('annealing', function() {
{x: 40, y: 40, width: elementWidth, height: elementHeight}
];

var strategiser = label.annealing()
var strategiser = annealing()
.bounds([containerWidth, containerHeight]);

var mathRandom = Math.random;
Expand Down
6 changes: 3 additions & 3 deletions test/greedySpec.js
@@ -1,5 +1,5 @@
require('d3');
const label = require('../build/d3fc-label-layout');
import d3 from 'd3';
import greedy from '../src/greedy';

describe('greedy', function() {

Expand All @@ -12,7 +12,7 @@ describe('greedy', function() {
{x: 50, y: 50, width: elementWidth, height: elementHeight}
];

var strategiser = label.greedy()
var strategiser = greedy()
.bounds([containerWidth, containerHeight]);

describe('out of bounds data', function() {
Expand Down
2 changes: 1 addition & 1 deletion test/helpers/beforeEachSpec.js
@@ -1,2 +1,2 @@
var jsdom = require('jsdom');
import jsdom from 'jsdom';
global.document = jsdom.jsdom();
6 changes: 2 additions & 4 deletions test/intersectSpec.js
@@ -1,7 +1,5 @@
const d3 = require('d3');
const label = require('../build/d3fc-label-layout');

var intersect = label.intersect;
import d3 from 'd3';
import intersect from '../src/intersect';

describe('intersect', function() {

Expand Down
7 changes: 4 additions & 3 deletions test/labelSpec.js
@@ -1,12 +1,13 @@
const d3 = require('d3');
const label = require('../build/d3fc-label-layout');
import d3 from 'd3';
import label from '../src/label';
import removeOverlaps from '../src/removeOverlaps';

describe('label', function() {

it('should remove collisions', function() {
var svg = document.createElement('svg');

var labels = label.label(label.removeOverlaps())
var labels = label(removeOverlaps())
.size([10, 10])
.position(function(d) { return [d.x, d.y]; });

Expand Down
1 change: 1 addition & 0 deletions test/support/jasmine.json
Expand Up @@ -4,6 +4,7 @@
"**/*[sS]pec.js"
],
"helpers": [
"../node_modules/babel-register/lib/node.js",
"helpers/**/*.js"
],
"stopSpecOnExpectationFailure": false,
Expand Down

0 comments on commit 48c93bf

Please sign in to comment.