question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Trouble running .features file with webpack on windows

See original GitHub issue

I am using v1.17 with cypress 3.8.2 on windows and am having issues with

cypress run --spec **/*.features

I get

Oops…we found an error preparing this test file:

cypress\integration\All.features

The error was:

./cypress/integration/All.features Module build failed (from ./node_modules/cypress-cucumber-preprocessor/lib/featuresLoader.js): TypeError [ERR_INVALID_ARG_TYPE]: The “path” argument must be of type string. Received type undefined @ multi ./cypress/integration/All.features main[0]

This occurred while Cypress was compiling and bundling your test code. This is usually caused by:

  • A missing file or dependency
  • A syntax error in the file or one of its dependencies

Fix the error in your code and re-run your tests.

The project is set up with typescript.

I have created a repo for the issue.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:20 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
sebastianderocommented, Jun 23, 2020

@lgandecki we have the issue on linux, mac and windows. We use webpack for preprocessing and receive “cannot read property split of undefined” in cypress upon running the All.features file.

our project is set-up using nrwl.io nx.

Here’s our plugins/index.js

const { getWebpackConfig } = require('@nrwl/cypress/plugins/preprocessor');
const webpack = require('@cypress/webpack-preprocessor');

function preprocessTypescript(config) {
  if (!config.env.tsConfig) {
    throw new Error('Please provide an absolute path to a tsconfig.json as cypressConfig.env.tsConfig');
  }

  const webpackConfig = getWebpackConfig(config);

  webpackConfig.node = { fs: 'empty', child_process: 'empty', readline: 'empty' };

  webpackConfig.module.rules.push({
    test: /\.feature$/,
    use: [
      {
        loader: 'cypress-cucumber-preprocessor/loader',
      },
    ],
  });

  webpackConfig.module.rules.push({
    test: /\.features$/,
    use: [
      {
        loader: 'cypress-cucumber-preprocessor/lib/featuresLoader',
      },
    ],
  });

  return webpack({
    webpackOptions: webpackConfig,
  });

}

module.exports = (on, config) => {
  on('file:preprocessor', preprocessTypescript(config));
};
0reactions
soujanya1511commented, Mar 1, 2021

we still have this issue while trying to run .feature file in cypress:6.3.0 Can any one please suggest what to do to fix it?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Trouble running .features file with webpack on windows #304
A syntax error in the file or one of its dependencies. Fix the error in your code and re-run your tests. The project...
Read more >
How I solved and debugged my Webpack issue through trial ...
When webpack bundles your source code, it can become difficult to track down errors and warnings to their original location.
Read more >
webpack command not working - node.js - Stack Overflow
The problem with this is that I have to place my webpack.config.js file inside of this directory which I want to place in...
Read more >
Installation | webpack
This guide goes through the various methods used to install webpack. Prerequisites. Before we begin, make sure you have a fresh version of...
Read more >
file-loader - webpack - JS.ORG
Since file-loader is applied when compiling the application, and not when running it, the environment variable cannot be used in the file-loader configuration....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found