Skip to content

Console error when testing: Could not parse CSS stylesheet #42

@ninoeilQc

Description

@ninoeilQc

When running Angular tests, triggering the open state of the context menu via a DOM click event results in the following console error:

console.error
    Error: Could not parse CSS stylesheet

This error does not impact the outcome of the test, but it clutters the console output.

The test is importing ContextMenuModule, and no ContextMenuService is explicitly injected since the template handles it directly.

Steps to Reproduce

  1. Import ContextMenuModule into the test.
  2. Trigger a DOM click event to open the context menu component.
  3. Observe the console output.

Expected Behavior
No console errors should appear during test execution.

Actual Behavior
Console logs the error:

text
Error: Could not parse CSS stylesheet

Environment

Angular: 18

Library version: 18

Test runner: Jest 29.7.0

Browser/Test Environment: Headless

Additional Context
This looks like a style parsing issue during tests. The error itself doesn’t affect functionality but adds noise to test results.

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