[PR #482] [CLOSED] Make jest tests pass again #784

Closed
opened 2026-02-04 18:50:27 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/pelican-dev/panel/pull/482
Author: @rmartinoscar
Created: 7/14/2024
Status: Closed

Base: mainHead: patch-3


📝 Commits (2)

📊 Changes

2 files changed (+23 additions, -1 deletions)

View changed files

📝 .github/workflows/lint.yaml (+22 -0)
📝 jest.config.js (+1 -1)

📄 Description

  • Make jest tests pass again by adding vendor to exclude
  • Add jest to workflow

Before

yarn run test
yarn run v1.22.22
$ jest
 PASS  resources/scripts/lib/formatters.spec.ts
 PASS  resources/scripts/lib/strings.spec.ts
 PASS  resources/scripts/lib/helpers.spec.ts
 PASS  resources/scripts/lib/objects.spec.ts
 FAIL  vendor/livewire/livewire/src/Features/SupportScriptsAndAssets/test.js
  ● Test suite failed to run

    The error below may be caused by using the wrong test environment, see https://jestjs.io/docs/configuration#testenvironment-string.
    Consider using the "jsdom" test environment.
    
    ReferenceError: document is not defined

      1 |
    > 2 | document.querySelector('[dusk="foo"]').textContent = 'evaluated'
        | ^
      3 |

      at Object.<anonymous> (vendor/livewire/livewire/src/Features/SupportScriptsAndAssets/test.js:2:1)
      at TestScheduler.scheduleTests (node_modules/@jest/core/build/TestScheduler.js:317:13)
      at runJest (node_modules/@jest/core/build/runJest.js:407:19)

Test Suites: 1 failed, 4 passed, 5 total
Tests:       46 passed, 46 total
Snapshots:   0 total
Time:        0.655 s, estimated 1 s
Ran all test suites.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

After

yarn run test
yarn run v1.22.22
$ jest
 PASS  resources/scripts/lib/formatters.spec.ts
 PASS  resources/scripts/lib/helpers.spec.ts
 PASS  resources/scripts/lib/strings.spec.ts
 PASS  resources/scripts/lib/objects.spec.ts

Test Suites: 4 passed, 4 total
Tests:       46 passed, 46 total
Snapshots:   0 total
Time:        0.693 s, estimated 1 s
Ran all test suites.
Done in 1.54s.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/pelican-dev/panel/pull/482 **Author:** [@rmartinoscar](https://github.com/rmartinoscar) **Created:** 7/14/2024 **Status:** ❌ Closed **Base:** `main` ← **Head:** `patch-3` --- ### 📝 Commits (2) - [`2b78974`](https://github.com/pelican-dev/panel/commit/2b78974b2e4418ca11667ff99fd3c62ab8f18f3b) Update jest.config.js - [`1da3ed8`](https://github.com/pelican-dev/panel/commit/1da3ed8d5f19c34597c1ea58be4bf609e1fe1ccf) Add jest to workflow ### 📊 Changes **2 files changed** (+23 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/lint.yaml` (+22 -0) 📝 `jest.config.js` (+1 -1) </details> ### 📄 Description - [x] Make jest tests pass again by adding vendor to exclude - [x] Add jest to workflow Before ``` yarn run test yarn run v1.22.22 $ jest PASS resources/scripts/lib/formatters.spec.ts PASS resources/scripts/lib/strings.spec.ts PASS resources/scripts/lib/helpers.spec.ts PASS resources/scripts/lib/objects.spec.ts FAIL vendor/livewire/livewire/src/Features/SupportScriptsAndAssets/test.js ● Test suite failed to run The error below may be caused by using the wrong test environment, see https://jestjs.io/docs/configuration#testenvironment-string. Consider using the "jsdom" test environment. ReferenceError: document is not defined 1 | > 2 | document.querySelector('[dusk="foo"]').textContent = 'evaluated' | ^ 3 | at Object.<anonymous> (vendor/livewire/livewire/src/Features/SupportScriptsAndAssets/test.js:2:1) at TestScheduler.scheduleTests (node_modules/@jest/core/build/TestScheduler.js:317:13) at runJest (node_modules/@jest/core/build/runJest.js:407:19) Test Suites: 1 failed, 4 passed, 5 total Tests: 46 passed, 46 total Snapshots: 0 total Time: 0.655 s, estimated 1 s Ran all test suites. error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. ``` After ``` yarn run test yarn run v1.22.22 $ jest PASS resources/scripts/lib/formatters.spec.ts PASS resources/scripts/lib/helpers.spec.ts PASS resources/scripts/lib/strings.spec.ts PASS resources/scripts/lib/objects.spec.ts Test Suites: 4 passed, 4 total Tests: 46 passed, 46 total Snapshots: 0 total Time: 0.693 s, estimated 1 s Ran all test suites. Done in 1.54s. ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-04 18:50:27 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/panel#784