learn-co-curriculum / react-hooks-practice-animal-shelter

Other
3 stars 1.24k forks source link

update package.json - remove babel/plugin-proposal-private-property-i… #9

Closed codetombomb closed 1 year ago

codetombomb commented 1 year ago

Lab Submissions on CodeGrade are failing while tests are passing locally.

This is the current error message on CodeGrade:

 ● Test suite failed to run

    Jest encountered an unexpected token

    This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.

    By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".

    Here's what you can do:
     • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/en/ecmascript-modules for how to enable it.
     • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
     • If you need a custom transformation specify a "transform" option in your config.
     • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.

    You'll find more details and examples of these config options in the docs:
    https://jestjs.io/docs/en/configuration.html

    Details:

    /home/codegrade/student/node_modules/@testing-library/dom/dist/label-helpers.js:32
        return element.labels ?? [];
                               ^

    SyntaxError: Unexpected token '?'

      1 | import React from "react";
      2 | import "whatwg-fetch";
    > 3 | import { render, fireEvent, screen } from "@testing-library/react";
        | ^
      4 | import "@testing-library/jest-dom/extend-expect";
      5 | import { server } from "../mocks/server";
      6 | import { getAll, getByType } from "../mocks/data";

      at Runtime.createScriptFromCode (../.npm/lib/node_modules/jest/node_modules/jest-runtime/build/index.js:1350:14)
      at Object.<anonymous> (node_modules/@testing-library/dom/dist/queries/label-text.js:9:21)
      at Object.<anonymous> (node_modules/@testing-library/dom/dist/queries/index.js:6:18)
      at Object.<anonymous> (node_modules/@testing-library/dom/dist/get-queries-for-element.js:7:46)
      at Object.<anonymous> (node_modules/@testing-library/dom/dist/index.js:60:29)
      at Object.<anonymous> (node_modules/@testing-library/react/dist/pure.js:32:12)
      at Object.<anonymous> (node_modules/@testing-library/react/dist/index.js:7:13)
      at Object.<anonymous> (src/__tests__/App.test.js:3:1)

This PR removes a dependency in the package.json that was not included in the original lab repo:

"@babel/plugin-proposal-private-property-in-object": "^7.21.10",

lizbur10 commented 1 year ago

Thanks @codetombomb!