Skip to content

Cannot run any Playwright test #13092

@ckmoga

Description

@ckmoga

Context:

  • Playwright Version: 1.20.1
  • Operating System: Windows 10
  • Node.js version: 16.13.0]
  • Browser: All
  • Extra:

Describe the bug

A fresh installation of Playwright and attempting to run example spec produces this error:

$ npx playwright test

Running 0 test using 0 worker


Error: tests\example.spec.ts:5:12: Playwright Test did not expect test.beforeEach() to be called here.
Most common reasons include:
- You are calling test.beforeEach() in a configuration file.
- You are calling test.beforeEach() in a file that is imported by the configuration file.
- You have two different versions of @playwright/test. This usually happens
  when one of the dependenices in your package.json depends on @playwright/test.

   at ..\node_modules\@playwright\test\lib\util.js:198

  196 |
  197 | function errorWithLocation(location, message) {
> 198 |   return new Error(`${formatLocation(location)}: ${message}`);
      |          ^
  199 | }
  200 |
  201 | function expectType(receiver, type, matcherName) {

    at errorWithLocation (C:\projects\virtonomy\web_platform_main\e2e\node_modules\@playwright\test\lib\util.js:198:10)
    at TestTypeImpl._ensureCurrentSuite (C:\projects\virtonomy\web_platform_main\e2e\node_modules\@playwright\test\lib\testType.js:78:41)
    at TestTypeImpl._hook (C:\projects\virtonomy\web_platform_main\e2e\node_modules\@playwright\test\lib\testType.js:129:24)
    at Function.beforeEach (C:\projects\virtonomy\web_platform_main\e2e\node_modules\@playwright\test\lib\transform.js:253:12)
    at Object.<anonymous> (C:\projects\virtonomy\web_platform_main\e2e\tests\example.spec.ts:5:12)
    at Module._compile (C:\Projects\virtonomy\web_platform_main\e2e\node_modules\pirates\lib\index.js:136:24)
    at Object.newLoader (C:\Projects\virtonomy\web_platform_main\e2e\node_modules\pirates\lib\index.js:141:7)

=================
 no tests found.

To open last HTML report run:

  npx playwright show-report

package.json

{
  "name": "e2e",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {},
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@playwright/test": "^1.20.1"
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions