All right, I got the Noble Modules unit tests running against BravoJS:
https://github.com/NobleJS/Noble-Modules/tree/testing-bravojs
The failures generally seem to fall into a few categories, ordered
from least severe to most:
1) Minor/easy-to-fix spec conformance issues, like
module.id should be
undefined in the EME, require.uri should exist, require.memoize should
throw an error when a module is already memoized.
2) Labels don't seem to work; for a dependency array of [{ mathLabel:
"demos/math" }], require("mathLabel") made BravoJS go searching for
mathLabel.js.
3) Relative paths do not seem to work: BravoJS interprets them all
relative to the main module. E.g. if demos/area has "./math" in its
dependency array, BravoJS goes looking for "<mainModuleDir>/math.js"
instead of "<mainModuleDir>/demos/math.js".
4) Issues with the robustness of module provision and its interaction
with memoization. Although it is hard to tell which of these fail
because of the use of relative paths, and which fail because of issues
with provision, it seems scenarios like a diamond dependency tree or
providing the same module twice can trip up BravoJS. And the
discussion at
http://groups.google.com/group/commonjs/browse_thread/thread/53057f785c6f5ceb
about provision interaction with memoization leads to several test
cases failing.
5) Major differences in our interpretation of the responsibility of
load vs. provide. Essentially, the spec does not indicate that
module.load, or the module.declare call that it results in, should
memoize the module in question. It seems strictly to be intended for
loading the <script> tag and executing the resulting module.declare.
This causes all of the provider plug-in tests to fail, as well as the
one explicitly testing that module.load does not memoize. I think that
the spec should stay as-is in this regard, and perhaps call out the
necessity of not memoizing the module, because---as evidenced by the
plug-ins included with Noble Modules---doing so makes plug-in writing
MUCH easier, as alternate script-loading can be done simply by
overriding module.load to fulfill the specified duties, and leaving
module.declare alone. Compare:
https://github.com/NobleJS/Noble-Modules/blob/master/naked.js
http://code.google.com/p/bravojs/source/browse/plugins/jquery-loader/jquery-loader.js
--
As another thing I noticed, initially my tests were failing because
require.memoize and require.isMemoized expect canonical module IDs,
instead of module identifiers. Is there a reason for this, especially
in the case of isMemoized? Since they have access to the local
context, they could just as easily accept identifiers, allowing
require.isMemoized("x") instead of
require.isMemoized(
require.id("x")). And it's weird to do
require.memoize("x", ...) but then get a failure when you immediately
do require("x"); there will end up being a lot of boilerplate
require.memoize(
require.id("jQuery"), [], function () { return
jQuery; }) in the wild, which could be reduced to
require.memoize("jQuery", [], function () { return jQuery; }).
Hope this is helpful!