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

@@ -2,7 +2,7 @@ describe('TreeRunner', function() {
describe('spec execution', function() {
it('starts the timer, reports the spec started, and updates run state at the start of the queue', async function() {
const timer = jasmine.createSpyObj('timer', ['start']);
const spec = new jasmineUnderTest.Spec({
const spec = new privateUnderTest.Spec({
id: 'spec1',
queueableFn: {},
timer
@@ -38,7 +38,7 @@ describe('TreeRunner', function() {
it('stops the timer, updates run state, and reports the spec done at the end of the queue', async function() {
const timer = jasmine.createSpyObj('timer', ['start', 'elapsed']);
const spec = new jasmineUnderTest.Spec({
const spec = new privateUnderTest.Spec({
id: 'spec1',
queueableFn: {},
timer
@@ -82,7 +82,7 @@ describe('TreeRunner', function() {
expect(after).not.toHaveBeenCalled();
})
};
const spec = new jasmineUnderTest.Spec({
const spec = new privateUnderTest.Spec({
queueableFn: queueableFn,
beforeAndAfterFns: function() {
return { befores: [before], afters: [after] };
@@ -106,7 +106,7 @@ describe('TreeRunner', function() {
spec.pend();
}
};
spec = new jasmineUnderTest.Spec({ queueableFn });
spec = new privateUnderTest.Spec({ queueableFn });
const { runQueue, suiteRunQueueArgs } = runSingleSpecSuite(spec);
suiteRunQueueArgs.queueableFns[0].fn();
@@ -127,7 +127,7 @@ describe('TreeRunner', function() {
spec.pend('some reason');
}
};
spec = new jasmineUnderTest.Spec({ queueableFn });
spec = new privateUnderTest.Spec({ queueableFn });
const { runQueue, suiteRunQueueArgs } = runSingleSpecSuite(spec);
suiteRunQueueArgs.queueableFns[0].fn();
@@ -142,7 +142,7 @@ describe('TreeRunner', function() {
});
it('passes failSpecWithNoExp to Spec#executionFinished', async function() {
const spec = new jasmineUnderTest.Spec({
const spec = new privateUnderTest.Spec({
id: 'spec1',
queueableFn: {}
});
@@ -168,8 +168,8 @@ describe('TreeRunner', function() {
describe('Suite execution', function() {
it('reports the duration of the suite', async function() {
const timer = jasmine.createSpyObj('timer', ['start', 'elapsed']);
const topSuite = new jasmineUnderTest.Suite({ id: 'topSuite' });
const suite = new jasmineUnderTest.Suite({
const topSuite = new privateUnderTest.Suite({ id: 'topSuite' });
const suite = new privateUnderTest.Suite({
id: 'suite1',
parentSuite: topSuite,
timer
@@ -189,13 +189,13 @@ describe('TreeRunner', function() {
};
const runQueue = jasmine.createSpy('runQueue');
const reportDispatcher = mockReportDispatcher();
const subject = new jasmineUnderTest.TreeRunner({
const subject = new privateUnderTest.TreeRunner({
executionTree,
runQueue,
globalErrors: mockGlobalErrors(),
runableResources: mockRunableResources(),
reportDispatcher,
currentRunableTracker: new jasmineUnderTest.CurrentRunableTracker(),
currentRunableTracker: new privateUnderTest.CurrentRunableTracker(),
getConfig() {
return {};
},
@@ -226,12 +226,12 @@ describe('TreeRunner', function() {
});
it('returns false if a suite failed', async function() {
const topSuite = new jasmineUnderTest.Suite({ id: 'topSuite' });
const failingSuite = new jasmineUnderTest.Suite({
const topSuite = new privateUnderTest.Suite({ id: 'topSuite' });
const failingSuite = new privateUnderTest.Suite({
id: 'failingSuite',
parentSuite: topSuite
});
const passingSuite = new jasmineUnderTest.Suite({
const passingSuite = new privateUnderTest.Suite({
id: 'passingSuite',
parentSuite: topSuite
});
@@ -249,13 +249,13 @@ describe('TreeRunner', function() {
};
const runQueue = jasmine.createSpy('runQueue');
const reportDispatcher = mockReportDispatcher();
const subject = new jasmineUnderTest.TreeRunner({
const subject = new privateUnderTest.TreeRunner({
executionTree,
runQueue,
globalErrors: mockGlobalErrors(),
runableResources: mockRunableResources(),
reportDispatcher,
currentRunableTracker: new jasmineUnderTest.CurrentRunableTracker(),
currentRunableTracker: new privateUnderTest.CurrentRunableTracker(),
getConfig() {
return {};
},
@@ -290,13 +290,13 @@ describe('TreeRunner', function() {
});
it('reports children when there is a beforeAll failure', async function() {
const topSuite = new jasmineUnderTest.Suite({ id: 'topSuite' });
const suite = new jasmineUnderTest.Suite({
const topSuite = new privateUnderTest.Suite({ id: 'topSuite' });
const suite = new privateUnderTest.Suite({
id: 'suite',
parentSuite: topSuite
});
suite.beforeAll({ fn() {} });
const spec = new jasmineUnderTest.Spec({
const spec = new privateUnderTest.Spec({
id: 'spec',
parentSuite: suite,
queueableFn: { fn() {} }
@@ -320,13 +320,13 @@ describe('TreeRunner', function() {
const reportChildrenOfBeforeAllFailure = jasmine
.createSpy('reportChildrenOfBeforeAllFailure')
.and.returnValue(Promise.resolve());
const subject = new jasmineUnderTest.TreeRunner({
const subject = new privateUnderTest.TreeRunner({
executionTree,
runQueue,
globalErrors: mockGlobalErrors(),
runableResources: mockRunableResources(),
reportDispatcher,
currentRunableTracker: new jasmineUnderTest.CurrentRunableTracker(),
currentRunableTracker: new privateUnderTest.CurrentRunableTracker(),
reportChildrenOfBeforeAllFailure,
getConfig() {
return {};
@@ -356,12 +356,12 @@ describe('TreeRunner', function() {
});
it('throws if the wrong suite is completed', async function() {
const topSuite = new jasmineUnderTest.Suite({ id: 'topSuite' });
const suite = new jasmineUnderTest.Suite({
const topSuite = new privateUnderTest.Suite({ id: 'topSuite' });
const suite = new privateUnderTest.Suite({
id: 'suite',
parentSuite: topSuite
});
const spec = new jasmineUnderTest.Spec({
const spec = new privateUnderTest.Spec({
id: 'spec',
parentSuite: suite,
queueableFn: { fn() {} }
@@ -380,13 +380,13 @@ describe('TreeRunner', function() {
};
const runQueue = jasmine.createSpy('runQueue');
const reportDispatcher = mockReportDispatcher();
const subject = new jasmineUnderTest.TreeRunner({
const subject = new privateUnderTest.TreeRunner({
executionTree,
runQueue,
globalErrors: mockGlobalErrors(),
runableResources: mockRunableResources(),
reportDispatcher,
currentRunableTracker: new jasmineUnderTest.CurrentRunableTracker(),
currentRunableTracker: new privateUnderTest.CurrentRunableTracker(),
getConfig() {
return {};
},
@@ -412,7 +412,7 @@ describe('TreeRunner', function() {
});
it('does not remove before and after fns from the top suite', async function() {
const topSuite = new jasmineUnderTest.Suite({ id: 'topSuite' });
const topSuite = new privateUnderTest.Suite({ id: 'topSuite' });
spyOn(topSuite, 'cleanupBeforeAfter');
const executionTree = {
topSuite,
@@ -424,13 +424,13 @@ describe('TreeRunner', function() {
}
};
const runQueue = jasmine.createSpy('runQueue');
const subject = new jasmineUnderTest.TreeRunner({
const subject = new privateUnderTest.TreeRunner({
executionTree,
runQueue,
globalErrors: mockGlobalErrors(),
runableResources: mockRunableResources(),
reportDispatcher: mockReportDispatcher(),
currentRunableTracker: new jasmineUnderTest.CurrentRunableTracker(),
currentRunableTracker: new privateUnderTest.CurrentRunableTracker(),
getConfig() {
return {};
}
@@ -460,7 +460,7 @@ describe('TreeRunner', function() {
expect(after).not.toHaveBeenCalled();
})
};
const spec = new jasmineUnderTest.Spec({
const spec = new privateUnderTest.Spec({
queueableFn,
beforeAndAfterFns: function() {
return { befores: [before], afters: [after] };
@@ -504,13 +504,13 @@ describe('TreeRunner', function() {
});
it('works for beforeAll when the detectLateRejectionHandling param is true', async function() {
const topSuite = new jasmineUnderTest.Suite({ id: 'topSuite' });
const suite = new jasmineUnderTest.Suite({
const topSuite = new privateUnderTest.Suite({ id: 'topSuite' });
const suite = new privateUnderTest.Suite({
id: 'suite',
parentSuite: topSuite
});
suite.beforeAll(function() {});
const spec = new jasmineUnderTest.Spec({
const spec = new privateUnderTest.Spec({
queueableFn: { fn() {} },
parentSuite: suite
});
@@ -530,14 +530,14 @@ describe('TreeRunner', function() {
const reportDispatcher = mockReportDispatcher();
const globalErrors = mockGlobalErrors();
const setTimeout = jasmine.createSpy('setTimeout');
const subject = new jasmineUnderTest.TreeRunner({
const subject = new privateUnderTest.TreeRunner({
executionTree,
runQueue,
globalErrors,
runableResources: mockRunableResources(),
reportDispatcher,
setTimeout,
currentRunableTracker: new jasmineUnderTest.CurrentRunableTracker(),
currentRunableTracker: new privateUnderTest.CurrentRunableTracker(),
getConfig() {
return { detectLateRejectionHandling: true };
},
@@ -573,13 +573,13 @@ describe('TreeRunner', function() {
});
it('works for afterAll when the detectLateRejectionHandling param is true', async function() {
const topSuite = new jasmineUnderTest.Suite({ id: 'topSuite' });
const suite = new jasmineUnderTest.Suite({
const topSuite = new privateUnderTest.Suite({ id: 'topSuite' });
const suite = new privateUnderTest.Suite({
id: 'suite',
parentSuite: topSuite
});
suite.afterAll(function() {});
const spec = new jasmineUnderTest.Spec({
const spec = new privateUnderTest.Spec({
queueableFn: { fn() {} },
parentSuite: suite
});
@@ -599,14 +599,14 @@ describe('TreeRunner', function() {
const reportDispatcher = mockReportDispatcher();
const globalErrors = mockGlobalErrors();
const setTimeout = jasmine.createSpy('setTimeout');
const subject = new jasmineUnderTest.TreeRunner({
const subject = new privateUnderTest.TreeRunner({
executionTree,
runQueue,
globalErrors,
runableResources: mockRunableResources(),
reportDispatcher,
setTimeout,
currentRunableTracker: new jasmineUnderTest.CurrentRunableTracker(),
currentRunableTracker: new privateUnderTest.CurrentRunableTracker(),
getConfig() {
return { detectLateRejectionHandling: true };
},
@@ -645,7 +645,7 @@ describe('TreeRunner', function() {
function runSingleSpecSuite(spec, optionalConfig) {
const topSuiteId = 'suite1';
spec.parentSuiteId = topSuiteId;
const topSuite = new jasmineUnderTest.Suite({ id: topSuiteId });
const topSuite = new privateUnderTest.Suite({ id: topSuiteId });
topSuite.addChild(spec);
const executionTree = {
topSuite,
@@ -661,8 +661,8 @@ describe('TreeRunner', function() {
const runableResources = mockRunableResources();
const globalErrors = mockGlobalErrors();
const setTimeout = jasmine.createSpy('setTimeout');
const currentRunableTracker = new jasmineUnderTest.CurrentRunableTracker();
const subject = new jasmineUnderTest.TreeRunner({
const currentRunableTracker = new privateUnderTest.CurrentRunableTracker();
const subject = new privateUnderTest.TreeRunner({
executionTree,
runQueue,
globalErrors,
@@ -696,10 +696,10 @@ describe('TreeRunner', function() {
function mockReportDispatcher() {
const reportDispatcher = jasmine.createSpyObj(
'reportDispatcher',
jasmineUnderTest.reporterEvents
privateUnderTest.reporterEvents
);
for (const k of jasmineUnderTest.reporterEvents) {
for (const k of privateUnderTest.reporterEvents) {
reportDispatcher[k].and.returnValue(Promise.resolve());
}