Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Run Tests

on:
push:
branches: [main]
pull_request:

jobs:
test:
name: Test on Node.js ${{ matrix.node-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [18.x, 20.x, 22.x]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Run tests with coverage
run: npm run test:ci

- name: Upload coverage report
if: matrix.node-version == '20.x'
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage/
retention-days: 7
23 changes: 23 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
testEnvironment: "node",
setupFilesAfterEnv: ["<rootDir>/test/setup.js"],
testMatch: ["**/test/**/*.test.js"],
// Skip polling/monitor tests for now - they have complex async timing issues
testPathIgnorePatterns: ["/node_modules/"],
collectCoverageFrom: ["nodes/**/*.js", "!nodes/**/*.html"],
coverageDirectory: "coverage",
coverageReporters: ["text", "text-summary", "html", "lcov"],
// Coverage thresholds - raised to reflect comprehensive test coverage
coverageThreshold: {
global: {
branches: 70,
functions: 75,
lines: 85,
statements: 85,
},
},
clearMocks: true,
resetMocks: true,
restoreMocks: true,
testTimeout: 10000,
};
7 changes: 5 additions & 2 deletions nodes/datalink-poll.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,18 @@ module.exports = function (RED) {
};

// Start the polling interval
let intervalId = null;
if (node.seqeraConfig && config.dataLinkName && config.dataLinkName.trim() !== "") {
const intervalMs = node.pollFrequencySec * 1000;
const intervalId = setInterval(executePoll, intervalMs);
intervalId = setInterval(executePoll, intervalMs);
// run once immediately
executePoll();
}

node.on("close", () => {
clearInterval(intervalId);
if (intervalId) {
clearInterval(intervalId);
}
});
}

Expand Down
Loading