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
5 changes: 5 additions & 0 deletions packages/server/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ module.exports = {
// Regular expression to find test files
testRegex: '((\\.|/)index\\.test)\\.tsx?$',

// Stub ESM-only MCP SDK imports for Jest's CJS runtime.
moduleNameMapper: {
'^@modelcontextprotocol/sdk(/.*)?$': '<rootDir>/../components/test/__mocks__/esm-stub.js'
},

// File extensions to recognize in module resolution
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],

Expand Down
3 changes: 2 additions & 1 deletion packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
"cypress:run": "cypress run",
"e2e": "start-server-and-test dev http://localhost:3000 cypress:run",
"cypress:ci": "START_SERVER_AND_TEST_INSECURE=1 start-server-and-test start https-get://localhost:3000 cypress:run",
"test": "jest --runInBand --detectOpenHandles --forceExit"
"test": "jest --runInBand --detectOpenHandles --forceExit",
"test:coverage": "pnpm test --coverage"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you confirm if this work when running at project level? test seems to be halting at the end of test run the last time I tried

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m using supertest for integration testing, so the server has to fully initialize before tests run. On Windows starting up Flowise is very slow, which is why I added a 3-minute wait to avoid flaky failures. The tests aren’t truly stuck/halt, they’re waiting for startup to complete.

https://github.com/FlowiseAI/Flowise/blob/main/packages/server/test/index.test.ts

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should separate this out and use test:integration (or test:int, test:int:coverage for example) instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with splitting the test command.

For now, I’ll close this PR first since I’m still new to writing test scripts, and this test is only verifying a simple “Hello World”.

Also, we may not be using supertest in the future, so I’d prefer not to introduce new integration-test scripts until we decide on the longer-term testing approach.

},
"keywords": [],
"homepage": "https://flowiseai.com",
Expand Down
8 changes: 6 additions & 2 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
"dependsOn": ["^build"],
"outputs": ["dist/**"]
},
"test": {},
"test:coverage": {},
"test": {
"dependsOn": ["^build"]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we really need to depend on build for unit tests? usually unit test shouldn't rely on build as the tests are only at unit level

},
"test:coverage": {
"dependsOn": ["^build"]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment about build dependency as test script

},
"dev": {
"cache": false
}
Expand Down
Loading