https://cypress.io logo
Join Discord
Powered by
# help
  • e

    echoing-piano-69699

    06/04/2021, 6:04 PM
    To make things more confusing, I have a console log to confirm it's being run but cypress isn't picking up on that
  • e

    echoing-piano-69699

    06/04/2021, 6:09 PM
    I'm beginning to think this has to with how I'm testing. It might be the case that
    cy.spy
    is only meant to be used after directly invoking a function that calls it. But what I want to test is that after a particular series of user interactions the method was called
  • e

    echoing-piano-69699

    06/04/2021, 6:11 PM
    I just called it manually and the test passes, so I think that is the case and this would explain why the documentation shows calling a method before asking Cypress whether another function was called
  • h

    handsome-kilobyte-99728

    06/04/2021, 7:01 PM
    @User @User i tested using Vite as the dev server and it works as expected. So Webpack seems to be the culprit. I also tried with a stripped down webpack config and no luck there.
  • b

    bulky-sundown-74498

    06/04/2021, 7:03 PM
    Finally getting back on it @User it will probably be one of the plugins. give me a few minutes to get my hands on the culprit
  • h

    handsome-kilobyte-99728

    06/04/2021, 7:04 PM
    Thank you! I really appreciate it 🙂
  • b

    bulky-sundown-74498

    06/04/2021, 7:08 PM
    at a glance I have had trouble with this plugin
    ReactRefreshWebpackPlugin()
    since we do not use HMR as we re-run all the tests in the file when code changes
  • h

    handsome-kilobyte-99728

    06/04/2021, 7:09 PM
    I also tried with this webpack config and it was still unable to find any tests in the file:
    Copy code
    const path = require('path');
    
    module.exports = {
      mode: 'development',
      devtool: false,
      resolve: {
        extensions: ['.js', '.jsx', '.tsx', '.ts', '.scss'],
        alias: {
          '@': path.resolve(__dirname, '..', 'src'),
        },
      },
      module: {
        rules: [
          {
            test: /\.tsx?$/,
            exclude: [/node_modules/],
            use: [
              {
                loader: 'ts-loader',
                options: {
                  transpileOnly: true,
                },
              },
            ],
          },
        ],
      },
    };
  • b

    bulky-sundown-74498

    06/04/2021, 7:09 PM
    The problem is not your webpack config
  • b

    bulky-sundown-74498

    06/04/2021, 7:10 PM
    ... there is a bug in cypress CT
  • b

    bulky-sundown-74498

    06/04/2021, 7:10 PM
    hum
  • b

    bulky-sundown-74498

    06/04/2021, 7:10 PM
    that is embarrassing
  • h

    handsome-kilobyte-99728

    06/04/2021, 7:10 PM
    part of the game!
  • b

    bulky-sundown-74498

    06/04/2021, 7:10 PM
    it is alpha software
  • b

    bulky-sundown-74498

    06/04/2021, 7:10 PM
    When we do not return config in the plugins/index.js file
  • b

    bulky-sundown-74498

    06/04/2021, 7:11 PM
    this exact thing happens
  • b

    bulky-sundown-74498

    06/04/2021, 7:11 PM
    Could you create an issue to track it
  • b

    bulky-sundown-74498

    06/04/2021, 7:11 PM
    ?
  • h

    handsome-kilobyte-99728

    06/04/2021, 7:11 PM
    sure!
  • b

    bulky-sundown-74498

    06/04/2021, 7:12 PM
    and in the meant time, unlock yourself by adding
    return config
    after this line: https://github.com/andrew-anguiano/reproductions/blob/main/cypress-component-testing-16784/cypress/plugins/index.js#L26
  • b

    bulky-sundown-74498

    06/04/2021, 7:12 PM
    Now it works
  • b

    bulky-sundown-74498

    06/04/2021, 7:12 PM
    ...
  • b

    bulky-sundown-74498

    06/04/2021, 7:14 PM
    Well, it works if you remove the react refresh plugin
  • b

    bulky-sundown-74498

    06/04/2021, 7:14 PM
    in CT
  • h

    handsome-kilobyte-99728

    06/04/2021, 7:14 PM
    Ah ok, I'll try that.
  • b

    bulky-sundown-74498

    06/04/2021, 7:14 PM
    I could make a quick PR too
  • h

    handsome-kilobyte-99728

    06/04/2021, 7:19 PM
    I think i have it working in the repro repo now following that advice. Although it's showing me this error for the test which could be a config issue on my end.
  • b

    bulky-sundown-74498

    06/04/2021, 7:19 PM
    https://github.com/andrew-anguiano/reproductions/pull/1
  • b

    bulky-sundown-74498

    06/04/2021, 7:19 PM
    you forgot one part of the removing react refresh 😉
  • h

    handsome-kilobyte-99728

    06/04/2021, 7:19 PM
    thanks for the pr! and the help 🙂
1...212223...252Latest