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

Failing JS tests #90

Open
mfendeksilverstripe opened this issue Nov 29, 2022 · 1 comment
Open

Failing JS tests #90

mfendeksilverstripe opened this issue Nov 29, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@mfendeksilverstripe
Copy link
Collaborator

mfendeksilverstripe commented Nov 29, 2022

Failing JS tests

Looks like some of our JS tests are failing. This was noticed as a part of #86 which made the JS tests to be executed via Github actions.

Test Suites: 5 failed, 2 passed, 7 total
Tests:       15 failed, 32 passed, 47 total
Snapshots:   0 total
Time:        4.843s
Ran all test suites.

This is likely outdated test setup, not necessarily broken functionality. We should consider working on this in the context of #47 which may change a lot of tests.

The whole test suite was disabled as it's very outdated. We need to re-enable it once the tests are updated. Example of dependency errors that occur:

  ● Test suite failed to run

    Cannot find module 'babel-plugin-transform-object-rest-spread'
    Require stack:
    - /home/runner/work/silverstripe-versioned-snapshot-admin/silverstripe-versioned-snapshot-admin/node_modules/@babel/core/lib/config/files/plugins.js
    - /home/runner/work/silverstripe-versioned-snapshot-admin/silverstripe-versioned-snapshot-admin/node_modules/@babel/core/lib/config/files/index.js
    - /home/runner/work/silverstripe-versioned-snapshot-admin/silverstripe-versioned-snapshot-admin/node_modules/@babel/core/lib/index.js
    - /home/runner/work/silverstripe-versioned-snapshot-admin/silverstripe-versioned-snapshot-admin/node_modules/jest-snapshot/build/InlineSnapshots.js
    - Did you mean "@babel/transform-object-rest-spread"?
@GuySartorelli
Copy link
Member

Note that you may be able to get jest tests limping along by making the following changes:

{
  "devDependencies":
  {
+    "react-16": "npm:react@^16.14.0",
+    "react-dom-16": "npm:react-dom@^16.14.0",
  },
  "jest": {
+    "testEnvironment": "jsdom",
+    "moduleNameMapper": {
+          "^react-dom/client$": "react-dom-16",
+          "^react-dom((/.*)?)$": "react-dom-16$1",
+          "^react((/.*)?)$": "react-16$1"
    }
}

Though note that that's a very hacky workaround, and results in testing how the components would work with react 16, not how they do work with react 18.

See PRs attached to silverstripe/silverstripe-admin#1419 and the discussion in that issue for how we tackled updating our jest tests for the supported modules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants