Skip to content

Commit

Permalink
fix(adapter.requirejs): do not configure baseUrl automatically
Browse files Browse the repository at this point in the history
I believe in most cases people need to use different baseUrl anyway. This means
people need to understand that Testacular serves files under `/base/*` (which is
the basePath from the testacular.conf.js) and under `/absolute/*` (files from
outside of the project's basePath). But it's less magic and less confusing.

See #291, #292 for more info.

Closes #291
  • Loading branch information
vojtajina committed Feb 16, 2013
1 parent 930685c commit 63f3f40
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
5 changes: 0 additions & 5 deletions adapter/require.wrapper
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@

%CONTENT%

// config base path
require.config({
baseUrl: '/base'
});

// make it async
testacular.loaded = function() {};

Expand Down
24 changes: 18 additions & 6 deletions test/e2e/requirejs/main.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
var allTestFiles = [];
var TEST_REGEXP = /test/;

Object.keys(window.__testacular__.files).forEach(function(file) {
if (TEST_REGEXP.test(file)) {
allTestFiles.push(file);
}
});

require.config({
// Testacular serves files under /base, which is the basePath from your config file
baseUrl: '/base',

// example of using shim, to load non AMD libraries (such as Backbone, jquery)
shim: {
'/base/shim.js': {
exports: 'global'
}
}
});
},

// dynamically load all test files
deps: allTestFiles,

// bootstrap - require, once loaded, kick off test run
require(['test', '/base/shim.js'], function(test, shim) {
window.__testacular__.start();
console.log('shim.js:', shim);
// we have to kick of jasmine, as it is asynchronous
callback: window.__testacular__.start
});
6 changes: 3 additions & 3 deletions test/e2e/requirejs/testacular.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ files = [

// all the sources, tests
{pattern: '*.js', included: false}


];


// list of files to exclude
exclude = [];
exclude = [
'testacular.conf.js'
];


// test results reporter to use
Expand Down

0 comments on commit 63f3f40

Please sign in to comment.