Skip to content

Commit

Permalink
Small testing updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlehn committed Jan 7, 2017
1 parent 710e477 commit 8ab7afb
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
14 changes: 11 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
TESTS = tests/test.js
LOCAL_TESTS = test/*.js
REPORTER = spec

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

test-coverage:
./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- \
-u exports -R $(REPORTER) $(TESTS)
-t 30000 -u exports -R $(REPORTER) $(TESTS)

test-coverage-lcov:
./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha \
--report lcovonly -- -t 30000 -u exports -R $(REPORTER) $(TESTS)

test-coverage-report:
./node_modules/.bin/istanbul report

test-local:
./node_modules/.bin/mocha
./node_modules/.bin/mocha -t 30000 -R $(REPORTER) $(LOCAL_TESTS)

clean:
rm -rf coverage
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"xmldom": "0.1.19"
},
"devDependencies": {
"chai": "^3.4.1",
"commander": "^2.8.0",
"cors": "^2.7.1",
"express": "^4.13.3",
Expand Down Expand Up @@ -57,6 +56,7 @@
"test-browser": "make test-browser",
"test": "make test",
"coverage": "make test-coverage",
"coverage-report": "make test-coverage-report",
"jscs": "jscs lib/jsonld.js tests/*.js",
"jshint": "jshint lib/jsonld.js tests/*.js"
},
Expand Down
7 changes: 5 additions & 2 deletions test/node-document-loader-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ describe('For the node.js document loader', function() {

describe('When built with no options specified', function() {
var options = {};
it('loading should work', function(callback) {
it('loading should work', function(done) {
jsonld.useDocumentLoader(documentLoaderType);
jsonld.expand('http://schema.org/', callback);
jsonld.expand('http://schema.org/', function(err, expanded) {
assert.ifError(err);
done();
});
});
});

Expand Down
6 changes: 3 additions & 3 deletions tests/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var _nodejs = (typeof process !== 'undefined' &&
process.versions && process.versions.node);

if(_nodejs) {
var _jsdir = getEnv().JSDIR || 'js';
var _jsdir = getEnv().JSDIR || 'lib';
var fs = require('fs');
var path = require('path');
var jsonld = require('../' + _jsdir + '/jsonld')();
Expand Down Expand Up @@ -60,11 +60,11 @@ if(_nodejs) {
var fs = require('fs');
var system = require('system');
require('./setImmediate');
var _jsdir = getEnv().JSDIR || 'js';
var _jsdir = getEnv().JSDIR || 'lib';
require('../' + _jsdir + '/jsonld');
jsonld = jsonldjs;
window.Promise = require('es6-promise').Promise;
var assert = require('chai').assert;
var assert = require('assert');
require('mocha/mocha');
require('mocha-phantomjs/lib/mocha-phantomjs/core_extensions');
var program = {};
Expand Down

0 comments on commit 8ab7afb

Please sign in to comment.