chaijs / chai-json-schema

Chai plugin for JSON Schema v4
MIT License
75 stars 17 forks source link

Not work with requirejs #6

Closed darky closed 10 years ago

darky commented 10 years ago

window.jsonpointer is undefined, because jsonpointer correctly work with requirejs

Bartvds commented 10 years ago

That is unfortunate. I think it would be possible to mangle this into the multi-module header somehow.

An implemented Pull Request that works for you would be very welcome (I'm fairly busy atm).

(related to https://github.com/geraintluff/tv4/issues/76 that covers bundling the error/schema data on the error object)

Bartvds commented 10 years ago

I also looked into the tv4 dependency (I contribute on it) but it does not have AMD support either. On the other hand it does not have any dependencies so a shim will work fine I guess.

I created this ticket https://github.com/geraintluff/tv4/issues/77 to track that.

Note that both tv4 and chai-json-schema use grunt-mocha to run a browser test: it would be easy to duplicate that setup to test the AMD wrapper (maybe with a stripped down, AMD compatible test file)

Bartvds commented 10 years ago

Support for this is live as v0.1.10

It still needs a shim for tv4, and jsonpointer.js needs to be require()-able as jsonpointer (without '.js'). Not sure if that is standard but requirejs had trouble with the extension. Please leave a message if you know a better way :)

I'll close this ticket as this cover your request, feel free to reopen if you have remaining questions.