nodejs test completion

This commit is contained in:
guybedford 2014-05-05 15:50:52 -07:00
parent 656bcffbfd
commit 37e37c302f
8 changed files with 105 additions and 73 deletions

View File

@ -82,7 +82,7 @@ function core(loader) {
// override locate to allow baseURL to be document-relative
var baseURI;
if (typeof window == 'undefined') {
baseURI = __dirname + '/';
baseURI = process.cwd() + '/';
}
else {
baseURI = document.baseURI;
@ -99,7 +99,6 @@ function core(loader) {
if (normalizedBaseURL.substr(normalizedBaseURL.length - 1, 1) != '/')
normalizedBaseURL += '/';
this.baseURL = normalizedBaseURL;
}
@ -288,7 +287,7 @@ function register(loader) {
lastRegister = {
deps: deps,
declare: declare,
declarative: true
declarative: true,
};
if (name)
@ -454,6 +453,15 @@ function register(loader) {
}
}
// lookup the module name if it is in the registry
var moduleName;
for (var d in loader.defined) {
if (loader.defined[d] != entry)
continue;
moduleName = d;
break;
}
// now execute
try {
entry.evaluated = true;
@ -463,7 +471,7 @@ function register(loader) {
continue;
return getModule(entry.normalizedDeps[i], loader);
}
}, entry.module, name);
}, entry.module, moduleName);
}
catch(e) {
throw e;
@ -1024,30 +1032,33 @@ scriptLoader(System);
map(System);
bundles(System);
versions(System);
System.baseURL = __$curScript.getAttribute('data-baseurl') || System.baseURL;
if (__$curScript) {
System.baseURL = __$curScript.getAttribute('data-baseurl') || System.baseURL;
var configPath = __$curScript.getAttribute('data-config');
if (configPath === '')
configPath = System.baseURL + 'config.json';
var configPath = __$curScript.getAttribute('data-config');
if (configPath === '')
configPath = System.baseURL + 'config.json';
var main = __$curScript.getAttribute('data-main');
var main = __$curScript.getAttribute('data-main');
if (!System.paths['@traceur'])
System.paths['@traceur'] = typeof __$curScript != 'undefined' && __$curScript.getAttribute('data-traceur-src');
if (!System.paths['@traceur'])
System.paths['@traceur'] = typeof __$curScript != 'undefined' && __$curScript.getAttribute('data-traceur-src');
(!configPath ? Promise.resolve() :
Promise.resolve(System.fetch.call(System, { address: configPath, metadata: {} }))
.then(JSON.parse)
.then(System.config)
).then(function() {
if (main)
return System['import'](main);
})
['catch'](function(e) {
setTimeout(function() {
throw e;
(!configPath ? Promise.resolve() :
Promise.resolve(System.fetch.call(System, { address: configPath, metadata: {} }))
.then(JSON.parse)
.then(System.config)
).then(function() {
if (main)
return System['import'](main);
})
});
['catch'](function(e) {
setTimeout(function() {
throw e;
})
});
}
};

File diff suppressed because one or more lines are too long

57
dist/system.js vendored
View File

@ -82,7 +82,7 @@ function core(loader) {
// override locate to allow baseURL to be document-relative
var baseURI;
if (typeof window == 'undefined') {
baseURI = __dirname + '/';
baseURI = process.cwd() + '/';
}
else {
baseURI = document.baseURI;
@ -99,7 +99,6 @@ function core(loader) {
if (normalizedBaseURL.substr(normalizedBaseURL.length - 1, 1) != '/')
normalizedBaseURL += '/';
this.baseURL = normalizedBaseURL;
}
@ -381,7 +380,7 @@ function register(loader) {
lastRegister = {
deps: deps,
declare: declare,
declarative: true
declarative: true,
};
if (name)
@ -547,6 +546,15 @@ function register(loader) {
}
}
// lookup the module name if it is in the registry
var moduleName;
for (var d in loader.defined) {
if (loader.defined[d] != entry)
continue;
moduleName = d;
break;
}
// now execute
try {
entry.evaluated = true;
@ -556,7 +564,7 @@ function register(loader) {
continue;
return getModule(entry.normalizedDeps[i], loader);
}
}, entry.module, name);
}, entry.module, moduleName);
}
catch(e) {
throw e;
@ -1585,30 +1593,33 @@ map(System);
plugins(System);
bundles(System);
versions(System);
System.baseURL = __$curScript.getAttribute('data-baseurl') || System.baseURL;
if (__$curScript) {
System.baseURL = __$curScript.getAttribute('data-baseurl') || System.baseURL;
var configPath = __$curScript.getAttribute('data-config');
if (configPath === '')
configPath = System.baseURL + 'config.json';
var configPath = __$curScript.getAttribute('data-config');
if (configPath === '')
configPath = System.baseURL + 'config.json';
var main = __$curScript.getAttribute('data-main');
var main = __$curScript.getAttribute('data-main');
if (!System.paths['@traceur'])
System.paths['@traceur'] = typeof __$curScript != 'undefined' && __$curScript.getAttribute('data-traceur-src');
if (!System.paths['@traceur'])
System.paths['@traceur'] = typeof __$curScript != 'undefined' && __$curScript.getAttribute('data-traceur-src');
(!configPath ? Promise.resolve() :
Promise.resolve(System.fetch.call(System, { address: configPath, metadata: {} }))
.then(JSON.parse)
.then(System.config)
).then(function() {
if (main)
return System['import'](main);
})
['catch'](function(e) {
setTimeout(function() {
throw e;
(!configPath ? Promise.resolve() :
Promise.resolve(System.fetch.call(System, { address: configPath, metadata: {} }))
.then(JSON.parse)
.then(System.config)
).then(function() {
if (main)
return System['import'](main);
})
});
['catch'](function(e) {
setTimeout(function() {
throw e;
})
});
}
};

2
dist/system.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -64,7 +64,7 @@ function core(loader) {
// override locate to allow baseURL to be document-relative
var baseURI;
if (typeof window == 'undefined') {
baseURI = __dirname + '/';
baseURI = process.cwd() + '/';
}
else {
baseURI = document.baseURI;
@ -81,7 +81,6 @@ function core(loader) {
if (normalizedBaseURL.substr(normalizedBaseURL.length - 1, 1) != '/')
normalizedBaseURL += '/';
this.baseURL = normalizedBaseURL;
}

View File

@ -55,7 +55,7 @@ function register(loader) {
lastRegister = {
deps: deps,
declare: declare,
declarative: true
declarative: true,
};
if (name)
@ -221,6 +221,15 @@ function register(loader) {
}
}
// lookup the module name if it is in the registry
var moduleName;
for (var d in loader.defined) {
if (loader.defined[d] != entry)
continue;
moduleName = d;
break;
}
// now execute
try {
entry.evaluated = true;
@ -230,7 +239,7 @@ function register(loader) {
continue;
return getModule(entry.normalizedDeps[i], loader);
}
}, entry.module, name);
}, entry.module, moduleName);
}
catch(e) {
throw e;

View File

@ -1,27 +1,30 @@
System.baseURL = __$curScript.getAttribute('data-baseurl') || System.baseURL;
if (__$curScript) {
System.baseURL = __$curScript.getAttribute('data-baseurl') || System.baseURL;
var configPath = __$curScript.getAttribute('data-config');
if (configPath === '')
configPath = System.baseURL + 'config.json';
var configPath = __$curScript.getAttribute('data-config');
if (configPath === '')
configPath = System.baseURL + 'config.json';
var main = __$curScript.getAttribute('data-main');
var main = __$curScript.getAttribute('data-main');
if (!System.paths['@traceur'])
System.paths['@traceur'] = typeof __$curScript != 'undefined' && __$curScript.getAttribute('data-traceur-src');
if (!System.paths['@traceur'])
System.paths['@traceur'] = typeof __$curScript != 'undefined' && __$curScript.getAttribute('data-traceur-src');
(!configPath ? Promise.resolve() :
Promise.resolve(System.fetch.call(System, { address: configPath, metadata: {} }))
.then(JSON.parse)
.then(System.config)
).then(function() {
if (main)
return System['import'](main);
})
['catch'](function(e) {
setTimeout(function() {
throw e;
(!configPath ? Promise.resolve() :
Promise.resolve(System.fetch.call(System, { address: configPath, metadata: {} }))
.then(JSON.parse)
.then(System.config)
).then(function() {
if (main)
return System['import'](main);
})
});
['catch'](function(e) {
setTimeout(function() {
throw e;
})
});
}
};

View File

@ -5,8 +5,7 @@ QUnit.config.testTimeout = 2000;
QUnit.module("SystemJS");
if (typeof window == 'undefined') {
var path = require('path');
System.baseURL = path.resolve(__dirname, 'test');
System.baseURL = 'test';
}
function err(e) {