Comparing version 0.1.2 to 0.1.3
{ | ||
"name": "jsonld", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "A JSON-LD Processor and API implementation in JavaScript.", | ||
@@ -5,0 +5,0 @@ "homepage": "http://github.com/digitalbazaar/jsonld.js", |
@@ -17,3 +17,3 @@ /** | ||
if(_nodejs) { | ||
var _jsdir = process.env.JSDIR || 'js'; | ||
var _jsdir = getEnv().JSDIR || 'js'; | ||
var fs = require('fs'); | ||
@@ -32,5 +32,8 @@ var path = require('path'); | ||
var fs = require('fs'); | ||
require('../js/jsonld'); | ||
var system = require('system'); | ||
require('./setImmediate'); | ||
var _jsdir = getEnv().JSDIR || 'js'; | ||
require('../' + _jsdir + '/jsonld'); | ||
jsonld = jsonldjs; | ||
require('../js/Promise'); | ||
require('../' + _jsdir + '/Promise'); | ||
window.Promise = window.DomPromise; | ||
@@ -41,3 +44,2 @@ var assert = require('chai').assert; | ||
var program = {}; | ||
var system = require('system'); | ||
for(var i = 0; i < system.args.length; ++i) { | ||
@@ -64,7 +66,2 @@ var arg = system.args[i]; | ||
}); | ||
// HACK: speed up phantomJS by avoiding setTimeout clamping | ||
jsonld.nextTick = jsonld.setImmediate = function(callback) { | ||
callback(); | ||
}; | ||
} | ||
@@ -144,9 +141,5 @@ | ||
// run tests | ||
if(!program['webidl-only']) { | ||
describe('JSON-LD', function() { | ||
var dir; | ||
if(_nodejs) { | ||
dir = process.env.JSONLD_TEST_SUITE; | ||
} | ||
dir = dir || JSONLD_TEST_SUITE; | ||
describe('JSON-LD', function() { | ||
if(!program['webidl-only']) { | ||
var dir = getEnv().JSONLD_TEST_SUITE || JSONLD_TEST_SUITE; | ||
dir = resolvePath(dir); | ||
@@ -157,62 +150,62 @@ var filename = joinPath(dir, 'manifest.jsonld'); | ||
addManifest(rootManifest); | ||
}); | ||
} | ||
} | ||
// run Web IDL tests | ||
if(!_nodejs) { | ||
require('./webidl/testharness.js'); | ||
require('./webidl/WebIDLParser.js'); | ||
require('./webidl/idlharness.js'); | ||
// run Web IDL tests | ||
if(!_nodejs) { | ||
require('./webidl/testharness.js'); | ||
require('./webidl/WebIDLParser.js'); | ||
require('./webidl/idlharness.js'); | ||
describe('Web IDL', function() { | ||
add_result_callback(function(test) { | ||
it(test.name, function(done) { | ||
// HACK: phantomJS can't set prototype to non-writable? | ||
var msg = test.message || ''; | ||
if(msg.indexOf( | ||
'JsonLdProcessor.prototype is writable expected false') !== -1) { | ||
test.status = 0; | ||
describe('Web IDL', function() { | ||
add_result_callback(function(test) { | ||
it(test.name, function(done) { | ||
// HACK: phantomJS can't set prototype to non-writable? | ||
var msg = test.message || ''; | ||
if(msg.indexOf( | ||
'JsonLdProcessor.prototype is writable expected false') !== -1) { | ||
test.status = 0; | ||
} | ||
// HACK: phantomJS can't set window property to non-enumerable? | ||
if(msg.indexOf( | ||
'"JsonLdProcessor" is enumerable expected false') !== -1) { | ||
test.status = 0; | ||
} | ||
//earl.addAssertion({'@id': ?}, test.status === 0); | ||
assert.equal(test.status, 0, test.message); | ||
done(); | ||
}); | ||
}); | ||
//add_completion_callback(function(tests, status) {}); | ||
// ensure that stringification tests are passed | ||
var toString = Object.prototype.toString; | ||
Object.prototype.toString = function() { | ||
if(this === window.JsonLdProcessor.prototype) { | ||
return '[object JsonLdProcessorPrototype]'; | ||
} | ||
// HACK: phantomJS can't set window property to non-enumerable? | ||
if(msg.indexOf( | ||
'"JsonLdProcessor" is enumerable expected false') !== -1) { | ||
test.status = 0; | ||
else if(this && this.constructor === window.JsonLdProcessor) { | ||
return '[object JsonLdProcessor]'; | ||
} | ||
//earl.addAssertion({'@id': ?}, test.status === 0); | ||
assert.equal(test.status, 0, test.message); | ||
done(); | ||
}); | ||
}); | ||
//add_completion_callback(function(tests, status) {}); | ||
return toString.apply(this, arguments); | ||
}; | ||
// ensure that stringification tests are passed | ||
var toString = Object.prototype.toString; | ||
Object.prototype.toString = function() { | ||
if(this === window.JsonLdProcessor.prototype) { | ||
return '[object JsonLdProcessorPrototype]'; | ||
} | ||
else if(this && this.constructor === window.JsonLdProcessor) { | ||
return '[object JsonLdProcessor]'; | ||
} | ||
return toString.apply(this, arguments); | ||
}; | ||
window.processor = new JsonLdProcessor(); | ||
window.processor = new JsonLdProcessor(); | ||
var idl_array = new IdlArray(); | ||
idl_array.add_idls(readFile('./tests/webidl/JsonLdProcessor.idl')); | ||
idl_array.add_objects({JsonLdProcessor: ['window.processor']}); | ||
idl_array.test(); | ||
}); | ||
} | ||
var idl_array = new IdlArray(); | ||
idl_array.add_idls(readFile('./tests/webidl/JsonLdProcessor.idl')); | ||
idl_array.add_objects({JsonLdProcessor: ['window.processor']}); | ||
idl_array.test(); | ||
}); | ||
} | ||
if(program.earl) { | ||
var filename = resolvePath(program.earl); | ||
describe('Writing EARL report to: ' + filename, function() { | ||
it('should print the earl report', function(done) { | ||
earl.write(filename); | ||
done(); | ||
if(program.earl) { | ||
var filename = resolvePath(program.earl); | ||
describe('Writing EARL report to: ' + filename, function() { | ||
it('should print the earl report', function(done) { | ||
earl.write(filename); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
} | ||
} | ||
}); | ||
@@ -477,2 +470,9 @@ if(!_nodejs) { | ||
function getEnv() { | ||
if(_nodejs) { | ||
return process.env; | ||
} | ||
return system.env; | ||
} | ||
function EarlReport() { | ||
@@ -479,0 +479,0 @@ var today = new Date(); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
513909
36
13599
8