Skip to content

Port 3000 is already in use when parallele cypress components test. #211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
lumixraku opened this issue May 8, 2025 · 0 comments
Open

Comments

@lumixraku
Copy link

lumixraku commented May 8, 2025

when I run

cypress-parallel -s test:components -t 4 -d "src/**/__tests__/**/*.cy.{js,jsx,ts,tsx}"

DevTools listening on ws://127.0.0.1:57503/devtools/browser/2399dd54-4b51-41b5-8356-69e8331d0336
(node:96746) ExperimentalWarning: --experimental-loader may be removed in the future; instead use register():
--import 'data:text/javascript,import { register } from "node:module"; import { pathToFileURL } from "node:url"; register("file%3A///Users/raku/Library/Caches/Cypress/13.7.2/Cypress.app/Contents/Resources/app/node_modules/ts-node/esm/transpile-only.mjs", pathToFileURL("./"));'
(Use node --trace-warnings ... to show where the warning was created)
(node:96746) ExperimentalWarning: The Node.js specifier resolution flag is experimental. It could change or be removed at any time.
(node:96746) ExperimentalWarning: The Node.js specifier resolution flag is experimental. It could change or be removed at any time.
(Use node --trace-warnings ... to show where the warning was created)
The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
Port 3000 is already in use
Error: Port 3000 is already in use
at Server.onError (file:///Users/raku/repos/AppFlowy-Web/node_modules/.pnpm/vite@5.2.0_@types[email protected][email protected]/node_modules/vite/dist/node/chunks/dep-B8QpfTwU.js:47028:28)
at Server.emit (node:events:517:28)
at emitErrorNT (node:net:1844:8)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

My cypress.config.ts


import { defineConfig } from 'cypress';
import codeCoverageTask from '@cypress/code-coverage/task.js';
import { execSync } from 'child_process';

export default defineConfig({
  env: {
    codeCoverage: {
      exclude: ['cypress/**/*.*', '**/__tests__/**/*.*', '**/*.test.*'],
      reportDir: 'coverage/cypress',
      all: true,
      include: ['src/**/*.ts', 'src/**/*.tsx'],
      reporter: ['text', 'html', 'text-summary', 'json', 'lcov'],
      tempDir: 'coverage/.nyc_output',
    },
  },
  watchForFileChanges: false,
  component: {
    // src/components/editor/__tests__/blocks/Paragraph.cy.tsx
    specPattern: '**/*.cy.tsx',     
    devServer: {
      framework: 'react',
      bundler: 'vite',           // ------------------------> I think it's because of this. 🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔
    },
    supportFile: 'cypress/support/component.ts',
  },
  e2e: {
    specPattern: '**/*.cy.ts',
    supportFile: 'cypress/support/e2e.ts',
    baseUrl: 'http://localhost:3000/',
  },
});

When parallel, each task start a server, how to solve this? (server port should always be 3000, because only this port allow cross origin)

@lumixraku lumixraku changed the title Error: ENOENT: no such file or directory, scandir 'cypress/integration'. when I use cypress-parallel Port 3000 is already in use when parallele cypress components test. May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant