Skip to content

Error in absolute file path of component-index.html #27750

Description

@wiegell

Current behavior

This issue tried to solve the resolution of component-index.html:
#26400

However the problem is still present. When setting:

  component: {
    indexHtmlFile: <SOME ABSOLUTE PATH>,
  }

You get an error along the lines of:

ERROR in   Error: Child compilation failed:
  Module not found: Error: Can't resolve 'USERHOME/cypress-example/  someorg/libs/my-standalone-lib/USERHOME/cypress-example/someorg/li  bs/my-standalone-lib/cypress/support/component-index.html' in '/USERHOME/t  rifork/cypress-example/someorg'
  ModuleNotFoundError: Module not found: Error: Can't resolve '/USERHOME/cypress-example/someorg/libs/my-standalone-lib/USERHOME/cypre  ss-example/someorg/libs/my-standalone-lib/cypress/support/component-index.html  ' in '/USERHOME/cypress-example/someorg'

The problem is resolved if instead you use a relative path to the component-index.html:

  component: {
    indexHtmlFile: './cypress/support/component-index.html',
  },

The issue is bad because nx uses an absolute path, so no component testing is working via nx

Desired behavior

No response

Test code to reproduce

Repro:
https://github.com/wiegell/cypress-bug
Run:
yarn nx run my-standalone-lib:component-test

This repro has been made with:

  • Fresh nx repo
  • Generated standalone angular component via nx
  • Generated nx component testing into that lib via nx

Cypress Version

13.1.0, also tried 12.17.4, same problem.

Node version

v18.17.1

Operating System

macos 13.4.1

Debug Logs

gist

Other

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CTIssue related to component testing

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions