Skip to content

Commit

Permalink
Merge pull request #24 from unexpectedjs/feature/love
Browse files Browse the repository at this point in the history
Use prettier, remove lock file, update deps, add nyc + coveralls integration
  • Loading branch information
papandreou committed Jan 5, 2019
2 parents acbba81 + e4f27da commit 421541c
Show file tree
Hide file tree
Showing 14 changed files with 476 additions and 6,084 deletions.
11 changes: 5 additions & 6 deletions .editorconfig
@@ -1,13 +1,12 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

root = true

[*]
end_of_line = lf
charset = utf-8
insert_final_newline = true
indent_size = 4
trim_trailing_whitespace = true
indent_style = space

[Makefile]
indent_style = tab

[*.json]
indent_size = 2
4 changes: 3 additions & 1 deletion .eslintignore
@@ -1 +1,3 @@
vendor
/vendor/
/node_modules/
/coverage/
22 changes: 14 additions & 8 deletions .eslintrc.js
@@ -1,9 +1,15 @@
module.exports = {
extends: [
'onelint'
],
env: {
es6: false
},
parserOptions: null
const config = {
extends: ['pretty-standard']
};

if (process.stdin.isTTY) {
// Enable plugin-prettier when running in a terminal. Allows us to have
// eslint verify prettier formatting, while not being bothered by it in our
// editors.
config.plugins = config.plugins || [];
config.plugins.push('prettier');
config.rules = config.rules || {};
config.rules['prettier/prettier'] = 'error';
}

module.exports = config;
7 changes: 4 additions & 3 deletions .gitignore
@@ -1,3 +1,4 @@
node_modules
lib-cov
site-build
/node_modules/
/site-build/
/coverage/
/.nyc_output/
2 changes: 2 additions & 0 deletions .npmrc
@@ -0,0 +1,2 @@
package-lock = false
save-exact = false
1 change: 1 addition & 0 deletions .prettierignore
@@ -0,0 +1 @@
package.json
3 changes: 3 additions & 0 deletions .prettierrc
@@ -0,0 +1,3 @@
{
"singleQuote": true
}
7 changes: 6 additions & 1 deletion .travis.yml
@@ -1,3 +1,8 @@
language: node_js
node_js:
- "0.10"
- '6'
- '8'
- '10'
- 'node'
script: 'npm run ci'
after_success: '<coverage/lcov.info ./node_modules/coveralls/bin/coveralls.js'
13 changes: 0 additions & 13 deletions Makefile
Expand Up @@ -7,19 +7,6 @@ test:

.PHONY: test

coverage:
@rm -rf lib-cov
@jscoverage lib lib-cov
@COVERAGE=1 ./node_modules/.bin/mocha \
--require ./test/common \
--reporter html-cov \
./documentation/**/*.md \
./test/**/*.js \
> lib-cov/index.html
@echo "Coverage report has been generated to lib-cov/index.html"

.PHONY: coverage

test-browser:
@./node_modules/.bin/serve .

Expand Down
97 changes: 49 additions & 48 deletions lib/unexpected-knockout.js
@@ -1,3 +1,4 @@
/*global define*/
// Copyright (c) 2014 Sune Simonsen <sune@we-knowhow.dk>
//
// Permission is hereby granted, free of charge, to any person
Expand All @@ -20,54 +21,54 @@
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

(function (root, factory) {
if (typeof exports === 'object') {
module.exports = factory(require('knockout'));
} else if (typeof define === 'function' && define.amd) {
define(['knockout'], factory);
} else {
root.weknowhow = root.weknowhow || {};
root.weknowhow.unexpectedKnockout = factory(root.ko);
}
}(this, function (ko) {
return {
name: 'unexpected-knockout',
installInto: function (expect) {
expect.addType({
name: 'knockout-observable',
base: 'wrapperObject',
identify: function (value) {
return ko.isObservable(value);
},
unwrap: function (observable) {
return observable.peek();
},
prefix: function (output) {
return output.code('ko.observable(');
},
suffix: function (output) {
return output.code(')');
}
});
(function(root, factory) {
if (typeof exports === 'object') {
module.exports = factory(require('knockout'));
} else if (typeof define === 'function' && define.amd) {
define(['knockout'], factory);
} else {
root.weknowhow = root.weknowhow || {};
root.weknowhow.unexpectedKnockout = factory(root.ko);
}
})(this, function(ko) {
return {
name: 'unexpected-knockout',
installInto: function(expect) {
expect.addType({
name: 'knockout-observable',
base: 'wrapperObject',
identify: function(value) {
return ko.isObservable(value);
},
unwrap: function(observable) {
return observable.peek();
},
prefix: function(output) {
return output.code('ko.observable(');
},
suffix: function(output) {
return output.code(')');
}
});

expect.addType({
name: 'knockout-computed',
base: 'knockout-observable',
identify: function (value) {
return ko.isComputed(value);
},
prefix: function (output) {
return output.code('ko.computed(');
}
});
expect.addType({
name: 'knockout-computed',
base: 'knockout-observable',
identify: function(value) {
return ko.isComputed(value);
},
prefix: function(output) {
return output.code('ko.computed(');
}
});

expect.addAssertion('[not] to be observable', function (expect, subject) {
expect(ko.isObservable(subject), '[not] to be true');
});
expect.addAssertion('[not] to be observable', function(expect, subject) {
expect(ko.isObservable(subject), '[not] to be true');
});

expect.addAssertion('[not] to be computed', function (expect, subject) {
expect(ko.isComputed(subject), '[not] to be true');
});
}
};
}));
expect.addAssertion('[not] to be computed', function(expect, subject) {
expect(ko.isComputed(subject), '[not] to be true');
});
}
};
});

0 comments on commit 421541c

Please sign in to comment.