Skip to content

Commit fbf7abe

Browse files
committed
Small testing updates.
- Fix test callback handling. - Remove chai usage. - Use 30s timeout. - Add some coverage targets. - Use explicit local tests file list.
1 parent b79b80c commit fbf7abe

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

Makefile

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
TESTS = tests/test.js
2+
LOCAL_TESTS = test/*.js
23
REPORTER = spec
34

45
all:
@@ -13,7 +14,7 @@ test-suite-node:
1314
exit 1; \
1415
fi
1516
@if [ -d $(JSONLD_TEST_SUITE) ]; then \
16-
NODE_ENV=test ./node_modules/.bin/mocha -A -R $(REPORTER) $(TESTS); \
17+
NODE_ENV=test ./node_modules/.bin/mocha -t 30000 -A -R $(REPORTER) $(TESTS); \
1718
else \
1819
echo "Error: tests not found at $(JSONLD_TEST_SUITE)"; \
1920
exit 1; \
@@ -51,10 +52,17 @@ test-normalization-browser:
5152

5253
test-coverage:
5354
./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- \
54-
-u exports -R $(REPORTER) $(TESTS)
55+
-t 30000 -u exports -R $(REPORTER) $(TESTS)
56+
57+
test-coverage-lcov:
58+
./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha \
59+
--report lcovonly -- -t 30000 -u exports -R $(REPORTER) $(TESTS)
60+
61+
test-coverage-report:
62+
./node_modules/.bin/istanbul report
5563

5664
test-local:
57-
./node_modules/.bin/mocha
65+
./node_modules/.bin/mocha -t 30000 -R $(REPORTER) $(LOCAL_TESTS)
5866

5967
clean:
6068
rm -rf coverage

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
"xmldom": "0.1.19"
3232
},
3333
"devDependencies": {
34-
"chai": "^3.4.1",
3534
"commander": "^2.8.0",
3635
"cors": "^2.7.1",
3736
"express": "^4.13.3",
@@ -59,6 +58,7 @@
5958
"test-browser": "make test-browser",
6059
"test": "make test",
6160
"coverage": "make test-coverage",
61+
"coverage-report": "make test-coverage-report",
6262
"jscs": "jscs js/jsonld.js tests/*.js",
6363
"jshint": "jshint js/jsonld.js tests/*.js"
6464
},

test/node-document-loader-tests.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@ describe('For the node.js document loader', function() {
1616

1717
describe('When built with no options specified', function() {
1818
var options = {};
19-
it('loading should work', function(callback) {
19+
it('loading should work', function(done) {
2020
jsonld.useDocumentLoader(documentLoaderType);
21-
jsonld.expand('http://schema.org/', callback);
21+
jsonld.expand('http://schema.org/', function(err, expanded) {
22+
assert.ifError(err);
23+
done();
24+
});
2225
});
2326
});
2427

tests/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ if(_nodejs) {
6464
require('../' + _jsdir + '/jsonld');
6565
jsonld = jsonldjs;
6666
window.Promise = require('es6-promise').Promise;
67-
var assert = require('chai').assert;
67+
var assert = require('assert');
6868
require('mocha/mocha');
6969
require('mocha-phantomjs/lib/mocha-phantomjs/core_extensions');
7070
var program = {};

0 commit comments

Comments
 (0)