Error on undefined
thibaultcha opened this issue · comments
Not sure if this is the intended behaviour or not, so this is not a PR, but:
it('should fail with undefined', function (done) {
validate(undefined, function (err, valid) {
});
done();
});
HAR Spec
1) should fail with undefined
✓ should fail with empty object
✓ should fail with empty array
✓ should fail on bad "log.version"
✓ should fail on bad "log.creator"
✓ should not fail with full example
5 passing (5ms)
1 failing
1) HAR Spec should fail with undefined:
TypeError: Cannot read property 'log' of undefined
at validate (eval at <anonymous> (/Users/thibaultcha/Desktop/har-validator/node_modules/is-my-json-valid/node_modules/generate-function/index.js:55:21), <anonymous>:5:11)
at module.exports (/Users/thibaultcha/Desktop/har-validator/src/index.js:7:15)
at Context.<anonymous> (/Users/thibaultcha/Desktop/har-validator/test/validator.js:10:5)
at Test.Runnable.run (/Users/thibaultcha/Desktop/har-validator/node_modules/mocha/lib/runnable.js:218:15)
at Runner.runTest (/Users/thibaultcha/Desktop/har-validator/node_modules/mocha/lib/runner.js:374:10)
at /Users/thibaultcha/Desktop/har-validator/node_modules/mocha/lib/runner.js:452:12
at next (/Users/thibaultcha/Desktop/har-validator/node_modules/mocha/lib/runner.js:299:14)
at /Users/thibaultcha/Desktop/har-validator/node_modules/mocha/lib/runner.js:309:7
at next (/Users/thibaultcha/Desktop/har-validator/node_modules/mocha/lib/runner.js:248:23)
at Object._onImmediate (/Users/thibaultcha/Desktop/har-validator/node_modules/mocha/lib/runner.js:276:5)
at processImmediate [as _immediateCallback] (timers.js:345:15)
yep, should certainly assert for objects only ...