Permalink
Browse files

Set up Coveralls

  • Loading branch information...
mathiasbynens committed May 24, 2014
1 parent 8590543 commit 78bc2bbc95a82d03bfe02247a110db32cfe5854b
Showing with 82 additions and 22 deletions.
  1. +2 −2 .gitignore
  2. +3 −1 .travis.yml
  3. +6 −3 Gruntfile.js
  4. +2 −2 README.md
  5. +11 −10 package.json
  6. +54 −0 tests/index.html
  7. +2 −2 tests/tests.js
  8. +2 −2 tests/tests.src.js
@@ -1,5 +1,5 @@
# JSON version of coverage report
coverage/coverage.json
# Coverage report
coverage

# Installed npm modules
node_modules
@@ -15,4 +15,6 @@ before_script:
# If the enviroment stores rt.jar in a different directory, find it and symlink the directory
- "PREFIX=/usr/lib/jvm; if [ ! -d $PREFIX/java-6-openjdk ]; then for d in $PREFIX/java-6-openjdk-*; do if [ -e $d/jre/lib/rt.jar ]; then sudo ln -s $d $PREFIX/java-6-openjdk; break; fi; done; fi"
script:
"grunt ci"
- "grunt ci"
after_script:
- "grunt shell:cover-coveralls"
@@ -7,9 +7,12 @@ module.exports = function(grunt) {
'stderr': true,
'failOnError': true
},
'cover': {
'cover-html': {
'command': 'istanbul cover --report "html" --verbose --dir "coverage" "tests/tests.js"'
},
'cover-coveralls': {
'command': 'istanbul cover --verbose --dir "coverage" "tests/tests.js" && cat coverage/lcov.info | coveralls; rm -rf coverage/lcov*'
},
'fetch-entities': {
'command': 'curl http://www.whatwg.org/specs/web-apps/current-work/entities.json | sed "s/ /\t/g" > data/entities.json'
},
@@ -73,13 +76,13 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-template');
grunt.loadNpmTasks('grunt-shell');

grunt.registerTask('cover', 'shell:cover');
grunt.registerTask('cover', 'shell:cover-html');
grunt.registerTask('ci', [
'shell:test-narwhal',
'shell:test-phantomjs',
'shell:test-rhino',
'shell:test-ringo',
'shell:test-node',
'shell:test-node'
]);
grunt.registerTask('test', [
'ci',
@@ -1,4 +1,4 @@
# he [![Build status](https://travis-ci.org/mathiasbynens/he.svg?branch=master)](https://travis-ci.org/mathiasbynens/he) [![Dependency status](https://gemnasium.com/mathiasbynens/he.svg)](https://gemnasium.com/mathiasbynens/he)
# he [![Build status](https://travis-ci.org/mathiasbynens/he.svg?branch=master)](https://travis-ci.org/mathiasbynens/he) [![Code coverage status](http://img.shields.io/coveralls/mathiasbynens/he/master.svg)](https://coveralls.io/r/mathiasbynens/he) [![Dependency status](https://gemnasium.com/mathiasbynens/he.svg)](https://gemnasium.com/mathiasbynens/he)

_he_ (for “HTML entities”) is a robust HTML entity encoder/decoder written in JavaScript. It supports [all standardized named character references as per HTML](http://www.whatwg.org/specs/web-apps/current-work/multipage/named-character-references.html), handles [ambiguous ampersands](http://mathiasbynens.be/notes/ambiguous-ampersands) and other edge cases [just like a browser would](http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#tokenizing-character-references), has an extensive test suite, and — contrary to many other JavaScript solutions — _he_ handles astral Unicode symbols just fine. [An online demo is available.](http://mothereff.in/html-entities)

@@ -308,7 +308,7 @@ After cloning this repository, run `npm install` to install the dependencies nee

Once that’s done, you can run the unit tests in Node using `npm test` or `node tests/tests.js`. To run the tests in Rhino, Ringo, Narwhal, and web browsers as well, use `grunt test`.

To generate [the code coverage report](http://rawgithub.com/mathiasbynens/he/master/coverage/he/he.js.html), use `grunt cover`.
To generate the code coverage report, use `grunt cover`.

## Acknowledgements

@@ -46,16 +46,17 @@
"test": "node tests/tests.js"
},
"devDependencies": {
"grunt": "~0.4.5",
"grunt-shell": "~0.7.0",
"grunt-template": "~0.2.3",
"istanbul": "~0.2.10",
"jsesc": "~0.4.3",
"lodash": "~2.4.1",
"qunit-extras": "~1.1.0",
"coveralls": "^2.10.0",
"grunt": "^0.4.5",
"grunt-shell": "^0.7.0",
"grunt-template": "^0.2.3",
"istanbul": "^0.2.10",
"jsesc": "^0.4.3",
"lodash": "^2.4.1",
"qunit-extras": "^1.1.0",
"qunitjs": "~1.11.0",
"regenerate": "~0.6.2",
"requirejs": "~2.1.11",
"string.fromcodepoint": "~0.2.0"
"regenerate": "^0.6.2",
"requirejs": "^2.1.11",
"string.fromcodepoint": "^0.2.0"
}
}
@@ -0,0 +1,54 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>he test suite</title>
<link rel="stylesheet" href="../node_modules/qunitjs/qunit/qunit.css">
</head>
<body>
<div id="qunit"></div>
<script src="../node_modules/qunitjs/qunit/qunit.js"></script>
<script src="../he.js"></script>
<script>
QUnit.urlParams.norequire = /[?&]norequire=true(?:&|$)/.test(location.search);
document.write(QUnit.urlParams.norequire
? '<script src="tests.js"><\/script>'
: '<script src="../node_modules/requirejs/require.js"><\/script>'
);
</script>
<script>
(function(root) {
if (!root.require) {
return;
}
QUnit.config.autostart = false;
requirejs.config({
'baseUrl': './',
'urlArgs': 't=' + (+new Date),
'waitSeconds': 0,
'packages': [
{
'name': 'he',
'location': '..',
'main': 'he'
},
{
'name': 'tests',
'location': '.',
'main': 'tests'
}
]
});
require(['he'], function(he) {
root.he = he;
require(['tests'], function() {
QUnit.start();
});
});
}(this));
</script>
</body>
</html>
@@ -6418,12 +6418,12 @@
'Encode U+1D306 as `&#x1D306;` when `encodeEverything: true, useNamedReferences: true`'
);
equal(
he.encode('a&b123;+©>\u20D2<\u20D2\nfja', { 'encodeEverything': true, 'useNamedReferences': false }),
he.encode('a&b123;+\xA9>\u20D2<\u20D2\nfja', { 'encodeEverything': true, 'useNamedReferences': false }),
'&#x61;&#x26;&#x62;&#x31;&#x32;&#x33;&#x3B;&#x2B;&#xA9;&#x3E;&#x20D2;&#x3C;&#x20D2;&#xA;&#x66;&#x6A;&#x61;',
'All kinds of symbols when `encodeEverything: true, useNamedReferences: false`'
);
equal(
he.encode('a&b123;+©>\u20D2<\u20D2\nfja', { 'encodeEverything': true, 'useNamedReferences': true }),
he.encode('a&b123;+\xA9>\u20D2<\u20D2\nfja', { 'encodeEverything': true, 'useNamedReferences': true }),
'&#x61;&amp;&#x62;&#x31;&#x32;&#x33;&semi;&plus;&copy;&nvgt;&nvlt;&NewLine;&fjlig;&#x61;',
'All kinds of symbols when `encodeEverything: true, useNamedReferences: true`'
);
@@ -6418,12 +6418,12 @@
'Encode U+1D306 as `&#x1D306;` when `encodeEverything: true, useNamedReferences: true`'
);
equal(
he.encode('a&b123;+©>\u20D2<\u20D2\nfja', { 'encodeEverything': true, 'useNamedReferences': false }),
he.encode('a&b123;+\xA9>\u20D2<\u20D2\nfja', { 'encodeEverything': true, 'useNamedReferences': false }),
'&#x61;&#x26;&#x62;&#x31;&#x32;&#x33;&#x3B;&#x2B;&#xA9;&#x3E;&#x20D2;&#x3C;&#x20D2;&#xA;&#x66;&#x6A;&#x61;',
'All kinds of symbols when `encodeEverything: true, useNamedReferences: false`'
);
equal(
he.encode('a&b123;+©>\u20D2<\u20D2\nfja', { 'encodeEverything': true, 'useNamedReferences': true }),
he.encode('a&b123;+\xA9>\u20D2<\u20D2\nfja', { 'encodeEverything': true, 'useNamedReferences': true }),
'&#x61;&amp;&#x62;&#x31;&#x32;&#x33;&semi;&plus;&copy;&nvgt;&nvlt;&NewLine;&fjlig;&#x61;',
'All kinds of symbols when `encodeEverything: true, useNamedReferences: true`'
);

0 comments on commit 78bc2bb

Please sign in to comment.