Pend environment-specific specs rather than passing

This commit is contained in:
Steve Gravrock
2025-08-30 12:58:04 -07:00
parent 3bcbc2e3af
commit 09ce3a30b6
4 changed files with 13 additions and 29 deletions

View File

@@ -2,8 +2,7 @@ describe('base helpers', function() {
describe('isError_', function() {
it('correctly handles WebSocket events', function(done) {
if (typeof jasmine.getGlobal().WebSocket === 'undefined') {
done();
return;
pending('Environment does not provide WebSocket');
}
const obj = (function() {

View File

@@ -79,7 +79,7 @@ describe('buildExpectationResult', function() {
it('handles nodejs assertions', function() {
if (typeof require === 'undefined') {
return;
pending('This test only runs in Node');
}
const assert = require('assert');
const value = 8421;

View File

@@ -250,10 +250,6 @@ describe('matchersUtil', function() {
});
it('passes for equivalent Promises (GitHub issue #1314)', function() {
if (typeof Promise === 'undefined') {
return;
}
const p1 = new Promise(function() {}),
p2 = new Promise(function() {}),
matchersUtil = new jasmineUnderTest.MatchersUtil();
@@ -263,14 +259,13 @@ describe('matchersUtil', function() {
});
describe('when running in a browser', function() {
function isNotRunningInBrowser() {
return typeof document === 'undefined';
}
beforeEach(function() {
if (typeof document === 'undefined') {
pending('This test only runs in browsers');
}
});
it('passes for equivalent DOM nodes', function() {
if (isNotRunningInBrowser()) {
return;
}
const a = document.createElement('div');
const matchersUtil = new jasmineUnderTest.MatchersUtil();
@@ -285,9 +280,6 @@ describe('matchersUtil', function() {
});
it('passes for equivalent objects from different frames', function() {
if (isNotRunningInBrowser()) {
return;
}
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const iframe = document.createElement('iframe');
document.body.appendChild(iframe);
@@ -299,9 +291,6 @@ describe('matchersUtil', function() {
});
it('fails for DOM nodes with different attributes or child nodes', function() {
if (isNotRunningInBrowser()) {
return;
}
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const a = document.createElement('div');
a.setAttribute('test-attr', 'attr-value');
@@ -325,14 +314,13 @@ describe('matchersUtil', function() {
});
describe('when running in Node', function() {
function isNotRunningInNode() {
return typeof require !== 'function';
}
beforeEach(function() {
if (typeof require !== 'function') {
pending('This test only runs in Node');
}
});
it('passes for equivalent objects from different vm contexts', function() {
if (isNotRunningInNode()) {
return;
}
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const vm = require('vm');
const sandbox = {
@@ -344,9 +332,6 @@ describe('matchersUtil', function() {
});
it('passes for equivalent arrays from different vm contexts', function() {
if (isNotRunningInNode()) {
return;
}
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const vm = require('vm');
const sandbox = {

View File

@@ -82,7 +82,7 @@ describe('toThrowError', function() {
it('passes if thrown is an instanceof Error regardless of global that contains its constructor', function() {
if (isNotRunningInBrowser()) {
return;
pending('This test only runs in browsers.');
}
const matcher = jasmineUnderTest.matchers.toThrowError();