Various updates.

This commit is contained in:
Julien Fontanet
2015-06-26 11:57:41 +02:00
parent ce15dbf31b
commit dfc312c092
10 changed files with 68 additions and 50 deletions

View File

@@ -0,0 +1,15 @@
{
"comments": false,
"compact": true,
"optional": [
// Experimental features.
// "minification.constantFolding",
// "minification.deadCodeElimination",
"es7.asyncFunctions",
"es7.decorators",
"es7.exportExtensions",
"es7.functionBind",
"runtime"
]
}

View File

@@ -2,6 +2,7 @@
/dist/
npm-debug.log
npm-debug.log.*
!node_modules/*
node_modules/*/

View File

@@ -0,0 +1,3 @@
try { require('clarify') } catch (_) {}
try { require('trace') } catch (_) {}
try { require('source-map-support/register') } catch (_) {}

View File

@@ -0,0 +1 @@
--require ./.mocha.js

View File

@@ -1,4 +1,10 @@
/examples/
example.js
example.js.map
*.example.js
*.example.js.map
/test/
/tests/
*.spec.js
*.spec.js.map

View File

@@ -1,5 +1,6 @@
language: node_js
node_js:
- 'iojs'
- 'iojs-v2'
- 'iojs-v1'
- '0.12'
- '0.10'
- '0.10'

View File

@@ -16,39 +16,44 @@
},
"preferGlobal": false,
"main": "dist/collection",
"bin": {},
"files": [
"dist/",
"*.js"
],
"dependencies": {
"babel-runtime": "^5",
"lodash.bind": "^3",
"lodash.callback": "^3",
"lodash.foreach": "^3",
"make-error": "^1"
"babel-runtime": "^5.6.11",
"lodash.bind": "^3.1.0",
"lodash.callback": "^3.3.0",
"lodash.foreach": "^3.0.3",
"make-error": "^1.0.2"
},
"devDependencies": {
"babel": "^5",
"chai": "*",
"dirty-chai": "^1.2.0",
"babel": "^5.6.11",
"babel-eslint": "^3.1.18",
"clarify": "^1.0.5",
"event-to-promise": "^0.3.2",
"ghooks": "^0.3.2",
"mocha": "*",
"mocha": "^2.2.5",
"must": "^0.12.0",
"sinon": "^1.14.1",
"source-map-support": "*",
"standard": "*"
"source-map-support": "^0.3.2",
"standard": "^4.3.3",
"trace": "^1.2.0"
},
"scripts": {
"build": "mkdir -p dist && babel --optional=runtime --compact=true --source-maps --out-dir=dist/ src/",
"dev": "mkdir -p dist && babel --watch --optional=runtime --source-maps --out-dir=dist/ src/",
"build": "babel --source-maps --out-dir=dist/ src/",
"dev": "babel --watch --source-maps --out-dir=dist/ src/",
"lint": "standard",
"prepublish": "npm run build",
"test": "mocha 'dist/**/*.spec.js'",
"test-dev": "mocha --watch --reporter=min 'dist/**/*.spec.js'"
"test": "npm run lint && mocha --opts .mocha.opts \"dist/**/*.spec.js\"",
"test-dev": "mocha --opts .mocha.opts --watch --reporter=min \"dist/**/*.spec.js\""
},
"standard": {
"ignore": [
"dist/**"
]
],
"parser": "babel-eslint"
},
"config": {
"ghooks": {

View File

@@ -1,17 +1,15 @@
/* eslint-env mocha */
import Collection, {DuplicateItem, NoSuchItem} from '..'
import eventToPromise from 'event-to-promise'
import expect from 'must'
import forEach from 'lodash.foreach'
import sinon from 'sinon'
import chai, {expect} from 'chai'
import dirtyChai from 'dirty-chai'
chai.use(dirtyChai)
// ===================================================================
import sourceMapSupport from 'source-map-support'
sourceMapSupport.install()
import Collection, {DuplicateItem, NoSuchItem} from '..'
// ===================================================================
function waitTicks (n = 1) {
const {nextTick} = process
@@ -75,7 +73,7 @@ describe('Collection', function () {
// Async event.
return eventToPromise(this.col, 'add').then(function (added) {
expect(added).to.have.all.keys('foo')
expect(added).to.have.keys(['foo'])
expect(added.foo).to.be.true()
})
})
@@ -108,7 +106,7 @@ describe('Collection', function () {
// Async event.
return eventToPromise(this.col, 'update').then(function (updated) {
expect(updated).to.have.all.keys('bar')
expect(updated).to.have.keys(['bar'])
expect(updated.bar).to.equal(2)
})
})
@@ -140,7 +138,7 @@ describe('Collection', function () {
// Async event.
return eventToPromise(this.col, 'remove').then(function (removed) {
expect(removed).to.have.all.keys('bar')
expect(removed).to.have.keys(['bar'])
expect(removed.bar).to.not.exist()
})
})
@@ -172,7 +170,7 @@ describe('Collection', function () {
// Async events.
return eventToPromise(this.col, 'add').then(function (added) {
expect(added).to.have.all.keys('foo')
expect(added).to.have.keys(['foo'])
expect(added.foo).to.be.true()
})
})
@@ -190,7 +188,7 @@ describe('Collection', function () {
// Async events.
return eventToPromise(this.col, 'update').then(function (updated) {
expect(updated).to.have.all.keys('bar')
expect(updated).to.have.keys(['bar'])
expect(updated.bar).to.equal(1)
})
})
@@ -211,7 +209,7 @@ describe('Collection', function () {
expect(this.col.has('bar')).to.be.false()
return eventToPromise(this.col, 'remove').then(function (removed) {
expect(removed).to.have.all.keys('bar')
expect(removed).to.have.keys(['bar'])
expect(removed.bar).to.not.exist()
})
})
@@ -226,7 +224,7 @@ describe('Collection', function () {
expect(this.col.has('bar')).to.be.false()
return eventToPromise(this.col, 'remove').then(function (removed) {
expect(removed).to.have.all.keys('bar')
expect(removed).to.have.keys(['bar'])
expect(removed.bar).to.not.exist()
})
})
@@ -241,7 +239,7 @@ describe('Collection', function () {
this.col.touch(foo)
return eventToPromise(this.col, 'update', (items) => {
expect(items).to.have.all.keys('foo')
expect(items).to.have.keys(['foo'])
expect(items.foo).to.equal(foo)
})
})
@@ -255,7 +253,7 @@ describe('Collection', function () {
expect(this.col.size).to.equal(0)
return eventToPromise(this.col, 'remove').then((items) => {
expect(items).to.have.all.keys('bar')
expect(items).to.have.keys(['bar'])
expect(items.bar).to.not.exist()
})
})

View File

@@ -1,16 +1,10 @@
/* eslint-env mocha */
import chai, {expect} from 'chai'
import dirtyChai from 'dirty-chai'
chai.use(dirtyChai)
import sourceMapSupport from 'source-map-support'
sourceMapSupport.install()
import eventToPromise from 'event-to-promise'
import expect from 'must'
import forEach from 'lodash.foreach'
// -------------------------------------------------------------------
// ===================================================================
import Collection from '..'
import Index from '../index'

View File

@@ -1,16 +1,10 @@
/* eslint-env mocha */
import chai, {expect} from 'chai'
import dirtyChai from 'dirty-chai'
chai.use(dirtyChai)
import sourceMapSupport from 'source-map-support'
sourceMapSupport.install()
import eventToPromise from 'event-to-promise'
import expect from 'must'
import forEach from 'lodash.foreach'
// -------------------------------------------------------------------
// ===================================================================
import Collection from '..'
import Index from '../unique-index'