validate compliance of a javascript module against a test suite module
npm install compliancevalidate compliance of a javascript module against a test suite module.
primarily intended for validating that a module implements given interfaces.
interfaces are implemented as modules which contain compliance test suites.
compliance of an implementation module to a set of interface modules
is validated by running the implementation module against the test suites
from the declared interface modules.
this is supplementary to static type-checking as it ensures
that an implementation module not only exposes the proper object and method signatures
but that it also provides the expected functionality
defined in the test suites of the interface modules.
although this goes beyond the current scope of this project,
interface modules are a good place to keep additional interface-related files,
such as typescript type declaration files .d.ts.
compliance has zero impact on production runtime:
like static type-checking, it runs during the development phase of a project.
see dependency injection below.
compliance currently relies on browserifycompliance supports test runners that play well with browserifyrequire('compliance/applicant')compliance will inject before running the suites.browserify is configured with compliance as acompliance/applicant are replaceddependencies in its package.json file.dependencies,compliance entry of package.json,json
"compliance": [ "an-interface-module", "another-interface-module", ... ]
`compliance validation
to validate compliance of an implementation module against declared interface modules,
run the compliance command from the shell or a test script of the implementation module.
* interface modules listed as compliance in the implementation module's package.json
but not listed in its dependencies are ignored
and will trigger a corresponding warning during compliance validation
* compliance will only be validated against the test suites from interface modules
listed as compliance in the implementation module's package.json
* the version of the interface module against which an implementation module
is validated is that listed in its dependenciesdependency injection
compliance allows to define dependencies as interfaces rather than implementations.
* library modules (i.e. modules meant to be called upon by client code) can list
interface module dependencies without specifying corresponding implementations.
* library modules can either expect the implementation dependencies to be
supplied by client code as arguments to its factory function,
or simply require the interface modules and
expect the corresponding implementation modules to be injected by client code.
* client code directly or indirectly depending on such library modules
can themselves define corresponding implementation module dependencies,
and either provide these as arguments to library module factories
or inject these appropriately into the library modules.
* browserify provides means of statically injecting an implementation module
in place of a require` for a corresponding interface module during bundling.