playwright-bdd
playwright-bdd copied to clipboard
Bug: Error: Requiring @playwright/test second time
Given playwright.config.ts:
import { defineConfig, devices } from '@playwright/test';
import { defineBddConfig } from 'playwright-bdd';
const port = 8080;
const baseURL = `http://localhost:${port}`;
const testDir = defineBddConfig({
paths: ['playwright/features/**/*.{feature,features}'],
require: ['playwright/steps/**/*.*'],
});
/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 1,
/* Opt out of parallel tests on CI. */
fullyParallel: true,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL,
headless: true,
trace: 'on-first-retry',
},
workers: 7,
/* Playwright propose a intern server, it will be launched when the test start */
webServer: {
command: 'npm run start',
port,
reuseExistingServer: !process.env.CI,
timeout: 10 * 60 * 1000,
},
timeout: 5 * 60 * 1000,
expect: {
timeout: 2 * 60 * 1000,
},
/* Configure projects for major browsers */
projects: [
{
name: 'chromium',
use: {
...devices['Desktop Chrome'],
},
},
{
name: 'firefox',
use: {
...devices['Desktop Firefox'],
},
},
{
name: 'webkit',
use: {
...devices['Desktop Safari'],
},
},
],
});
When I try to run/debug tests in Visual Code with the "Playwright Test for VSCode" extension
Then If I run in debug mode, it stops with this first error (then there are others if I continue):
Exception has occurred: Error
at _A (C:\Users\xxxxxx\node_modules\playwright\lib\transform\babelBundleImpl.js:37:3587)
at Function.statement (C:\Users\xxxxxx\node_modules\playwright\lib\transform\babelBundleImpl.js:37:2847)
at C:\Users\xxxxxx\node_modules\playwright\lib\transform\babelBundleImpl.js:41:1113
at C:\Users\xxxxxx\node_modules\playwright\lib\transform\babelBundleImpl.js:1:222
at C:\Users\xxxxxx\node_modules\playwright\lib\transform\babelBundleImpl.js:65:1678
at C:\Users\xxxxxx\node_modules\playwright\lib\transform\babelBundleImpl.js:1:222
at C:\Users\xxxxxx\node_modules\playwright\lib\transform\babelBundleImpl.js:65:38013
at C:\Users\xxxxxx\node_modules\playwright\lib\transform\babelBundleImpl.js:1:222
at C:\Users\xxxxxx\node_modules\playwright\lib\transform\babelBundleImpl.js:65:40602
at C:\Users\xxxxxx\node_modules\playwright\lib\transform\babelBundleImpl.js:1:222
and in the end, I get this error in the test results console:
Error: Requiring @playwright/test second time,
First:
Error:
at Object.<anonymous> (c:\Users\xxxxxx\node_modules\playwright\lib\index.js:77:33)
at Module._compile (node:internal/modules/cjs/loader:1356:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
at Object.i.<computed>.ut._extensions.<computed> [as .js] (c:\Users\xxxxxx\node_modules\playwright\lib\utilsBundleImpl.js:16:1010)
at Module.load (node:internal/modules/cjs/loader:1197:32)
at Function.Module._load (node:internal/modules/cjs/loader:1013:12)
at Module.require (node:internal/modules/cjs/loader:1225:19)
at require (node:internal/modules/helpers:177:18)
at Object.<anonymous> (c:\Users\xxxxxx\node_modules\playwright\test.js:17:13)
at Module._compile (node:internal/modules/cjs/loader:1356:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
at Object.i.<computed>.ut._extensions.<computed> [as .js] (c:\Users\xxxxxx\node_modules\playwright\lib\utilsBundleImpl.js:16:1010)
at Module.load (node:internal/modules/cjs/loader:1197:32)
at Function.Module._load (node:internal/modules/cjs/loader:1013:12)
at Module.require (node:internal/modules/cjs/loader:1225:19)
at require (node:internal/modules/helpers:177:18)
at Object.<anonymous> (c:\Users\xxxxxx\node_modules@playwright\test\index.js:17:18)
at Module._compile (node:internal/modules/cjs/loader:1356:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
at Object.i.<computed>.ut._extensions.<computed> [as .js] (c:\Users\xxxxxx\node_modules\playwright\lib\utilsBundleImpl.js:16:1010)
at Module.load (node:internal/modules/cjs/loader:1197:32)
at Function.Module._load (node:internal/modules/cjs/loader:1013:12)
at Module.require (node:internal/modules/cjs/loader:1225:19)
at require (node:internal/modules/helpers:177:18)
at Object.<anonymous> (c:\Users\xxxxxx\playwright.config.ts:1:1)
at Module._compile (node:internal/modules/cjs/loader:1356:14)
at Module.f._compile (c:\Users\xxxxxx\node_modules\playwright\lib\utilsBundleImpl.js:16:994)
at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
at Object.i.<computed>.ut._extensions.<computed> [as .ts] (c:\Users\xxxxxx\node_modules\playwright\lib\utilsBundleImpl.js:16:1010)
at Module.load (node:internal/modules/cjs/loader:1197:32)
at Function.Module._load (node:internal/modules/cjs/loader:1013:12)
at Module.require (node:internal/modules/cjs/loader:1225:19)
at require (node:internal/modules/helpers:177:18)
at requireOrImport (c:\Users\xxxxxx\node_modules\playwright\lib\transform\transform.js:182:20)
at requireOrImportDefaultObject (c:\Users\xxxxxx\node_modules\playwright\lib\common\configLoader.js:126:53)
at ConfigLoader.loadConfigFile (c:\Users\xxxxxx\node_modules\playwright\lib\common\configLoader.js:99:26)
at Function.deserialize (c:\Users\xxxxxx\node_modules\playwright\lib\common\configLoader.js:93:51)
at WorkerMain._loadIfNeeded (c:\Users\xxxxxx\node_modules\playwright\lib\worker\workerMain.js:178:53)
at WorkerMain.runTestGroup (c:\Users\xxxxxx\node_modules\playwright\lib\worker\workerMain.js:187:18)
at process.<anonymous> (c:\Users\xxxxxx\node_modules\playwright\lib\common\process.js:96:49)
at process.emit (node:events:517:28)
at emit (node:internal/child_process:944:14)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Second:
at Object.<anonymous> (c:\Users\xxxxxx\node_modules\@playwright\test\index.js:17:18)
at Object.<anonymous> (c:\Users\xxxxxx\playwright.config.ts:1:1)
at Object.<anonymous> (C:\Users\xxxxxx\node_modules\playwright\lib\index.js:72:11)
at Object.<anonymous> (C:\Users\xxxxxx\node_modules\playwright\test.js:17:13)
at Object.<anonymous> (C:\Users\xxxxxx\node_modules\@playwright\test\index.js:17:18)
at Object.<anonymous> (C:\Users\xxxxxx\node_modules\playwright-bdd\src\run\bddFixtures.ts:1:1)
at Object.<anonymous> (C:\Users\xxxxxx\node_modules\playwright-bdd\src\stepDefinitions\createBdd.ts:15:1)
at Object.<anonymous> (C:\Users\xxxxxx\node_modules\playwright-bdd\src\index.ts:2:1)
at Object.<anonymous> (C:\Users\xxxxxx\playwright\steps\acquisition.steps.ts:1:1)
at tryRequire (c:\Users\xxxxxx\node_modules\@cucumber\cucumber\src\try_require.ts:9:12)
at node_modules\@cucumber\cucumber\src\api\support.ts:27:40
at getSupportCodeLibrary (c:\Users\xxxxxx\node_modules\@cucumber\cucumber\src\api\support.ts:27:16)
at loadSupport (c:\Users\xxxxxx\node_modules\@cucumber\cucumber\src\api\load_support.ts:35:57)
But I expect test to run/debug.
Note that the tests are running fine with npx bddgen && npx playwright test.
Isolated demo Hard to make a demo since tests are included in a web react project that I cannot share easily. But I will try if really needed at one point.
Environment
Playwright-bdd environment info:
platform: win32
node: v18.19.0
playwright-bdd: v5.7.1
@playwright/test: v1.41.2
@cucumber/cucumber: v10.3.1
Playwright config file: playwright.config.ts
Thanks for sharing this, I will check.
Hi @vitalets Did you have a chance to check ?
Hi @vitalets Did you have a chance to check ?
Hi @phramusca
Tried to reproduce this on osx with exactly the same versions, but it works.
Could you try to remove node_modules, run npm install and then try again?
And re-try with the latest Playwright (1.42) and playwright-bdd (5.8)?
I've come across this issue where I have two choices:
- My VSCode complains it can't find the datatable import from the cucumber package when I only have cucumber installed as a peer dependency but in reality it all runs fine and I just put up with a file being red.
- I add cucumber as a dev dependency, the file errors in the file go away but then I can't take advantage of the playwright VSCode plugin
- My VSCode complains it can't find the datatable import from the cucumber package when I only have cucumber installed as a peer dependency but in reality it all runs fine and I just put up with a file being red.
Is it TypeScript error or Node.js runtime error? Could you share the full message?
- I add cucumber as a dev dependency, the file errors in the file go away but then I can't take advantage of the playwright VSCode plugin
After installing Cucumber you are getting Requiring @playwright/test second time error, right? Could you please clone playwright-bdd-example and run it in your VSCode?
Confirming also receiving this issue. Running via a command line and no issue exists, whilst trying to run individual tests in the IDE to debug, the error appears.
package.json
{
"name": "playwright-bdd-2",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@playwright/test": "^1.42.1",
"@types/node": "^20.11.28",
"playwright-bdd": "^6.0.1"
},
"dependencies": {
"allure-commandline": "^2.27.0",
"allure-playwright": "^2.14.1",
"cucumber": "^6.0.7",
"dotenv": "^16.4.5"
}
}
Error:
Error: Requiring @playwright/test second time,
First:
Error:
at Object.<anonymous> (c:\Playwright BDD 2\node_modules\playwright\lib\index.js:69:33)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Object.i.<computed>.ut._extensions.<computed> [as .js] (c:\Playwright BDD 2\node_modules\playwright\lib\utilsBundleImpl.js:16:1010)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Function.Module._load (node:internal/modules/cjs/loader:958:12)
at Module.require (node:internal/modules/cjs/loader:1141:19)
at require (node:internal/modules/cjs/helpers:110:18)
at Object.<anonymous> (c:\Playwright BDD 2\node_modules\playwright\test.js:17:13)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Object.i.<computed>.ut._extensions.<computed> [as .js] (c:\Playwright BDD 2\node_modules\playwright\lib\utilsBundleImpl.js:16:1010)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Function.Module._load (node:internal/modules/cjs/loader:958:12)
at Module.require (node:internal/modules/cjs/loader:1141:19)
at require (node:internal/modules/cjs/helpers:110:18)
at Object.<anonymous> (c:\Playwright BDD 2\node_modules@playwright\test\index.js:17:18)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Object.i.<computed>.ut._extensions.<computed> [as .js] (c:\Playwright BDD 2\node_modules\playwright\lib\utilsBundleImpl.js:16:1010)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Function.Module._load (node:internal/modules/cjs/loader:958:12)
at Module.require (node:internal/modules/cjs/loader:1141:19)
at require (node:internal/modules/cjs/helpers:110:18)
at Object.<anonymous> (c:\Playwright BDD 2\playwright.config.ts:8:1)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Module.f._compile (c:\Playwright BDD 2\node_modules\playwright\lib\utilsBundleImpl.js:16:994)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Object.i.<computed>.ut._extensions.<computed> [as .ts] (c:\Playwright BDD 2\node_modules\playwright\lib\utilsBundleImpl.js:16:1010)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Function.Module._load (node:internal/modules/cjs/loader:958:12)
at Module.require (node:internal/modules/cjs/loader:1141:19)
at require (node:internal/modules/cjs/helpers:110:18)
at requireOrImport (c:\Playwright BDD 2\node_modules\playwright\lib\transform\transform.js:193:20)
at loadUserConfig (c:\Playwright BDD 2\node_modules\playwright\lib\common\configLoader.js:96:83)
at loadConfig (c:\Playwright BDD 2\node_modules\playwright\lib\common\configLoader.js:101:28)
at deserializeConfig (c:\Playwright BDD 2\node_modules\playwright\lib\common\configLoader.js:91:24)
at WorkerMain._loadIfNeeded (c:\Playwright BDD 2\node_modules\playwright\lib\worker\workerMain.js:188:62)
at WorkerMain.runTestGroup (c:\Playwright BDD 2\node_modules\playwright\lib\worker\workerMain.js:197:18)
at process.<anonymous> (c:\Playwright BDD 2\node_modules\playwright\lib\common\process.js:96:49)
at process.emit (node:events:513:28)
at emit (node:internal/child_process:937:14)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Second:
at Object.<anonymous> (c:\Playwright BDD 2\node_modules\@playwright\test\index.js:17:18)
at Object.<anonymous> (c:\Playwright BDD 2\playwright.config.ts:8:1)
at Object.<anonymous> (C:\Playwright BDD 2\node_modules\playwright\lib\index.js:64:11)
at Object.<anonymous> (C:\Playwright BDD 2\node_modules\playwright\test.js:17:13)
at Object.<anonymous> (C:\Playwright BDD 2\node_modules\@playwright\test\index.js:17:18)
at Object.<anonymous> (C:\Playwright BDD 2\node_modules\playwright-bdd\src\run\bddFixtures.ts:1:1)
at Object.<anonymous> (C:\Playwright BDD 2\node_modules\playwright-bdd\src\stepDefinitions\createBdd.ts:15:1)
at Object.<anonymous> (C:\Playwright BDD 2\node_modules\playwright-bdd\src\index.ts:2:1)
at Object.<anonymous> (C:\Playwright BDD 2\steps\homePage.ts:2:1)
at tryRequire (c:\Playwright BDD 2\node_modules\@cucumber\cucumber\src\try_require.ts:9:12)
at node_modules\@cucumber\cucumber\src\api\support.ts:27:40
at getSupportCodeLibrary (c:\Playwright BDD 2\node_modules\@cucumber\cucumber\src\api\support.ts:27:16)
at loadSupport (c:\Playwright BDD 2\node_modules\@cucumber\cucumber\src\api\load_support.ts:35:57)
Just a TypeScript error on the import:
After installing Cucumber into the example project and running the test from the VSCode extention I can replicate the issue:
Side note: make sure you click the refresh icon in the extension once you've run bddgen
@AdamJS123 @adamwood-novafori thanks, trying to reproduce.
@AdamJS123 @adamwood-novafori could you clone playwright-bdd-example and try to reproduce this issue on it?
The last screenshot in my previous message is from the example project: Steps to reproduce:
- Open project
- npm i
- npm i -D @cucumber/cucumber
- bddgen
- Install the VS Code Playwright extension
- Click the small refresh button in the extension if the generated tests haven't been detected yet
- Then expand the tree of detected tests and click on the play button to execute a test from within the extension
- You should then see the message
Hope this helps
Same issue with the steps above. Unable to execute the test from the test runner.
@JHGould5607 could you also share error stack with paths of requiring Playwright?
I made some experiments: when I copy (overwrite) all files from "playwright-bdd\examples\decorators" - repo to the "playwright-bdd-example" - all works as expected, I'm able to run test both from VSC Test Explorer and from command line.
How I install the example Windows PowerShell Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.
PS C:\rep\playwright-bdd-example> npm install
added 293 packages, and audited 294 packages in 10s
81 packages are looking for funding
run npm fund for details
found 0 vulnerabilities PS C:\rep\playwright-bdd-example> npx playwright install PS C:\rep\playwright-bdd-example> npm test
[email protected] test npx bddgen && npx playwright test
Running 1 test using 1 worker 1 passed (4.7s) PS C:\rep\playwright-bdd-example> npm run report npm ERR! Missing script: "report" npm ERR! npm ERR! Did you mean this? npm ERR! npm repo # Open package repository page in the browser npm ERR! npm ERR! To see a list of scripts, run: npm ERR! npm run
npm ERR! A complete log of this run can be found in: C:\Users\grzpav04\AppData\Local\npm-cache_logs\2024-04-08T10_48_25_198Z-debug-0.log PS C:\rep\playwright-bdd-example>
When I run test in MS VSC using Test Explorer I got following output:
Running 1 test using 1 worker
- [chromium] › features\homepage.feature.spec.js:6:7 › Playwright Home Page › Check title ───────
Error: Requiring @playwright/test second time,
First:
Error:
at ..\playwright.config.ts:1
> 1 | import { defineConfig, devices } from '@playwright/test';
| ^
2 | import { defineBddConfig, cucumberReporter } from 'playwright-bdd';
3 |
4 | const testDir = defineBddConfig({
at Object.<anonymous> (c:\rep\playwright-bdd-example\node_modules\playwright\lib\index.js:69:33)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Object.i.<computed>.ut._extensions.<computed> [as .js] (c:\rep\playwright-bdd-example\node_modules\playwright\lib\utilsBundleImpl.js:16:1010)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Function.Module._load (node:internal/modules/cjs/loader:960:12)
at Module.require (node:internal/modules/cjs/loader:1143:19)
at require (node:internal/modules/cjs/helpers:119:18)
at Object.<anonymous> (c:\rep\playwright-bdd-example\node_modules\playwright\test.js:17:13)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Object.i.<computed>.ut._extensions.<computed> [as .js] (c:\rep\playwright-bdd-example\node_modules\playwright\lib\utilsBundleImpl.js:16:1010)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Function.Module._load (node:internal/modules/cjs/loader:960:12)
at Module.require (node:internal/modules/cjs/loader:1143:19)
at require (node:internal/modules/cjs/helpers:119:18)
at Object.<anonymous> (c:\rep\playwright-bdd-example\node_modules\@playwright\test\index.js:17:18)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Object.i.<computed>.ut._extensions.<computed> [as .js] (c:\rep\playwright-bdd-example\node_modules\playwright\lib\utilsBundleImpl.js:16:1010)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Function.Module._load (node:internal/modules/cjs/loader:960:12)
at Module.require (node:internal/modules/cjs/loader:1143:19)
at require (node:internal/modules/cjs/helpers:119:18)
at Object.<anonymous> (c:\rep\playwright-bdd-example\playwright.config.ts:1:1)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module.f._compile (c:\rep\playwright-bdd-example\node_modules\playwright\lib\utilsBundleImpl.js:16:994)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Object.i.<computed>.ut._extensions.<computed> [as .ts] (c:\rep\playwright-bdd-example\node_modules\playwright\lib\utilsBundleImpl.js:16:1010)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Function.Module._load (node:internal/modules/cjs/loader:960:12)
at Module.require (node:internal/modules/cjs/loader:1143:19)
at require (node:internal/modules/cjs/helpers:119:18)
at requireOrImport (c:\rep\playwright-bdd-example\node_modules\playwright\lib\transform\transform.js:193:20)
at loadUserConfig (c:\rep\playwright-bdd-example\node_modules\playwright\lib\common\configLoader.js:96:83)
at loadConfig (c:\rep\playwright-bdd-example\node_modules\playwright\lib\common\configLoader.js:101:28)
at deserializeConfig (c:\rep\playwright-bdd-example\node_modules\playwright\lib\common\configLoader.js:91:24)
at WorkerMain._loadIfNeeded (c:\rep\playwright-bdd-example\node_modules\playwright\lib\worker\workerMain.js:188:62)
at WorkerMain.runTestGroup (c:\rep\playwright-bdd-example\node_modules\playwright\lib\worker\workerMain.js:197:18)
at process.<anonymous> (c:\rep\playwright-bdd-example\node_modules\playwright\lib\common\process.js:96:49)
at process.emit (node:events:517:28)
at emit (node:internal/child_process:944:14)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Second:
at Object.<anonymous> (c:\rep\playwright-bdd-example\node_modules\@playwright\test\index.js:17:18)
at Object.<anonymous> (c:\rep\playwright-bdd-example\playwright.config.ts:1:1)
at Object.<anonymous> (C:\rep\playwright-bdd-example\node_modules\playwright\lib\index.js:64:11)
at Object.<anonymous> (C:\rep\playwright-bdd-example\node_modules\playwright\test.js:17:13)
at Object.<anonymous> (C:\rep\playwright-bdd-example\node_modules\@playwright\test\index.js:17:18)
at Object.<anonymous> (C:\rep\playwright-bdd-example\node_modules\playwright-bdd\src\run\bddFixtures.ts:1:1)
at Object.<anonymous> (C:\rep\playwright-bdd-example\node_modules\playwright-bdd\src\steps\createBdd.ts:15:1)
at Object.<anonymous> (C:\rep\playwright-bdd-example\node_modules\playwright-bdd\src\index.ts:2:1)
at Object.<anonymous> (C:\rep\playwright-bdd-example\steps\fixtures.ts:1:1)
at tryRequire (c:\rep\playwright-bdd-example\node_modules\@cucumber\cucumber\src\try_require.ts:9:12)
at c:\rep\playwright-bdd-example\node_modules\@cucumber\cucumber\src\api\support.ts:27:40
at getSupportCodeLibrary (c:\rep\playwright-bdd-example\node_modules\@cucumber\cucumber\src\api\support.ts:27:16)
at loadSupport (c:\rep\playwright-bdd-example\node_modules\@cucumber\cucumber\src\api\load_support.ts:35:57)
Error in reporter Error: __bddData annotation is not found for test "Check title".
at TestCaseRun.extractBddData (c:\rep\playwright-bdd-example\node_modules\playwright-bdd\src\reporter\cucumber\messagesBuilder\TestCaseRun.ts:77:13)
at new TestCaseRun (c:\rep\playwright-bdd-example\node_modules\playwright-bdd\src\reporter\cucumber\messagesBuilder\TestCaseRun.ts:53:25)
at MessagesBuilder.onTestEnd (c:\rep\playwright-bdd-example\node_modules\playwright-bdd\src\reporter\cucumber\messagesBuilder\Builder.ts:58:25)
at Object.onTestEnd (c:\rep\playwright-bdd-example\node_modules\playwright-bdd\src\reporter\cucumber\messagesBuilder\index.ts:21:34)
at CucumberReporterAdapter.onTestEnd (c:\rep\playwright-bdd-example\node_modules\playwright-bdd\src\reporter\cucumber\index.ts:56:29)
at ReporterV2Wrapper.onTestEnd (c:\rep\playwright-bdd-example\node_modules\playwright\lib\reporters\reporterV2.js:87:150)
at c:\rep\playwright-bdd-example\node_modules\playwright\lib\reporters\multiplexer.js:47:65
at wrap (c:\rep\playwright-bdd-example\node_modules\playwright\lib\reporters\multiplexer.js:86:5)
at Multiplexer.onTestEnd (c:\rep\playwright-bdd-example\node_modules\playwright\lib\reporters\multiplexer.js:47:45)
at InternalReporter.onTestEnd (c:\rep\playwright-bdd-example\node_modules\playwright\lib\reporters\internalReporter.js:62:20)
at JobDispatcher._reportTestEnd (c:\rep\playwright-bdd-example\node_modules\playwright\lib\runner\dispatcher.js:524:20)
at JobDispatcher._onTestEnd (c:\rep\playwright-bdd-example\node_modules\playwright\lib\runner\dispatcher.js:290:10)
at WorkerHost.emit (node:events:517:28)
at ChildProcess.
I've made some investigation and released v6.3.0 that should possibly fix the issue. Could you try it and share the result?
- Install latest playwright-bdd
npm i -D playwright-bdd@latest
- Change
playwright.config.tsto use newstepsfield instead ofrequire:
const testDir = defineBddConfig({
paths: ['playwright/features/**/*.feature'],
- require: ['playwright/steps/**'],
+ steps: ['playwright/steps/**'],
});
- Run tests as usual via CLI and via VSCode extension
After https://github.com/vitalets/playwright-bdd/issues/136 this issue should gone, b/c there will be single place of requiring Playwright.
This error should gone as since v7 playwright-bdd does not use Cucumber for requiring steps. Feel free to reopen in case of any issues.