cypress: After the update to version 13, the component tests do not work.

Current behavior

After updating to version 13 of Cypress, some tests are giving me the following error.

No tests found. Cypress could not detect tests in this file.

They worked in Version 12

Desired behavior

No response

Test code to reproduce

import {defineConfig} from 'cypress';

export default defineConfig({
    e2e: {
        baseUrl: 'http://localhost:4200',
        supportFile: false,
        video: false
    },
    component: {
        devServer: {
            framework: 'angular',
            bundler: 'webpack'
        },
        specPattern: '**/*.cy.ts'
    }
});

Cypress Version

13.2.0

Node version

18.11.0

Operating System

Mac OS

Debug Logs

No response

Other

No response

About this issue

  • Original URL
  • State: open
  • Created 9 months ago
  • Comments: 18 (3 by maintainers)

Most upvoted comments

I found the reason of this no tests found here, it can be fixed by this commit of cypress/webpack-dev-server of this new loader. For rspack, with the dev-server cypress-rspack-dev-server, old and new loader are both applied: https://github.com/th3fallen/cypress-rspack-dev-server/blob/5165ecb220afc4489d5ef72ef0a4eb582fe01cc1/src/loader.ts#L27

Can you publish the updated version of cypress-rspack-dev-server on npm please ? šŸ™‚

Yes, done

I’m facing the same problem with Cypress v13.6.0, NX v16.9.1, Node v18 and rspack core v0.3.14

Here is my cypress config:

component: {
    supportFile: "cypress/support/index.ts",
    specPattern: "**/*.component-test.{ts,tsx}",
    experimentalSingleTabRunMode: false,
    defaultCommandTimeout: 10000,
    devServer: {
      framework: "react",
      bundler: "webpack",
    },
    setupNodeEvents(on, config) {
      failFast(on, config);

      config.env.GRAPHQL_SCHEMA = schema;
      return config;
    },
  },

rspack server configuration:

devServer: {
      allowedHosts: "all",
      historyApiFallback: true,
      port: PORT,
      hot: true,
      client: {
        overlay: false,
      },
    },
    mode: "development",
    devtool: "source-map",
    module: {
      rules: [
        {
          test: /\.tsx?$/,
          exclude: /(node_modules)/,
          use: {
            loader: "swc-loader",
            options: {
              jsc: {
                transform: {
                  react: {
                    runtime: "automatic",
                  },
                },
                paths: {
                  "@instrument-ui": [`${root}/apps/instrument-ui`],
                  "@packages/*": [`${root}/packages/*`],
                },
                parser: {
                  syntax: "typescript",
                  tsx: true,
                },
                baseUrl: root,
              },
            },
          },
        },
      ],
    },
    plugins: [new DotenvPlugin({ path: `${root}/apps/instrument-ui/.env`, systemvars: true }), new NodePolyfill()],
    resolve: {
      extensions: [".ts", ".tsx", ".mjs", ".js", ".jsx"],
      tsConfigPath: `${root}/tsconfig.base.json`,
      fallback: {
        path: false,
      },
    },

When I run the tests with webpack v5.88.2 everything works fine.

image image