Accept configurations with Promise: undefined.
Fixes Karma and anything else that uses Env#configuration as a starting point for a Jasmine config.
This commit is contained in:
@@ -1081,7 +1081,10 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
config.hideDisabled = configuration.hideDisabled;
|
||||
}
|
||||
|
||||
if (configuration.hasOwnProperty('Promise')) {
|
||||
// Don't use hasOwnProperty to check for Promise existence because Promise
|
||||
// can be initialized to undefined, either explicitly or by using the
|
||||
// object returned from Env#configuration. In particular, Karma does this.
|
||||
if (configuration.Promise) {
|
||||
if (
|
||||
typeof configuration.Promise.resolve === 'function' &&
|
||||
typeof configuration.Promise.reject === 'function'
|
||||
|
||||
@@ -28,6 +28,10 @@ describe('Env', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('accepts its own current configureation', function() {
|
||||
env.configure(env.configuration());
|
||||
});
|
||||
|
||||
it('can configure specs to throw errors on expectation failures', function() {
|
||||
env.configure({ oneFailurePerSpec: true });
|
||||
|
||||
@@ -53,6 +57,11 @@ describe('Env', function() {
|
||||
});
|
||||
|
||||
describe('promise library', function() {
|
||||
it('can be configured without a custom library', function() {
|
||||
env.configure({});
|
||||
env.configure({ Promise: undefined });
|
||||
});
|
||||
|
||||
it('can be configured with a custom library', function() {
|
||||
var myLibrary = {
|
||||
resolve: jasmine.createSpy(),
|
||||
|
||||
@@ -175,7 +175,10 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
config.hideDisabled = configuration.hideDisabled;
|
||||
}
|
||||
|
||||
if (configuration.hasOwnProperty('Promise')) {
|
||||
// Don't use hasOwnProperty to check for Promise existence because Promise
|
||||
// can be initialized to undefined, either explicitly or by using the
|
||||
// object returned from Env#configuration. In particular, Karma does this.
|
||||
if (configuration.Promise) {
|
||||
if (
|
||||
typeof configuration.Promise.resolve === 'function' &&
|
||||
typeof configuration.Promise.reject === 'function'
|
||||
|
||||
Reference in New Issue
Block a user