This repository was archived by the owner on Jan 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 34
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
Unable to run test suite #1
Copy link
Copy link
Open
Description
Hi, I cloned this repo and after running npm install I got the following error after running npm test:
> babel-plugin-add-react-displayname@0.0.4 test ~/src/localhost/sandbox/babel-plugin-add-react-displayname
> mocha
~/src/localhost/sandbox/babel-plugin-add-react-displayname/node_modules/babel-core/lib/transformation/file/options/option-manager.js:334
throw e;
^
Error: Couldn't find preset "react" relative to directory "~/src/localhost/sandbox/babel-plugin-add-react-displayname/test/fixtures/arrowFun"
at ~/src/localhost/sandbox/babel-plugin-add-react-displayname/node_modules/babel-core/lib/transformation/file/options/option-manager.js:299:19
at Array.map (native)
at OptionManager.resolvePresets (~/src/localhost/sandbox/babel-plugin-add-react-displayname/node_modules/babel-core/lib/transformation/file/options/option-manager.js:270:20)
at OptionManager.mergePresets (~/src/localhost/sandbox/babel-plugin-add-react-displayname/node_modules/babel-core/lib/transformation/file/options/option-manager.js:259:10)
at OptionManager.mergeOptions (~/src/localhost/sandbox/babel-plugin-add-react-displayname/node_modules/babel-core/lib/transformation/file/options/option-manager.js:244:14)
at OptionManager.init (~/src/localhost/sandbox/babel-plugin-add-react-displayname/node_modules/babel-core/lib/transformation/file/options/option-manager.js:374:12)
at File.initOptions (~/src/localhost/sandbox/babel-plugin-add-react-displayname/node_modules/babel-core/lib/transformation/file/index.js:216:65)
at new File (~/src/localhost/sandbox/babel-plugin-add-react-displayname/node_modules/babel-core/lib/transformation/file/index.js:139:24)
at Pipeline.transform (~/src/localhost/sandbox/babel-plugin-add-react-displayname/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
at Object.transformFileSync (~/src/localhost/sandbox/babel-plugin-add-react-displayname/node_modules/babel-core/lib/api/node.js:138:10)
at transformFile (~/src/localhost/sandbox/babel-plugin-add-react-displayname/test/tests.js:31:16)
at ~/src/localhost/sandbox/babel-plugin-add-react-displayname/test/tests.js:15:18
at Array.forEach (native)
at Suite.<anonymous> (~/src/localhost/sandbox/babel-plugin-add-react-displayname/test/tests.js:14:31)
at Object.create (~/src/localhost/sandbox/babel-plugin-add-react-displayname/node_modules/mocha/lib/interfaces/common.js:114:19)
at context.describe.context.context (~/src/localhost/sandbox/babel-plugin-add-react-displayname/node_modules/mocha/lib/interfaces/bdd.js:44:27)
at Object.<anonymous> (~/src/localhost/sandbox/babel-plugin-add-react-displayname/test/tests.js:12:1)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at ~/src/localhost/sandbox/babel-plugin-add-react-displayname/node_modules/mocha/lib/mocha.js:222:27
at Array.forEach (native)
at Mocha.loadFiles (~/src/localhost/sandbox/babel-plugin-add-react-displayname/node_modules/mocha/lib/mocha.js:219:14)
at Mocha.run (~/src/localhost/sandbox/babel-plugin-add-react-displayname/node_modules/mocha/lib/mocha.js:487:10)
at Object.<anonymous> (~/src/localhost/sandbox/babel-plugin-add-react-displayname/node_modules/mocha/bin/_mocha:459:18)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Function.Module.runMain (module.js:575:10)
at startup (node.js:160:18)
at node.js:456:3
npm ERR! Test failed. See above for more details.
I think that can be fixed by adding react into devDependencies.
After installing react and running npm test I get this error:
$ npm test
> babel-plugin-add-react-displayname@0.0.4 test ~/src/localhost/sandbox/babel-plugin-add-react-displayname
> mocha
~/src/localhost/sandbox/babel-plugin-add-react-displayname/node_modules/babel-core/lib/transformation/file/options/option-manager.js:334
throw e;
^
ReferenceError: [BABEL] ~/src/localhost/sandbox/babel-plugin-add-react-displayname/test/fixtures/arrowFun/input.js: Unknown option: ~/src/localhost/sandbox/babel-plugin-add-react-displayname/node_modules/react/react.js.Children. Check out http://babeljs.io/docs/usage/options/ for more information about options.
A common cause of this error is the presence of a configuration options object without the corresponding preset name. Example:
Invalid:
`{ presets: [{option: value}] }`
Valid:
`{ presets: [['presetName', {option: value}]] }`
For more detailed information on preset configuration, please see http://babeljs.io/docs/plugins/#pluginpresets-options. (While processing preset: "~/src/localhost/sandbox/babel-plugin-add-react-displayname/node_modules/react/react.js")
at Logger.error (~/src/localhost/sandbox/babel-plugin-add-react-displayname/node_modules/babel-core/lib/transformation/file/logger.js:41:11)
at OptionManager.mergeOptions (~/src/localhost/sandbox/babel-plugin-add-react-displayname/node_modules/babel-core/lib/transformation/file/options/option-manager.js:221:20)
at ~/src/localhost/sandbox/babel-plugin-add-react-displayname/node_modules/babel-core/lib/transformation/file/options/option-manager.js:260:14
at ~/src/localhost/sandbox/babel-plugin-add-react-displayname/node_modules/babel-core/lib/transformation/file/options/option-manager.js:329:22
at Array.map (native)
at OptionManager.resolvePresets (~/src/localhost/sandbox/babel-plugin-add-react-displayname/node_modules/babel-core/lib/transformation/file/options/option-manager.js:270:20)
at OptionManager.mergePresets (~/src/localhost/sandbox/babel-plugin-add-react-displayname/node_modules/babel-core/lib/transformation/file/options/option-manager.js:259:10)
at OptionManager.mergeOptions (~/src/localhost/sandbox/babel-plugin-add-react-displayname/node_modules/babel-core/lib/transformation/file/options/option-manager.js:244:14)
at OptionManager.init (~/src/localhost/sandbox/babel-plugin-add-react-displayname/node_modules/babel-core/lib/transformation/file/options/option-manager.js:374:12)
at File.initOptions (~/src/localhost/sandbox/babel-plugin-add-react-displayname/node_modules/babel-core/lib/transformation/file/index.js:216:65)
at new File (~/src/localhost/sandbox/babel-plugin-add-react-displayname/node_modules/babel-core/lib/transformation/file/index.js:139:24)
at Pipeline.transform (~/src/localhost/sandbox/babel-plugin-add-react-displayname/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
at Object.transformFileSync (~/src/localhost/sandbox/babel-plugin-add-react-displayname/node_modules/babel-core/lib/api/node.js:138:10)
at transformFile (~/src/localhost/sandbox/babel-plugin-add-react-displayname/test/tests.js:31:16)
at ~/src/localhost/sandbox/babel-plugin-add-react-displayname/test/tests.js:15:18
at Array.forEach (native)
at Suite.<anonymous> (~/src/localhost/sandbox/babel-plugin-add-react-displayname/test/tests.js:14:31)
at Object.create (~/src/localhost/sandbox/babel-plugin-add-react-displayname/node_modules/mocha/lib/interfaces/common.js:114:19)
at context.describe.context.context (~/src/localhost/sandbox/babel-plugin-add-react-displayname/node_modules/mocha/lib/interfaces/bdd.js:44:27)
at Object.<anonymous> (~/src/localhost/sandbox/babel-plugin-add-react-displayname/test/tests.js:12:1)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at ~/src/localhost/sandbox/babel-plugin-add-react-displayname/node_modules/mocha/lib/mocha.js:222:27
at Array.forEach (native)
at Mocha.loadFiles (~/src/localhost/sandbox/babel-plugin-add-react-displayname/node_modules/mocha/lib/mocha.js:219:14)
at Mocha.run (~/src/localhost/sandbox/babel-plugin-add-react-displayname/node_modules/mocha/lib/mocha.js:487:10)
at Object.<anonymous> (~/src/localhost/sandbox/babel-plugin-add-react-displayname/node_modules/mocha/bin/_mocha:459:18)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Function.Module.runMain (module.js:575:10)
at startup (node.js:160:18)
at node.js:456:3
npm ERR! Test failed. See above for more details.
I thought it may be because stage-0 is installed (https://github.com/opbeat/babel-plugin-add-react-displayname/blob/master/package.json#L11) but stage-1 is requested (https://github.com/opbeat/babel-plugin-add-react-displayname/blob/master/test/tests.js#L32). After remedying that however, the error remains.
These are the versions of dependencies that were installed:
$ npm ls --depth=0
babel-plugin-add-react-displayname@0.0.4 ~/src/localhost/sandbox/babel-plugin-add-react-displayname
├── babel-core@6.21.0
├── babel-helper-plugin-test-runner@6.18.0
├── babel-plugin-transform-decorators-legacy@1.3.4
├── babel-preset-stage-1@6.16.0
├── mocha@3.2.0
├── react@15.4.2
└── standard@8.6.0
Metadata
Metadata
Assignees
Labels
No labels