Skip to content

Commit 848a864

Browse files
TMP: flacky tests pushed
1 parent 04caa72 commit 848a864

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

tests/osn-tests/src/test_nodeobs_api.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,23 @@ import { showHideInputHotkeys, slideshowHotkeys, ffmpeg_sourceHotkeys,
99

1010
const testName = 'nodeobs_api';
1111

12+
function failOnceInCi(context: any, label: string) {
13+
const isCi = process.env.GITHUB_ACTIONS === 'true' || process.env.CI === 'true';
14+
if (!isCi) {
15+
return;
16+
}
17+
18+
const test = context && (context.test || context.currentTest);
19+
const retryCount = test && typeof test.currentRetry === 'function'
20+
? test.currentRetry()
21+
: 0;
22+
23+
// Intentionally fail the first CI attempt so retry reporting can be tested.
24+
if (retryCount === 0) {
25+
throw new Error(`Intentional flaky failure for CI validation: ${label}`);
26+
}
27+
}
28+
1229
describe(testName, function() {
1330
let obs: OBSHandler;
1431
let hasTestFailed: boolean = false;
@@ -42,6 +59,8 @@ describe(testName, function() {
4259
});
4360

4461
it('Get performance statistics', function() {
62+
failOnceInCi(this, 'Get performance statistics');
63+
4564
let stats: IPerformanceState;
4665

4766
// Getting performance statistics
@@ -155,6 +174,8 @@ describe(testName, function() {
155174
});
156175

157176
it('Get and set the browser source acceleration', function() {
177+
failOnceInCi(this, 'Get and set the browser source acceleration');
178+
158179
expect(osn.NodeObs.GetBrowserAcceleration()).
159180
to.equal(true, 'Invalid browser source acceleration default value');
160181
osn.NodeObs.SetBrowserAcceleration(false);
@@ -163,6 +184,8 @@ describe(testName, function() {
163184
});
164185

165186
it('Get and set media file caching', function() {
187+
failOnceInCi(this, 'Get and set media file caching');
188+
166189
expect(osn.NodeObs.GetMediaFileCaching()).
167190
to.equal(true, 'Invalid media file caching default value');
168191
osn.NodeObs.SetMediaFileCaching(false);

0 commit comments

Comments
 (0)