Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Unable to run test suite #1

Open
okize opened this issue Jan 13, 2017 · 4 comments
Open

Unable to run test suite #1

okize opened this issue Jan 13, 2017 · 4 comments

Comments

@okize
Copy link

okize commented Jan 13, 2017

Hi, I cloned this repo and after running npm install I got the following error after running npm test:

> [email protected] 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

> [email protected] 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
[email protected] ~/src/localhost/sandbox/babel-plugin-add-react-displayname
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]
@roncohen
Copy link
Contributor

Hi @okize. Sorry for the slowness. Will take a look over the weekend

@okize
Copy link
Author

okize commented Jan 20, 2017

no worries, thanks @roncohen!

@roncohen
Copy link
Contributor

roncohen commented May 1, 2017

Hi @okize. Just wanted to let you know i've submitted this as a PR to babel: babel/babel#5679

@okize
Copy link
Author

okize commented May 1, 2017

@roncohen awesome, that's quite a PR! I think that would fix the issue I was seeing, which is why I was trying to run the test suite in the first place. I hope it lands in babel 👍

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

No branches or pull requests

2 participants