mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
QUnit: Fix tests on Node v6.
This commit is contained in:
parent
1c06079f9c
commit
cb0810d18a
1 changed files with 8 additions and 5 deletions
|
@ -12,14 +12,14 @@
|
||||||
|
|
||||||
var isNode = typeof global === 'object',
|
var isNode = typeof global === 'object',
|
||||||
isPhantom = typeof window === 'object' && !!window.callPhantom,
|
isPhantom = typeof window === 'object' && !!window.callPhantom,
|
||||||
root;
|
scope;
|
||||||
|
|
||||||
if (isNode) {
|
if (isNode) {
|
||||||
root = global;
|
scope = global;
|
||||||
// Resemble.js needs the Image constructor global.
|
// Resemble.js needs the Image constructor global.
|
||||||
global.Image = paper.window.Image;
|
global.Image = paper.window.Image;
|
||||||
} else {
|
} else {
|
||||||
root = window;
|
scope = window;
|
||||||
// This is only required when running in the browser:
|
// This is only required when running in the browser:
|
||||||
// Until window.history.pushState() works when running locally, we need to
|
// Until window.history.pushState() works when running locally, we need to
|
||||||
// trick qunit into thinking that the feature is not present. This appears
|
// trick qunit into thinking that the feature is not present. This appears
|
||||||
|
@ -35,13 +35,16 @@ if (isNode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// The unit-tests expect the paper classes to be global.
|
// The unit-tests expect the paper classes to be global.
|
||||||
paper.install(root);
|
paper.install(scope);
|
||||||
|
|
||||||
// Override console.error, so that we can catch errors that are only logged to
|
// Override console.error, so that we can catch errors that are only logged to
|
||||||
// the console.
|
// the console.
|
||||||
var errorHandler = console.error;
|
var errorHandler = console.error;
|
||||||
console.error = function() {
|
console.error = function() {
|
||||||
QUnit.pushFailure([].join.call(arguments, ' '), QUnit.config.current.stack);
|
var current = QUnit.config.current;
|
||||||
|
if (current) {
|
||||||
|
QUnit.pushFailure([].join.call(arguments, ' '), current.stack);
|
||||||
|
}
|
||||||
errorHandler.apply(this, arguments);
|
errorHandler.apply(this, arguments);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue