Skip to content

Commit 8ab7afb

Browse files
committed
Small testing updates.
1 parent 710e477 commit 8ab7afb

File tree

4 files changed

+20
-9
lines changed

4 files changed

+20
-9
lines changed

Makefile

+11-3
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

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
"xmldom": "0.1.19"
3030
},
3131
"devDependencies": {
32-
"chai": "^3.4.1",
3332
"commander": "^2.8.0",
3433
"cors": "^2.7.1",
3534
"express": "^4.13.3",
@@ -57,6 +56,7 @@
5756
"test-browser": "make test-browser",
5857
"test": "make test",
5958
"coverage": "make test-coverage",
59+
"coverage-report": "make test-coverage-report",
6060
"jscs": "jscs lib/jsonld.js tests/*.js",
6161
"jshint": "jshint lib/jsonld.js tests/*.js"
6262
},

test/node-document-loader-tests.js

+5-2
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

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var _nodejs = (typeof process !== 'undefined' &&
1414
process.versions && process.versions.node);
1515

1616
if(_nodejs) {
17-
var _jsdir = getEnv().JSDIR || 'js';
17+
var _jsdir = getEnv().JSDIR || 'lib';
1818
var fs = require('fs');
1919
var path = require('path');
2020
var jsonld = require('../' + _jsdir + '/jsonld')();
@@ -60,11 +60,11 @@ if(_nodejs) {
6060
var fs = require('fs');
6161
var system = require('system');
6262
require('./setImmediate');
63-
var _jsdir = getEnv().JSDIR || 'js';
63+
var _jsdir = getEnv().JSDIR || 'lib';
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)