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

ReferenceError: Unknown plugin "transform-replace-object-assign" specified #2108

Closed
1 of 13 tasks
anchengjian opened this issue Apr 23, 2019 · 3 comments
Closed
1 of 13 tasks
Labels

Comments

@anchengjian
Copy link

Thanks for reporting an issue to us! We're glad you are using and invested in Enzyme.
Before submitting, please read over our commonly reported issues to prevent duplicates!

All common issues

Notoriously common issues

If you haven't found any duplicated issues, please report it with your environment!

Current behavior

 FAIL  src/Comp/__test__/index.test.tsx
  ● Test suite failed to run

    ReferenceError: Unknown plugin "transform-replace-object-assign" specified in "/Users/~/xxx/node_modules/airbnb-prop-types/.babelrc" at 0, attempted to resolve relative to "/Users/~/xxx/node_modules/airbnb-prop-types"

      at node_modules/babel-core/lib/transformation/file/options/option-manager.js:180:17
          at Array.map (<anonymous>)
      at Function.normalisePlugins (node_modules/babel-core/lib/transformation/file/options/option-manager.js:158:20)
      at OptionManager.mergeOptions (node_modules/babel-core/lib/transformation/file/options/option-manager.js:234:36)
      at OptionManager.init (node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
      at File.initOptions (node_modules/babel-core/lib/transformation/file/index.js:212:65)
      at new File (node_modules/babel-core/lib/transformation/file/index.js:135:24)
      at Pipeline.transform (node_modules/babel-core/lib/transformation/pipeline.js:46:16)

Expected behavior

Your environment

react-native

API

  • shallow
  • mount
  • render

Version

library version
enzyme "3.9.0"
react "16.3.0"
react-dom "16.3.1"
react-test-renderer "16.8.6"
adapter (below) "1.1.1"

Adapter

  • enzyme-adapter-react-16
  • enzyme-adapter-react-16.3
  • enzyme-adapter-react-16.2
  • enzyme-adapter-react-16.1
  • enzyme-adapter-react-15
  • enzyme-adapter-react-15.4
  • enzyme-adapter-react-14
  • enzyme-adapter-react-13
  • enzyme-adapter-react-helper
  • others ( )
enzyme-adapter-utils@^1.3.0:
  version "1.11.0"
  resolved "http://r.npm.sankuai.com/enzyme-adapter-utils/download/enzyme-adapter-utils-1.11.0.tgz#6ffff782b1b57dd46c72a845a91fc4103956a117"
  integrity sha1-b//3grG1fdRscqhFqR/EEDlWoRc=
  dependencies:
    airbnb-prop-types "^2.12.0"
    function.prototype.name "^1.1.0"
    object.assign "^4.1.0"
    object.fromentries "^2.0.0"
    prop-types "^15.7.2"
    semver "^5.6.0"

I think it's the mistake caused by the enzyme-adapter-utils upgrade.

@ljharb
Copy link
Member

ljharb commented Apr 23, 2019

This is a bug in the react native packager - it transpiles node_modules, which shouldn’t ever be done.

The temporary workaround until they fix this design flaw is to add a post install script to your app that deletes all .babelrc files in your node_modules dir.

@ljharb ljharb closed this as completed Apr 23, 2019
@ljharb ljharb added the invalid label Apr 23, 2019
@anchengjian

This comment has been minimized.

@ljharb

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants