Intern.js and google closure compiler

123 Views Asked by At

I would like to not explicitly set my dependency tree for every single module I want to test. For example, in my main App module, maybe I require a Base module which requires three other submodules. It's a pain trying to figure out the exact loading of every file in the dependency tree and I'd like to have the application figure out the dependencies itself.

I would also like to put all the common files I need to load for every test in one location.

So for example I would like to make the following into like a 'dependencies' file:

'intern!bdd',
'intern/chai!expect',
'intern/order!vendor/src/sinonjs-built/lib/sinon',
'intern/order!vendor/src/angular/angular',
'intern/order!vendor/src/angular-mocks/angular-mocks',
'intern/order!node_modules/closure-library/closure/goog/base'

So instead of adding those to the define:

define([
    'intern!bdd',
    'intern/chai!expect',
    'intern/order!vendor/src/sinonjs-built/lib/sinon',
    'intern/order!vendor/src/angular/angular',
    'intern/order!vendor/src/angular-mocks/angular-mocks'
], function (bdd, expect) {

I want to do:

   define([
        'dependencies'
    ], function (bdd, expect) {

And then adding in modules just based on their topmost parent so:

   define([
        'dependencies',
        'path/to/app/module'
    ], function (bdd, expect) {
       goog.require('App'); // gimme all the modules!

and App might look like:

goog.require('AppName.Base');
goog.require('AppName.BaseLayout');
goog.require('AppName.Login');
goog.provide('AppName.App');

angular.module( 'App', ['ngRoute', 'Base', 'Login', 'BaseLayout'])
// etc etc

And will automatically build the dependency tree for all those other modules so I don't have to add the paths to a million files in my test file.

Is anything like this remotely possible? Is this question clear?

0

There are 0 best solutions below