Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make jest tests pass again #482

Closed
wants to merge 2 commits into from

Conversation

RMartinOscar
Copy link
Contributor

@RMartinOscar RMartinOscar commented Jul 14, 2024

  • 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.

@alexevladgabriel
Copy link
Contributor

alexevladgabriel commented Jul 17, 2024

I will close the PR, because of #493 which is now using Vitest.
Thank you for your contribution 🤗

@github-actions github-actions bot locked and limited conversation to collaborators Jul 17, 2024
@RMartinOscar RMartinOscar deleted the patch-3 branch July 19, 2024 06:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants