Skip to content

Browser mode: 'X-Frame-Options': 'DENY' breaks tests #5789

@IanVS

Description

@IanVS

Describe the bug

I try to set up my vite headers as close to production as possible, and therefore set CSP headers, including 'X-Frame-Options': 'DENY',. However, this breaks vitest in browser mode, which apparently runs tests inside an iframe.

Reproduction

https://github.com/IanVS/reproduction-vitest-browser-frame

System Info

System:
    OS: macOS 14.4.1
    CPU: (12) arm64 Apple M2 Max
    Memory: 294.08 MB / 64.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.16.0 - ~/Library/Caches/fnm_multishells/15320_1716989283011/bin/node
    Yarn: 1.22.19 - ~/Library/Caches/fnm_multishells/15320_1716989283011/bin/yarn
    npm: 9.5.1 - ~/Library/Caches/fnm_multishells/15320_1716989283011/bin/npm
    pnpm: 8.8.0 - ~/Library/Caches/fnm_multishells/15320_1716989283011/bin/pnpm
  Browsers:
    Safari: 17.4.1
  npmPackages:
    @vitest/browser: ^1.6.0 => 1.6.0
    @vitest/ui: latest => 1.6.0
    vite: latest => 5.2.12
    vitest: latest => 1.6.0

Used Package Manager

pnpm

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat: browserIssues and PRs related to the browser runnerp3-minor-bugAn edge case that only affects very specific usage (priority)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions