Skip to content

Commit

Permalink
rm jshint, add eslint, jscs, assert style
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleeye committed Aug 29, 2015
1 parent 72acf22 commit fe09bc8
Show file tree
Hide file tree
Showing 13 changed files with 58 additions and 37 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
coverage
26 changes: 26 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"rules": {
"quotes": [2, "single"],
"strict": [2, "never"],
"eol-last": 0,
"no-use-before-define": 0,
"new-cap": [0, {"capIsNew": false}],
"no-unused-vars": [2, {"args": "none"}],
"no-alert": 0,
"no-shadow": 0,
"object-shorthand": 0,
"no-underscore-dangle": 0,
"curly": 0,
"no-empty": 0,
"no-unused-expressions": 0
},
"env": {
"browser": true,
"node": true,
"mocha": true,
"es6": true
},
"globals": {
"expect": true
}
}
7 changes: 7 additions & 0 deletions .jscsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"disallowEmptyBlocks": true,
"validateIndentation": "\t",
"excludeFiles": [
"coverage/**"
]
}
2 changes: 0 additions & 2 deletions .jshintignore

This file was deleted.

29 changes: 0 additions & 29 deletions .jshintrc

This file was deleted.

4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,7 @@ to contain subset
*/
```

and with asset interface
```js
assert.containSubset({a: 1, b: 2}, {a: 1});
```
6 changes: 5 additions & 1 deletion lib/chai-subset.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = function(chai, utils) {
var Assertion = chai.Assertion;
var assertionPrototype = Assertion.prototype;

Assertion.addChainableMethod('containSubset', function (expected) {
Assertion.addMethod('containSubset', function (expected) {
var actual = utils.flag(this, 'object');
var showDiff = chai.config.showDiff;

Expand All @@ -15,6 +15,10 @@ module.exports = function(chai, utils) {
showDiff
);
});

chai.assert.containSubset = function(val, exp, msg) {
new chai.Assertion(val, msg).to.be.containSubset(exp);
};
};

function compare(expected, actual) {
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "chai-subset",
"version": "1.0.1",
"version": "1.1.0",
"description": "Object properties matcher for Chai",
"main": "lib/chai-subset.js",
"scripts": {
Expand All @@ -27,10 +27,12 @@
},
"homepage": "https://github.com/debitoor/chai-subset",
"devDependencies": {
"chai": "^2.1.2",
"chai": "^3.2.0",
"coveralls": "^2.11.3",
"istanbul": "^0.3.17",
"jscs": "^1.13.1",
"mocha": "^2.2.1",
"mocha-jshint": "^2.0.2"
"mocha-eslint": "^1.0.0",
"mocha-jscs": "^1.2.0"
}
}
2 changes: 1 addition & 1 deletion test/common.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var chai = require('chai');
var chaiSubset = require("../lib/chai-subset");
var chaiSubset = require('../lib/chai-subset');
global.expect = chai.expect;
chai.use(chaiSubset);
1 change: 1 addition & 0 deletions test/eslint.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require('mocha-eslint')(['lib', 'test']);
1 change: 1 addition & 0 deletions test/jscs.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require('mocha-jscs')(['lib', 'test']);
1 change: 0 additions & 1 deletion test/jshint.spec.js

This file was deleted.

7 changes: 7 additions & 0 deletions test/unit/chai-subset.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,11 @@ describe('circular objects', function() {
]
});
});
});

describe('assert style of test', function () {
it('should find subset', function () {
var assert = require('chai').assert;
assert.containSubset({a: 1, b: 2}, {a: 1});
});
});

0 comments on commit fe09bc8

Please sign in to comment.