Open Raynos opened 10 years ago
would this be a tool similar to code coverage instrumentation?
Yes.
There are three parts to this.
checkArguments(arguments, jsigDefinition)
in your appwrapFunctionWithChecks(myFunction, jsigDefintion)
in your appjsig annotate my-app.js
and it will intercept all module.exports
statements and wrap it with the correct wrapper.So the main use case I have is an optional tool like a code coverage tool to annotate my tests.
The other use case is you can just wrap or check things manually if you want.
what I would love is a module for the wrapper as you've defined it that will provide good dev-time checking for my modules so that people developing off of them get saner error messages and better help. Again, from the point of view of making talking to computers better for humans.
:+1: we can break out the wrapper once its done or expose it as a module from jden/jsig
The annotator is a program that you can use instead of
node
and it add runtime checks to all your exports to verify that all callsites to functions match the jsig definition of that function.