Removed support for Internet Explorer

This commit is contained in:
Steve Gravrock
2021-07-23 19:48:53 -07:00
parent 623eecdcec
commit fe0a83ba87
51 changed files with 137 additions and 707 deletions

View File

@@ -1,8 +1,5 @@
/* eslint-disable compat/compat */
describe('toBePending', function() {
it('passes if the actual promise is pending', function() {
jasmine.getEnv().requirePromises();
var matchersUtil = new jasmineUnderTest.MatchersUtil(),
matcher = jasmineUnderTest.asyncMatchers.toBePending(matchersUtil),
actual = new Promise(function() {});
@@ -13,8 +10,6 @@ describe('toBePending', function() {
});
it('fails if the actual promise is resolved', function() {
jasmine.getEnv().requirePromises();
var matchersUtil = new jasmineUnderTest.MatchersUtil(),
matcher = jasmineUnderTest.asyncMatchers.toBePending(matchersUtil),
actual = Promise.resolve();
@@ -25,8 +20,6 @@ describe('toBePending', function() {
});
it('fails if the actual promise is rejected', function() {
jasmine.getEnv().requirePromises();
var matchersUtil = new jasmineUnderTest.MatchersUtil(),
matcher = jasmineUnderTest.asyncMatchers.toBePending(matchersUtil),
actual = Promise.reject(new Error('promise was rejected'));

View File

@@ -1,8 +1,5 @@
/* eslint-disable compat/compat */
describe('toBeRejected', function() {
it('passes if the actual is rejected', function() {
jasmine.getEnv().requirePromises();
var matchersUtil = new jasmineUnderTest.MatchersUtil(),
matcher = jasmineUnderTest.asyncMatchers.toBeRejected(matchersUtil),
actual = Promise.reject('AsyncExpectationSpec rejection');
@@ -13,8 +10,6 @@ describe('toBeRejected', function() {
});
it('fails if the actual is resolved', function() {
jasmine.getEnv().requirePromises();
var matchersUtil = new jasmineUnderTest.MatchersUtil(),
matcher = jasmineUnderTest.asyncMatchers.toBeRejected(matchersUtil),
actual = Promise.resolve();

View File

@@ -1,8 +1,5 @@
/* eslint-disable compat/compat */
describe('#toBeRejectedWithError', function() {
it('passes when Error type matches', function() {
jasmine.getEnv().requirePromises();
var matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
}),
@@ -23,8 +20,6 @@ describe('#toBeRejectedWithError', function() {
});
it('passes when Error type and message matches', function() {
jasmine.getEnv().requirePromises();
var matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
}),
@@ -45,8 +40,6 @@ describe('#toBeRejectedWithError', function() {
});
it('passes when Error matches and is exactly Error', function() {
jasmine.getEnv().requirePromises();
var matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
}),
@@ -67,8 +60,6 @@ describe('#toBeRejectedWithError', function() {
});
it('passes when Error message matches a string', function() {
jasmine.getEnv().requirePromises();
var matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
}),
@@ -89,8 +80,6 @@ describe('#toBeRejectedWithError', function() {
});
it('passes when Error message matches a RegExp', function() {
jasmine.getEnv().requirePromises();
var matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
}),
@@ -111,8 +100,6 @@ describe('#toBeRejectedWithError', function() {
});
it('passes when Error message is empty', function() {
jasmine.getEnv().requirePromises();
var matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
}),
@@ -133,8 +120,6 @@ describe('#toBeRejectedWithError', function() {
});
it('passes when no arguments', function() {
jasmine.getEnv().requirePromises();
var matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
}),
@@ -155,8 +140,6 @@ describe('#toBeRejectedWithError', function() {
});
it('fails when resolved', function() {
jasmine.getEnv().requirePromises();
var matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
}),
@@ -176,8 +159,6 @@ describe('#toBeRejectedWithError', function() {
});
it('fails when rejected with non Error type', function() {
jasmine.getEnv().requirePromises();
var matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
}),
@@ -198,8 +179,6 @@ describe('#toBeRejectedWithError', function() {
});
it('fails when Error type mismatches', function() {
jasmine.getEnv().requirePromises();
var matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
}),
@@ -220,8 +199,6 @@ describe('#toBeRejectedWithError', function() {
});
it('fails when Error message mismatches', function() {
jasmine.getEnv().requirePromises();
var matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
}),

View File

@@ -1,8 +1,5 @@
/* eslint-disable compat/compat */
describe('#toBeRejectedWith', function() {
it('should return true if the promise is rejected with the expected value', function() {
jasmine.getEnv().requirePromises();
var matchersUtil = new jasmineUnderTest.MatchersUtil(),
matcher = jasmineUnderTest.asyncMatchers.toBeRejectedWith(matchersUtil),
actual = Promise.reject({ error: 'PEBCAK' });
@@ -13,8 +10,6 @@ describe('#toBeRejectedWith', function() {
});
it('should fail if the promise resolves', function() {
jasmine.getEnv().requirePromises();
var matchersUtil = new jasmineUnderTest.MatchersUtil(),
matcher = jasmineUnderTest.asyncMatchers.toBeRejectedWith(matchersUtil),
actual = Promise.resolve();
@@ -25,8 +20,6 @@ describe('#toBeRejectedWith', function() {
});
it('should fail if the promise is rejected with a different value', function() {
jasmine.getEnv().requirePromises();
var matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
}),
@@ -45,8 +38,6 @@ describe('#toBeRejectedWith', function() {
});
it('should build its error correctly when negated', function() {
jasmine.getEnv().requirePromises();
var matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
}),
@@ -64,8 +55,6 @@ describe('#toBeRejectedWith', function() {
});
it('should support custom equality testers', function() {
jasmine.getEnv().requirePromises();
var customEqualityTesters = [
function() {
return true;

View File

@@ -1,8 +1,5 @@
/* eslint-disable compat/compat */
describe('toBeResolved', function() {
it('passes if the actual is resolved', function() {
jasmine.getEnv().requirePromises();
var matchersUtil = new jasmineUnderTest.MatchersUtil(),
matcher = jasmineUnderTest.asyncMatchers.toBeResolved(matchersUtil),
actual = Promise.resolve();
@@ -13,8 +10,6 @@ describe('toBeResolved', function() {
});
it('fails if the actual is rejected', function() {
jasmine.getEnv().requirePromises();
var matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter([])
}),

View File

@@ -1,8 +1,5 @@
/* eslint-disable compat/compat */
describe('#toBeResolvedTo', function() {
it('passes if the promise is resolved to the expected value', function() {
jasmine.getEnv().requirePromises();
var matchersUtil = new jasmineUnderTest.MatchersUtil(),
matcher = jasmineUnderTest.asyncMatchers.toBeResolvedTo(matchersUtil),
actual = Promise.resolve({ foo: 42 });
@@ -13,8 +10,6 @@ describe('#toBeResolvedTo', function() {
});
it('fails if the promise is rejected', function() {
jasmine.getEnv().requirePromises();
var matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
}),
@@ -34,8 +29,6 @@ describe('#toBeResolvedTo', function() {
});
it('fails if the promise is resolved to a different value', function() {
jasmine.getEnv().requirePromises();
var matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
}),
@@ -54,8 +47,6 @@ describe('#toBeResolvedTo', function() {
});
it('builds its message correctly when negated', function() {
jasmine.getEnv().requirePromises();
var matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
}),
@@ -73,8 +64,6 @@ describe('#toBeResolvedTo', function() {
});
it('supports custom equality testers', function() {
jasmine.getEnv().requirePromises();
var customEqualityTesters = [
function() {
return true;

View File

@@ -232,8 +232,8 @@ describe('matchersUtil', function() {
return;
}
var p1 = new Promise(function() {}), // eslint-disable-line compat/compat
p2 = new Promise(function() {}), // eslint-disable-line compat/compat
var p1 = new Promise(function() {}),
p2 = new Promise(function() {}),
matchersUtil = new jasmineUnderTest.MatchersUtil();
expect(matchersUtil.equals(p1, p1)).toBe(true);
@@ -655,48 +655,35 @@ describe('matchersUtil', function() {
});
it('passes when comparing two identical URLs', function() {
jasmine.getEnv().requireUrls();
var matchersUtil = new jasmineUnderTest.MatchersUtil();
expect(
matchersUtil.equals(
// eslint-disable-next-line compat/compat
new URL('http://localhost/1'),
// eslint-disable-next-line compat/compat
new URL('http://localhost/1')
)
).toBe(true);
});
it('fails when comparing two different URLs', function() {
jasmine.getEnv().requireUrls();
var matchersUtil = new jasmineUnderTest.MatchersUtil(),
// eslint-disable-next-line compat/compat
url1 = new URL('http://localhost/1');
// eslint-disable-next-line compat/compat
expect(matchersUtil.equals(url1, new URL('http://localhost/2'))).toBe(
false
);
// eslint-disable-next-line compat/compat
expect(matchersUtil.equals(url1, new URL('http://localhost/1?foo'))).toBe(
false
);
// eslint-disable-next-line compat/compat
expect(matchersUtil.equals(url1, new URL('http://localhost/1#foo'))).toBe(
false
);
// eslint-disable-next-line compat/compat
expect(matchersUtil.equals(url1, new URL('https://localhost/1'))).toBe(
false
);
expect(
// eslint-disable-next-line compat/compat
matchersUtil.equals(url1, new URL('http://localhost:8080/1'))
).toBe(false);
// eslint-disable-next-line compat/compat
expect(matchersUtil.equals(url1, new URL('http://example.com/1'))).toBe(
false
);
@@ -721,15 +708,12 @@ describe('matchersUtil', function() {
describe('Typed arrays', function() {
it('fails for typed arrays of same length and contents but different types', function() {
var matchersUtil = new jasmineUnderTest.MatchersUtil();
// eslint-disable-next-line compat/compat
var a1 = new Int8Array(1);
// eslint-disable-next-line compat/compat
var a2 = new Uint8Array(1);
a1[0] = a2[0] = 0;
expect(matchersUtil.equals(a1, a2)).toBe(false);
});
// eslint-disable-next-line compat/compat
[
'Int8Array',
'Uint8Array',
@@ -741,20 +725,11 @@ describe('matchersUtil', function() {
'Float32Array',
'Float64Array'
].forEach(function(typeName) {
function requireType() {
var TypedArrayCtor = jasmine.getGlobal()[typeName];
if (!TypedArrayCtor) {
pending('Browser does not support ' + typeName);
}
return TypedArrayCtor;
}
var TypedArrayCtor = jasmine.getGlobal()[typeName];
it(
'passes for ' + typeName + 's with same length and content',
function() {
var TypedArrayCtor = requireType();
var matchersUtil = new jasmineUnderTest.MatchersUtil();
var a1 = new TypedArrayCtor(2);
var a2 = new TypedArrayCtor(2);
@@ -765,7 +740,6 @@ describe('matchersUtil', function() {
);
it('fails for ' + typeName + 's with different length', function() {
var TypedArrayCtor = requireType();
var matchersUtil = new jasmineUnderTest.MatchersUtil();
var a1 = new TypedArrayCtor(2);
var a2 = new TypedArrayCtor(1);
@@ -776,7 +750,6 @@ describe('matchersUtil', function() {
it(
'fails for ' + typeName + 's with same length but different content',
function() {
var TypedArrayCtor = requireType();
var matchersUtil = new jasmineUnderTest.MatchersUtil();
var a1 = new TypedArrayCtor(1);
var a2 = new TypedArrayCtor(1);
@@ -787,7 +760,6 @@ describe('matchersUtil', function() {
);
it('checks nonstandard properties of ' + typeName, function() {
var TypedArrayCtor = requireType();
var matchersUtil = new jasmineUnderTest.MatchersUtil();
var a1 = new TypedArrayCtor(1);
var a2 = new TypedArrayCtor(1);
@@ -797,7 +769,6 @@ describe('matchersUtil', function() {
});
it('works with custom equality testers with ' + typeName, function() {
var TypedArrayCtor = requireType();
var a1 = new TypedArrayCtor(1);
var a2 = new TypedArrayCtor(1);
var matchersUtil = new jasmineUnderTest.MatchersUtil({

View File

@@ -104,8 +104,6 @@ describe('toBeInstanceOf', function() {
});
it('passes for an async function', function() {
jasmine.getEnv().requireAsyncAwait();
var fn = eval("(async function fn() { return 'foo'; })");
var matcher = jasmineUnderTest.matchers.toBeInstanceOf();

View File

@@ -620,9 +620,7 @@ describe('toEqual', function() {
});
it('does not report mismatches when comparing Maps with the same symbol keys', function() {
jasmine.getEnv().requireFunctioningSymbols();
var key = Symbol(); // eslint-disable-line compat/compat
var key = Symbol();
var actual = new Map();
actual.set(key, 1);
var expected = new Map();
@@ -632,12 +630,10 @@ describe('toEqual', function() {
});
it('reports mismatches between Maps with different symbol keys', function() {
jasmine.getEnv().requireFunctioningSymbols();
var actual = new Map();
actual.set(Symbol(), 1); // eslint-disable-line compat/compat
actual.set(Symbol(), 1);
var expected = new Map();
expected.set(Symbol(), 1); // eslint-disable-line compat/compat
expected.set(Symbol(), 1);
var message =
'Expected Map( [ Symbol(), 1 ] ) to equal Map( [ Symbol(), 1 ] ).';
@@ -645,10 +641,8 @@ describe('toEqual', function() {
});
it('does not report mismatches when comparing Map symbol key to jasmine.anything()', function() {
jasmine.getEnv().requireFunctioningSymbols();
var actual = new Map();
actual.set(Symbol(), 1); // eslint-disable-line compat/compat
actual.set(Symbol(), 1);
var expected = new Map();
expected.set(jasmineUnderTest.anything(), 1);

View File

@@ -102,16 +102,14 @@ describe('toHaveSize', function() {
});
it('throws an error for WeakSet', function() {
jasmine.getEnv().requireWeakSets();
var matcher = jasmineUnderTest.matchers.toHaveSize();
expect(function() {
matcher.compare(new WeakSet(), 2); // eslint-disable-line compat/compat
matcher.compare(new WeakSet(), 2);
}).toThrowError('Cannot get size of [object WeakSet].');
});
it('throws an error for WeakMap', function() {
jasmine.getEnv().requireWeakMaps();
var matcher = jasmineUnderTest.matchers.toHaveSize();
expect(function() {