Move private APIs to private namespace

Fixes #2078
This commit is contained in:
Steve Gravrock
2025-09-27 13:21:09 -07:00
parent fbec066837
commit 168ff0a751
183 changed files with 2627 additions and 2459 deletions

View File

@@ -1,7 +1,7 @@
describe('Asymmetric equality testers (Integration)', function() {
function verifyPasses(expectations) {
it('passes', async function() {
const env = new jasmineUnderTest.Env();
const env = new privateUnderTest.Env();
env.it('a spec', function() {
expectations(env);
});
@@ -30,7 +30,7 @@ describe('Asymmetric equality testers (Integration)', function() {
function verifyFails(expectations) {
it('fails', async function() {
const env = new jasmineUnderTest.Env();
const env = new privateUnderTest.Env();
env.it('a spec', function() {
expectations(env);
});

View File

@@ -2,7 +2,7 @@ describe('Custom Async Matchers (Integration)', function() {
let env;
beforeEach(function() {
env = new jasmineUnderTest.Env();
env = new privateUnderTest.Env();
env.configure({ random: false });
});
@@ -107,7 +107,7 @@ describe('Custom Async Matchers (Integration)', function() {
const specExpectations = function() {
expect(matcherFactorySpy).toHaveBeenCalledWith(
jasmine.any(jasmineUnderTest.MatchersUtil)
jasmine.any(privateUnderTest.MatchersUtil)
);
};

View File

@@ -2,7 +2,7 @@ describe('Custom Matchers (Integration)', function() {
let env;
beforeEach(function() {
env = new jasmineUnderTest.Env();
env = new privateUnderTest.Env();
env.configure({ random: false });
});
@@ -230,7 +230,7 @@ describe('Custom Matchers (Integration)', function() {
await env.execute();
expect(matcherFactorySpy).toHaveBeenCalledWith(
jasmine.any(jasmineUnderTest.MatchersUtil)
jasmine.any(privateUnderTest.MatchersUtil)
);
});

View File

@@ -2,7 +2,7 @@ describe('Custom object formatters', function() {
let env;
beforeEach(function() {
env = new jasmineUnderTest.Env();
env = new privateUnderTest.Env();
env.configure({ random: false });
});

View File

@@ -2,7 +2,7 @@ describe('Custom Spy Strategies (Integration)', function() {
let env;
beforeEach(function() {
env = new jasmineUnderTest.Env();
env = new privateUnderTest.Env();
env.configure({ random: false });
});

View File

@@ -2,7 +2,7 @@ describe('Default Spy Strategy (Integration)', function() {
let env;
beforeEach(function() {
env = new jasmineUnderTest.Env();
env = new privateUnderTest.Env();
env.configure({ random: false });
});

View File

@@ -3,7 +3,7 @@ describe('Deprecation (integration)', function() {
let env;
beforeEach(function() {
env = new jasmineUnderTest.Env();
env = new privateUnderTest.Env();
});
afterEach(function() {

View File

@@ -4,7 +4,7 @@ describe('Env integration', function() {
beforeEach(function() {
specHelpers.registerIntegrationMatchers();
env = new jasmineUnderTest.Env();
env = new privateUnderTest.Env();
});
afterEach(function() {
@@ -199,7 +199,7 @@ describe('Env integration', function() {
} else {
secondSpecContext = this;
}
expect(this).toEqual(new jasmineUnderTest.UserContext());
expect(this).toEqual(new privateUnderTest.UserContext());
});
env.it('sync spec', function() {
@@ -229,7 +229,7 @@ describe('Env integration', function() {
env.beforeEach(function() {
specContext = this;
expect(this).toEqual(new jasmineUnderTest.UserContext());
expect(this).toEqual(new privateUnderTest.UserContext());
});
env.it('sync spec', function(underTestCallback) {
@@ -1110,7 +1110,7 @@ describe('Env integration', function() {
);
env.cleanup_();
env = new jasmineUnderTest.Env({
env = new privateUnderTest.Env({
global: {
setTimeout: globalSetTimeout,
clearTimeout: clearTimeout,
@@ -1175,7 +1175,7 @@ describe('Env integration', function() {
env.cleanup_();
// explicitly pass in timing functions so we can make sure that clear stack always works
// no matter how long the suite in the spec is
env = new jasmineUnderTest.Env({
env = new privateUnderTest.Env({
global: {
setTimeout: function(cb, t) {
const stack = new Error().stack;
@@ -1271,7 +1271,9 @@ describe('Env integration', function() {
await env.execute();
expect(reporter.specDone).toHaveBeenCalledTimes(1);
const event = reporter.specDone.calls.argsFor(0)[0];
jasmine.debugLog('Spec result: ' + jasmine.basicPrettyPrinter_(event));
jasmine.debugLog(
'Spec result: ' + jasmine.private.basicPrettyPrinter(event)
);
expect(event).toEqual(jasmine.objectContaining({ status: 'passed' }));
jasmine.clock().tick(1);
@@ -2335,7 +2337,7 @@ describe('Env integration', function() {
});
it('throws an exception if you try to getSpecProperty outside of a spec', async function() {
const env = new jasmineUnderTest.Env();
const env = new privateUnderTest.Env();
let exception;
env.describe('a suite', function() {
@@ -2356,7 +2358,7 @@ describe('Env integration', function() {
});
it('reports test properties on specs', async function() {
const env = new jasmineUnderTest.Env(),
const env = new privateUnderTest.Env(),
reporter = jasmine.createSpyObj('reporter', ['suiteDone', 'specDone']);
reporter.specDone.and.callFake(function(e) {
@@ -2389,7 +2391,7 @@ describe('Env integration', function() {
});
it('throws an exception if you try to setSpecProperty outside of a spec', async function() {
const env = new jasmineUnderTest.Env();
const env = new privateUnderTest.Env();
let exception;
env.describe('a suite', function() {
@@ -2410,7 +2412,7 @@ describe('Env integration', function() {
});
it('reports test properties on suites', async function() {
const env = new jasmineUnderTest.Env(),
const env = new privateUnderTest.Env(),
reporter = jasmine.createSpyObj('reporter', [
'jasmineDone',
'suiteDone',
@@ -2437,7 +2439,7 @@ describe('Env integration', function() {
});
it('throws an exception if you try to setSuiteProperty outside of a suite', function(done) {
const env = new jasmineUnderTest.Env();
const env = new privateUnderTest.Env();
try {
env.setSuiteProperty('a', 'Bee');
@@ -2776,7 +2778,7 @@ describe('Env integration', function() {
spyOn(jasmineUnderTest, 'getGlobal').and.returnValue(global);
env.cleanup_();
env = new jasmineUnderTest.Env();
env = new privateUnderTest.Env();
const reporter = jasmine.createSpyObj('reporter', [
'jasmineDone',
'suiteDone',
@@ -2877,7 +2879,7 @@ describe('Env integration', function() {
});
it('should report deprecation stack with an error object', async function() {
const exceptionFormatter = new jasmineUnderTest.ExceptionFormatter(),
const exceptionFormatter = new privateUnderTest.ExceptionFormatter(),
reporter = jasmine.createSpyObj('reporter', [
'jasmineDone',
'suiteDone',
@@ -3167,7 +3169,7 @@ describe('Env integration', function() {
});
it('supports asymmetric equality testers that take a matchersUtil', async function() {
const env = new jasmineUnderTest.Env();
const env = new privateUnderTest.Env();
env.it('spec using custom asymmetric equality tester', function() {
const customEqualityFn = function(a, b) {
@@ -3224,17 +3226,17 @@ describe('Env integration', function() {
});
it('is resolved after the stack is cleared', function(done) {
const realClearStack = jasmineUnderTest.getClearStack(
const realClearStack = privateUnderTest.getClearStack(
jasmineUnderTest.getGlobal()
),
clearStackSpy = jasmine
.createSpy('clearStack')
.and.callFake(realClearStack);
spyOn(jasmineUnderTest, 'getClearStack').and.returnValue(clearStackSpy);
spyOn(privateUnderTest, 'getClearStack').and.returnValue(clearStackSpy);
// Create a new env that has the clearStack defined above
env.cleanup_();
env = new jasmineUnderTest.Env();
env = new privateUnderTest.Env();
env.describe('suite', function() {
env.it('spec', function() {});
@@ -3262,7 +3264,7 @@ describe('Env integration', function() {
jasmineUnderTest.DEFAULT_TIMEOUT_INTERVAL = 123456; // a distinctive value
env = new jasmineUnderTest.Env();
env = new privateUnderTest.Env();
env.describe('suite', function() {
env.it('spec', function() {});
@@ -3333,17 +3335,17 @@ describe('Env integration', function() {
});
it('is called after the stack is cleared', async function() {
const realClearStack = jasmineUnderTest.getClearStack(
const realClearStack = privateUnderTest.getClearStack(
jasmineUnderTest.getGlobal()
),
clearStackSpy = jasmine
.createSpy('clearStack')
.and.callFake(realClearStack);
spyOn(jasmineUnderTest, 'getClearStack').and.returnValue(clearStackSpy);
spyOn(privateUnderTest, 'getClearStack').and.returnValue(clearStackSpy);
// Create a new env that has the clearStack defined above
env.cleanup_();
env = new jasmineUnderTest.Env();
env = new privateUnderTest.Env();
env.describe('suite', function() {
env.it('spec', function() {});
@@ -3371,7 +3373,7 @@ describe('Env integration', function() {
jasmineUnderTest.DEFAULT_TIMEOUT_INTERVAL = 123456; // a distinctive value
env = new jasmineUnderTest.Env();
env = new privateUnderTest.Env();
env.describe('suite', function() {
env.it('spec', function() {});

View File

@@ -4,7 +4,7 @@ describe('Global error handling (integration)', function() {
beforeEach(function() {
specHelpers.registerIntegrationMatchers();
env = new jasmineUnderTest.Env();
env = new privateUnderTest.Env();
});
afterEach(function() {
@@ -28,7 +28,7 @@ describe('Global error handling (integration)', function() {
spyOn(jasmineUnderTest, 'getGlobal').and.returnValue(global);
env.cleanup_();
env = new jasmineUnderTest.Env();
env = new privateUnderTest.Env();
const reporter = jasmine.createSpyObj('reporter', [
'jasmineDone',
'suiteDone',
@@ -85,12 +85,12 @@ describe('Global error handling (integration)', function() {
onerror: originalOnerror
};
spyOn(jasmineUnderTest, 'getGlobal').and.returnValue(global);
const globalErrors = new jasmineUnderTest.GlobalErrors(global);
const globalErrors = new privateUnderTest.GlobalErrors(global);
const onerror = jasmine.createSpy('onerror');
globalErrors.pushListener(onerror);
env.cleanup_();
env = new jasmineUnderTest.Env({
env = new privateUnderTest.Env({
suppressLoadErrors: true,
GlobalErrors: function() {
return globalErrors;
@@ -129,7 +129,7 @@ describe('Global error handling (integration)', function() {
};
spyOn(jasmineUnderTest, 'getGlobal').and.returnValue(global);
env.cleanup_();
env = new jasmineUnderTest.Env();
env = new privateUnderTest.Env();
const reporter = jasmine.createSpyObj('fakeReporter', [
'specDone',
'suiteDone'
@@ -170,10 +170,10 @@ describe('Global error handling (integration)', function() {
};
spyOn(jasmineUnderTest, 'getGlobal').and.returnValue(global);
const realClearStack = jasmineUnderTest.getClearStack(global);
const realClearStack = privateUnderTest.getClearStack(global);
const clearStackCallbacks = {};
let clearStackCallCount = 0;
spyOn(jasmineUnderTest, 'getClearStack').and.returnValue(function(fn) {
spyOn(privateUnderTest, 'getClearStack').and.returnValue(function(fn) {
clearStackCallCount++;
if (clearStackCallbacks[clearStackCallCount]) {
@@ -184,7 +184,7 @@ describe('Global error handling (integration)', function() {
});
env.cleanup_();
env = new jasmineUnderTest.Env();
env = new privateUnderTest.Env();
let suiteErrors = [];
env.addReporter({
@@ -234,7 +234,7 @@ describe('Global error handling (integration)', function() {
};
spyOn(jasmineUnderTest, 'getGlobal').and.returnValue(global);
env.cleanup_();
env = new jasmineUnderTest.Env();
env = new privateUnderTest.Env();
const reporter = jasmine.createSpyObj('fakeReporter', [
'specDone',
'suiteDone'
@@ -287,10 +287,10 @@ describe('Global error handling (integration)', function() {
};
spyOn(jasmineUnderTest, 'getGlobal').and.returnValue(global);
const realClearStack = jasmineUnderTest.getClearStack(global);
const realClearStack = privateUnderTest.getClearStack(global);
const clearStackCallbacks = {};
let clearStackCallCount = 0;
spyOn(jasmineUnderTest, 'getClearStack').and.returnValue(function(fn) {
spyOn(privateUnderTest, 'getClearStack').and.returnValue(function(fn) {
clearStackCallCount++;
if (clearStackCallbacks[clearStackCallCount]) {
@@ -301,7 +301,7 @@ describe('Global error handling (integration)', function() {
});
env.cleanup_();
env = new jasmineUnderTest.Env();
env = new privateUnderTest.Env();
let suiteErrors = [];
env.addReporter({
@@ -355,7 +355,7 @@ describe('Global error handling (integration)', function() {
};
spyOn(jasmineUnderTest, 'getGlobal').and.returnValue(global);
env.cleanup_();
env = new jasmineUnderTest.Env();
env = new privateUnderTest.Env();
spyOn(console, 'error');
@@ -398,12 +398,12 @@ describe('Global error handling (integration)', function() {
};
spyOn(jasmineUnderTest, 'getGlobal').and.returnValue(global);
const realClearStack = jasmineUnderTest.getClearStack(global);
const realClearStack = privateUnderTest.getClearStack(global);
let clearStackCallCount = 0;
let jasmineDone = false;
const expectedErrors = [];
const expectedErrorsAfterJasmineDone = [];
spyOn(jasmineUnderTest, 'getClearStack').and.returnValue(function(fn) {
spyOn(privateUnderTest, 'getClearStack').and.returnValue(function(fn) {
clearStackCallCount++;
const msg = `Error in clearStack #${clearStackCallCount}`;
@@ -419,7 +419,7 @@ describe('Global error handling (integration)', function() {
spyOn(console, 'error');
env.cleanup_();
env = new jasmineUnderTest.Env();
env = new privateUnderTest.Env();
const receivedErrors = [];
function logErrors(event) {
@@ -473,7 +473,7 @@ describe('Global error handling (integration)', function() {
};
spyOn(jasmineUnderTest, 'getGlobal').and.returnValue(global);
env.cleanup_();
env = new jasmineUnderTest.Env();
env = new privateUnderTest.Env();
const reporter = jasmine.createSpyObj('fakeReporter', [
'specDone',
'suiteDone'
@@ -516,10 +516,10 @@ describe('Global error handling (integration)', function() {
};
spyOn(jasmineUnderTest, 'getGlobal').and.returnValue(global);
const realClearStack = jasmineUnderTest.getClearStack(global);
const realClearStack = privateUnderTest.getClearStack(global);
const clearStackCallbacks = {};
let clearStackCallCount = 0;
spyOn(jasmineUnderTest, 'getClearStack').and.returnValue(function(fn) {
spyOn(privateUnderTest, 'getClearStack').and.returnValue(function(fn) {
clearStackCallCount++;
if (clearStackCallbacks[clearStackCallCount]) {
@@ -530,7 +530,7 @@ describe('Global error handling (integration)', function() {
});
env.cleanup_();
env = new jasmineUnderTest.Env();
env = new privateUnderTest.Env();
let suiteErrors = [];
env.addReporter({
@@ -580,7 +580,7 @@ describe('Global error handling (integration)', function() {
};
spyOn(jasmineUnderTest, 'getGlobal').and.returnValue(global);
env.cleanup_();
env = new jasmineUnderTest.Env();
env = new privateUnderTest.Env();
const reporter = jasmine.createSpyObj('fakeReporter', [
'specDone',
'suiteDone'
@@ -635,10 +635,10 @@ describe('Global error handling (integration)', function() {
};
spyOn(jasmineUnderTest, 'getGlobal').and.returnValue(global);
const realClearStack = jasmineUnderTest.getClearStack(global);
const realClearStack = privateUnderTest.getClearStack(global);
const clearStackCallbacks = {};
let clearStackCallCount = 0;
spyOn(jasmineUnderTest, 'getClearStack').and.returnValue(function(fn) {
spyOn(privateUnderTest, 'getClearStack').and.returnValue(function(fn) {
clearStackCallCount++;
if (clearStackCallbacks[clearStackCallCount]) {
@@ -649,7 +649,7 @@ describe('Global error handling (integration)', function() {
});
env.cleanup_();
env = new jasmineUnderTest.Env();
env = new privateUnderTest.Env();
let suiteErrors = [];
env.addReporter({
@@ -703,7 +703,7 @@ describe('Global error handling (integration)', function() {
};
spyOn(jasmineUnderTest, 'getGlobal').and.returnValue(global);
env.cleanup_();
env = new jasmineUnderTest.Env();
env = new privateUnderTest.Env();
spyOn(console, 'error');
@@ -748,12 +748,12 @@ describe('Global error handling (integration)', function() {
};
spyOn(jasmineUnderTest, 'getGlobal').and.returnValue(global);
const realClearStack = jasmineUnderTest.getClearStack(global);
const realClearStack = privateUnderTest.getClearStack(global);
let clearStackCallCount = 0;
let jasmineDone = false;
const expectedErrors = [];
const expectedErrorsAfterJasmineDone = [];
spyOn(jasmineUnderTest, 'getClearStack').and.returnValue(function(fn) {
spyOn(privateUnderTest, 'getClearStack').and.returnValue(function(fn) {
clearStackCallCount++;
const reason = `Error in clearStack #${clearStackCallCount}`;
const expectedMsg = `Unhandled promise rejection: ${reason} thrown`;
@@ -770,7 +770,7 @@ describe('Global error handling (integration)', function() {
spyOn(console, 'error');
env.cleanup_();
env = new jasmineUnderTest.Env();
env = new privateUnderTest.Env();
const receivedErrors = [];
function logErrors(event) {
@@ -833,7 +833,7 @@ describe('Global error handling (integration)', function() {
};
spyOn(jasmineUnderTest, 'getGlobal').and.returnValue(global);
env.cleanup_();
env = new jasmineUnderTest.Env();
env = new privateUnderTest.Env();
env.configure({ detectLateRejectionHandling: true });
reporter = jasmine.createSpyObj('fakeReporter', [
@@ -980,7 +980,7 @@ describe('Global error handling (integration)', function() {
};
spyOn(jasmineUnderTest, 'getGlobal').and.returnValue(global);
env.cleanup_();
env = new jasmineUnderTest.Env();
env = new privateUnderTest.Env();
env.configure({ detectLateRejectionHandling: true });
const reporter = jasmine.createSpyObj('fakeReporter', [
'specDone',
@@ -1026,7 +1026,7 @@ describe('Global error handling (integration)', function() {
};
spyOn(jasmineUnderTest, 'getGlobal').and.returnValue(global);
env.cleanup_();
env = new jasmineUnderTest.Env();
env = new privateUnderTest.Env();
env.configure({ autoCleanClosures: false });
const reporter = jasmine.createSpyObj('fakeReporter', ['specDone']);

View File

@@ -2,7 +2,7 @@ describe('Matchers (Integration)', function() {
let env;
beforeEach(function() {
env = new jasmineUnderTest.Env();
env = new privateUnderTest.Env();
});
afterEach(function() {
@@ -143,7 +143,7 @@ describe('Matchers (Integration)', function() {
function verifyFailsWithCustomObjectFormattersAsync(config) {
it('uses custom object formatters', async function() {
const env = new jasmineUnderTest.Env();
const env = new privateUnderTest.Env();
env.it('a spec', function() {
env.addCustomObjectFormatter(config.formatter);
return config.expectations(env);

View File

@@ -2,7 +2,7 @@ describe('Support for parallel execution', function() {
let env;
beforeEach(function() {
env = new jasmineUnderTest.Env();
env = new privateUnderTest.Env();
});
afterEach(function() {

View File

@@ -3,7 +3,7 @@ describe('spec running', function() {
beforeEach(function() {
specHelpers.registerIntegrationMatchers();
env = new jasmineUnderTest.Env();
env = new privateUnderTest.Env();
env.configure({ random: false });
});