Skip to content

[Regression]: 1.42.0 breaks some @import statements #29731

@Exoow

Description

@Exoow

Last good version

1.41.2

Bad Version

1.42.0

Steps to reproduce

(No minimal project as it happens in our huge monorepo with tsconfig/project config files for test projects)

tsconfig.json file has shorthand for imports

"paths": {
      "@fe-service/util-playwright": ["libs/util-playwright/src/index.ts"],
      "@entities/*": ["./apps/fe-service-app-component-test/entities/*"],
      "@helpers/*": ["./apps/fe-service-app-component-test/helpers/*"],
      "@mock-responses/*": ["./apps/fe-service-app-component-test/mock-responses/*"],
      "@page-objects/*": ["./apps/fe-service-app-component-test/page-objects/*"]
    }

test file imports:

import {expect} from '@playwright/test';
import TestHelper from '@helpers/test-helper';
import {test} from '../../fixtures';
import WorkListResponseBuilder from '@helpers/work-list-builder';
import {worklistSetup} from '@helpers/before-tests-module';

Running the test project results in errors (see actual behavior below)

Expected behavior

Tests keep working as with previous version

Actual behavior

I get several errors like the one below. If I update the import to the default "../../../" notation then it works again.

  1 | import {expect} from '@playwright/test';
  2 | import TestHelper from '@helpers/test-helper';
  3 | import {test} from '../../fixtures';
  4 | import WorkListResponseBuilder from '@helpers/work-list-builder';
  5 | import {worklistSetup} from '@helpers/before-tests-module';

    at Object.<anonymous> (C:\repos\fe-service\apps\fe-service-app-component-test\tests\worklist\other-actions.spec.ts:2:1)
Error: Cannot find module '@helpers/test-helper'
Require stack:
- C:\repos\fe-service\apps\fe-service-app-component-test\tests\worklist\recorder-actions.spec.ts
- C:\repos\fe-service\node_modules\playwright\lib\transform\transform.js
- C:\repos\fe-service\node_modules\playwright\lib\common\config.js
- C:\repos\fe-service\node_modules\playwright\lib\reporters\html.js
- C:\repos\fe-service\node_modules\playwright\lib\runner\reporters.js
- C:\repos\fe-service\node_modules\playwright\lib\runner\runner.js
- C:\repos\fe-service\node_modules\playwright\lib\program.js
- C:\repos\fe-service\node_modules\@playwright\test\cli.js

Additional context

No response

Environment

System:
    OS: Windows 10 10.0.19045
    CPU: (20) x64 13th Gen Intel(R) Core(TM) i9-13900H
    Memory: 39.25 GB / 63.66 GB
  Binaries:
    Node: 20.11.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.4.0 - C:\Program Files\nodejs\npm.CMD
  IDEs:
    VSCode: 1.87.0 - C:\Program Files\Microsoft VS Code\bin\code.CMD
  npmPackages:
    @playwright/test: 1.42.0 => 1.42.0

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