queryAllByRole(‘checkbox’) works different depending on environment

I have a vitest test that uses expect(screen.queryAllByRole('checkbox').length).toBeGreaterThan(0)

Running in the Webstorm test runner, the test passes. Running via nx in the terminal (and in CI) fails:
nx run @member/all-products:validate:tests

Here is the project.json for the @member/all-products

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>"validate:tests": {
"executor": "@nx/vite:test",
"options": {
"configFile": "{projectRoot}/vite.config.mts"
}
},
</code>
<code>"validate:tests": { "executor": "@nx/vite:test", "options": { "configFile": "{projectRoot}/vite.config.mts" } }, </code>
"validate:tests": {
  "executor": "@nx/vite:test",
  "options": {
    "configFile": "{projectRoot}/vite.config.mts"
  }
},

Where that config file is simply

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>export default vite.makeConfig({
name: '@member/all-products',
pathToRepoRoot: '../../../',
projectDir: __dirname,
})
</code>
<code>export default vite.makeConfig({ name: '@member/all-products', pathToRepoRoot: '../../../', projectDir: __dirname, }) </code>
export default vite.makeConfig({
  name: '@member/all-products',
  pathToRepoRoot: '../../../',
  projectDir: __dirname,
})

Why is it failing in the terminal and passing in Webstorm?

FWIW the test failure output definitely includes checkboxes!

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code> <label
class="Checkbox_root__rm3qrv1 Checkbox__rm3qrv0 sprinkles_display_inlineFlex_mobile__1xrw3huey sprinkles_alignItems_flexStart_mobile__1xrw3hue2 sprinkles_flexDirection_row_mobile__1xrw3hufa sprinkles_cursor_pointer_default__1xrw3hud6 Checkbox_variants_interface__rm3qrv5 typography_Body2_Bold__185e4nvs typography_BodySpacing__185e4nv1 typography_Lato_Bold__185e4nvb typography_LatoBase__185e4nva typography_overflowWrap__185e4nv9"
for="all-products-desktop-filters-price-On Sale"
type="checkbox"
>
<input
class="Checkbox_input__rm3qrv9 Checkbox__rm3qrv8 sprinkles_position_absolute_mobile__1xrw3hunu sprinkles_zIndex_z-1__1xrw3hu2o"
id="all-products-desktop-filters-price-On Sale"
name="price"
type="checkbox"
value="On Sale"
/>
<span
</code>
<code> <label class="Checkbox_root__rm3qrv1 Checkbox__rm3qrv0 sprinkles_display_inlineFlex_mobile__1xrw3huey sprinkles_alignItems_flexStart_mobile__1xrw3hue2 sprinkles_flexDirection_row_mobile__1xrw3hufa sprinkles_cursor_pointer_default__1xrw3hud6 Checkbox_variants_interface__rm3qrv5 typography_Body2_Bold__185e4nvs typography_BodySpacing__185e4nv1 typography_Lato_Bold__185e4nvb typography_LatoBase__185e4nva typography_overflowWrap__185e4nv9" for="all-products-desktop-filters-price-On Sale" type="checkbox" > <input class="Checkbox_input__rm3qrv9 Checkbox__rm3qrv8 sprinkles_position_absolute_mobile__1xrw3hunu sprinkles_zIndex_z-1__1xrw3hu2o" id="all-products-desktop-filters-price-On Sale" name="price" type="checkbox" value="On Sale" /> <span </code>
                    <label
                      class="Checkbox_root__rm3qrv1 Checkbox__rm3qrv0 sprinkles_display_inlineFlex_mobile__1xrw3huey sprinkles_alignItems_flexStart_mobile__1xrw3hue2 sprinkles_flexDirection_row_mobile__1xrw3hufa sprinkles_cursor_pointer_default__1xrw3hud6 Checkbox_variants_interface__rm3qrv5 typography_Body2_Bold__185e4nvs typography_BodySpacing__185e4nv1 typography_Lato_Bold__185e4nvb typography_LatoBase__185e4nva typography_overflowWrap__185e4nv9"
                      for="all-products-desktop-filters-price-On Sale"
                      type="checkbox"
                    >
                      <input
                        class="Checkbox_input__rm3qrv9 Checkbox__rm3qrv8 sprinkles_position_absolute_mobile__1xrw3hunu sprinkles_zIndex_z-1__1xrw3hu2o"
                        id="all-products-desktop-filters-price-On Sale"
                        name="price"
                        type="checkbox"
                        value="On Sale"
                      />
                      <span

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật