From d7c555379d2f7c7ce3ec1c3b0b4147d184788d2e Mon Sep 17 00:00:00 2001 From: Nox Date: Tue, 23 Jun 2026 00:40:52 +0200 Subject: [PATCH] Stabilize TradingView indicator CI tests Signed-off-by: Nox --- .github/workflows/tests.yml | 3 +++ tests/indicators.test.ts | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c2d6009..42df086 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,6 +14,9 @@ jobs: runs-on: ubuntu-latest strategy: + # TradingView authenticated tests use the same account/session secrets. + # Running every Node matrix job at once makes the external websocket tests flaky. + max-parallel: 1 matrix: node-version: [14.x, 18.x, 19.x] diff --git a/tests/indicators.test.ts b/tests/indicators.test.ts index 3860744..d835a03 100644 --- a/tests/indicators.test.ts +++ b/tests/indicators.test.ts @@ -119,7 +119,11 @@ describe('Indicators', () => { const lastResult: any = await new Promise((resolve) => { CipherB.onUpdate(() => { - resolve(CipherB.periods[0]); + const lastPeriod = CipherB.periods[0]; + + if (lastPeriod?.VWAP !== undefined && lastPeriod?.rsiMFI !== undefined) { + resolve(lastPeriod); + } }); }); @@ -135,7 +139,7 @@ describe('Indicators', () => { expect(lastResult.Buy_and_sell_circle).toBeTypeOf('number'); CipherB.remove(); - }); + }, 30000); it.skipIf(noAuth)('removes chart', () => { console.log('Closing the chart...');