← Back to team overview

launchpad-dev team mailing list archive

Re: Importing JavaScript test modules (no need to set up the Runner)

 

On 2 August 2011 14:58, Francis J. Lacoste
<francis.lacoste@xxxxxxxxxxxxx> wrote:
[...]
> But does this mean that writing the tests in a module will be bundled in
> the launchpad.js file? Are we shipping useless test code to our users?

Thankfully no; the selection of files to pack into launchpad.js is
defined in the top-level Makefile:

    define JS_LP_PATHS
    lib -path 'lib/lp/*/javascript/*' \
--> ! -path '*/tests/*' ! -path '*/testing/*' \
    ! -path 'lib/lp/services/*'
    endef

    JS_YUI := $(shell utilities/yui-deps.py $(JS_BUILD:raw=))
    JS_OTHER := $(wildcard lib/canonical/launchpad/javascript/*/*.js)
    JS_LP := $(shell find $(JS_LP_PATHS) -name '*.js' ! -name '.*.js')
    JS_ALL := $(JS_YUI) $(JS_OTHER) $(JS_LP)

It's interesting, the test_*.html files that are used to run tests
don't use launchpad.js; they explicitly reference all the files they
need. They do use a pre-assembled yui.js though.

Explicitly loading all the files needed makes it easier to get a
correct requires setting for a module. However, using yui.js means we
might use a YUI3 module that we don't ship in launchpad.js (though
we'd probably spot that during development, and QA / acceptance
testing should definitely spot that kind of problem).

Perhaps tests ought to use launchpad.js.


Follow ups

References