Balrog994 / cucumber-test-runner

An Extension for Visual Studio Code to Run and Debug CucumberJS Tests
MIT License
5 stars 8 forks source link

Error: You're calling functions (e.g. "Given") on an instance of Cucumber that isn't running. #16

Open apazureck opened 11 months ago

apazureck commented 11 months ago

Hi,

I have a problem using the plugin in my project. I get this error message:

Error: You're calling functions (e.g. "Given") on an instance of Cucumber that isn't running.
This means you have an invalid installation, mostly likely due to:
- Cucumber being installed globally
- A project structure where your support code is depending on a different instance of Cucumber
Either way, you'll need to address this in order for Cucumber to work.
See https://github.com/cucumber/cucumber-js/blob/main/docs/installation.md#invalid-installations

When I run cucumber-js from the console using "npx cucumber-js" with the same args, it works. Also when running the node command the test runner is running is executed in the console, it works.

Though, when I try to run "npx cucumber-js" in the test runner code (replaced it in the spawn) it also fails with the same error message as above.

I don't know what is missing. I checked dependencies and cucumber is installed locally only.

Balrog994 commented 11 months ago

Hi @apazureck ,

thanks for your feedback, I had the same problem trying to solve another bug, looks like the problem is due to a version mismatch between the cucumber-js version used by the test runner and the cucumber-js version you're using in your project.

It actually is a bug in cucumber test runner, I'm working on it but due to work and private life I have not a lot of time, so the fix will be a little late.

As a temporary workaround (if possible) you may try to downgrade your cucumber-js version to 8.10.0 and check if that fixes the problem.

apazureck commented 11 months ago

Hi,

Thanks for the quick reply. Do you have a branch open for that? maybe I can fork it and see how far I can get. But its the same with me: so much to do, so little time :)

Balrog994 commented 11 months ago

Hi @apazureck ,

sorry for the late reply, there is no active branch for that change, you can fork the main branch and work from there, some help would be much appreciated 😄

Thanks

IlyaStrijakov commented 6 months ago

Hello all. Has this bug discussed above been fixed? I am running into the same issue. Tried downgrading cucumber version to 8.10.0. Still no go for me.((((( My dependancies: { "name": "ads-automation", "version": "1.0.0", "description": "This README would normally document whatever steps are necessary to get your application up and running.", "main": "index.js", "type": "module", "scripts": { "test": "wdio run wdio.conf.js", "allure": "allure generate allure-results --clean && allure open", "parkedDomains": "npx wdio run ./wdio.conf.js --spec parkedDomains && allure generate allure-results --clean", "local-test": "npx wdio run ./wdio.conf.local.js", "lint": "./node_modules/.bin/eslint --ignore-path .gitignore . --fix", "lint-staged": "lint-staged || (npm run pop-stash >> /dev/null && exit 1)", "stash-unstaged": "git stash save -k 'pre-linting-stash' >> /dev/null", "pop-stash": "git stash && git stash pop stash@{1} && git read-tree stash && git stash drop" }, "overrides": { "semver": "~7.5.3", "tough-cookie": "~4.1.3", "lint": "^0.8.19", "lighthouse": "~9.5.0", "@cucumber/cucumber": "^8.10.0" }, "husky": { "hooks": { "pre-commit": "npm run stash-unstaged && npm run lint-staged && npm run pop-stash", "prepare-commit-msg": "jira-prepare-commit-msg" } }, "lint-staged": { "src/*/.{js, json}": [ "eslint --fix" ] }, "jira-prepare-commit-msg": { "messagePattern": "[$J] - $M" }, "author": "", "license": "ISC", "dependencies": { "allure-commandline": "^2.28.0", "devtools": "^8.35.1", "dotenv": "^16.4.5", "eslint": "^9.0.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-prettier": "^5.1.3", "eslint-plugin-wdio": "^8.24.12", "husky": "^9.0.11", "jira-prepare-commit-msg": "^1.7.2", "lint-staged": "^15.2.2", "lodash": "^4.17.21", "prettier": "^3.2.5" }, "devDependencies": { "@cucumber/cucumber": "^8.10.0", "@wdio/allure-reporter": "^8.34.0", "@wdio/cli": "^8.36.0", "@wdio/cucumber-framework": "^8.36.0", "@wdio/devtools-service": "^8.35.1", "@wdio/local-runner": "^8.35.1", "@wdio/spec-reporter": "^8.32.4", "allure-cucumberjs": "^2.15.1", "chai": "^5.1.0", "chromedriver": "123.0.0", "wdio-chromedriver-service": "8.1.1", "wdio-intercept-service": "^4.4.1" } }

IlyaStrijakov commented 6 months ago

Issue was resolved by running why command and matching whatever versions of the output. https://github.com/cucumber/cucumber-js/blob/main/docs/installation.md#invalid-installations