Skip to content

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

Description

@lumixraku

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+node@20.11.30_sass@1.77.2/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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions