cypress-cucumber-preprocessor includes templates which generates application code that imports gherkin, e.g.
const createCucumber = (spec, toRequire) =>
`
...
const {Parser, Compiler} = require('gherkin');
...
`;
Normally, this is not a problem when using popular package managers like
npm / yarn because 'gherkin' is a direct
dependency of cypress-cucumber-preprocessor, which is hoisted to the root
node_modules folder, enabling it to be found by webpack / node:
node_modules/
gherkin/
...
cypress-cucumber-preprocessor
But when using strict package managers such as pnpm (or yarn pnp),
gherkin cannot be resolved because it can only be resolved
by code inside the cypress-cucumber-preprocessor package:
node_modules/
cypress-cucumber-preprocessor
...
node_modules/
gherkin/
...
Solution:
similar issues:
Oh, interesting...
But won't that mean that the plugin will stop working (with an ugly error) for all the existing users that decide to upgrade? If you install gherkin manually in your top level repo, will it work?
@lgandecki yes :( a breaking change. Installing it manually works in your top level repo, a peer dependancy :)
hmm... So how about we add information to the documentation that if you use strict package manager you should add gherkin to your dependencies manually? I think we should make it the smoothest experience for the majority of users.. not the other way around.
@lgandecki That's fine. 馃憤
This was fixed in #191:
https://github.com/TheBrainFamily/cypress-cucumber-preprocessor/pull/191/files#diff-7c7d4918b118d27d18538f53b8155e88L19
The require('gherkin') expression no longer exists in the template, so this dependency hoisting problem is gone.
Most helpful comment
This was fixed in #191:
https://github.com/TheBrainFamily/cypress-cucumber-preprocessor/pull/191/files#diff-7c7d4918b118d27d18538f53b8155e88L19
The
require('gherkin')expression no longer exists in the template, so this dependency hoisting problem is gone.