Skip to content

πŸ“ˆ Get real-time stocks from TradingView

Stabilize TradingView indicator CI tests

Noxd7c555379d2f
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...');