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

TypeError: Cannot convert undefined or null to object (cleanYamlObj) #931

Closed
tony-kerz opened this issue Jun 22, 2016 · 3 comments
Closed

Comments

@tony-kerz
Copy link

tony-kerz commented Jun 22, 2016

the above error is triggered by the following code (which should just report a test failure):

import test from 'ava'
import React from 'react'
import {mount} from 'enzyme'

test('should kinda work', t => {
  const wrapper = mount(<div>foo</div>)
  t.is(wrapper.find('.does-not-exist').length, 1)
})

strangely, when the test is altered to pass, no such exception is thrown:

  t.is(wrapper.find('.does-not-exist').length, 0)

also observed that the issue does not surface when using enzyme shallow or render methods (just mount)

the rest of the project configuration can be found here for reference.

versions

node: 6.2.2
ava: 0.15.2
react: 15.1.0
enzyme: 2.3.0

stack trace

Warning: Element: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://fb.me/react-special-props)
Warning: Element: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://fb.me/react-special-props)

   2 exceptions


   1. Uncaught Exception
   TypeError: Cannot convert undefined or null to object
    cleanYamlObj (/Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:12:17)
    setProp (/Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:84:22)
    /Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:73:4
    cleanYamlObj (/Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:57:15)
    setProp (/Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:84:22)
    /Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:73:4
    cleanYamlObj (/Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:57:15)
    setProp (/Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:84:22)
    /Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:73:4
    cleanYamlObj (/Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:57:15)
    setProp (/Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:84:22)
    /Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:73:4
    cleanYamlObj (/Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:57:15)
    setProp (/Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:84:22)
    /Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:73:4
    cleanYamlObj (/Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:57:15)
    setProp (/Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:84:22)
    /Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:73:4
    cleanYamlObj (/Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:57:15)
    setProp (/Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:84:22)
    /Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:73:4
    cleanYamlObj (/Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:57:15)
    setProp (/Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:84:22)
    /Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:73:4
    cleanYamlObj (/Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:57:15)
    setProp (/Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:84:22)
    /Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:73:4
    cleanYamlObj (/Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:57:15)
    setProp (/Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:84:22)
    /Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:73:4
    cleanYamlObj (/Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:57:15)
    setProp (/Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:84:22)
    /Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:73:4
    cleanYamlObj (/Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:57:15)
    setProp (/Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:84:22)
    /Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:73:4
    cleanYamlObj (/Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:57:15)
    module.exports (/Users/tony/git/react-drop-wrapper/node_modules/clean-yaml-object/index.js:3:9)
    _combinedTickCallback (internal/process/next_tick.js:67:7)
    process._tickCallback (internal/process/next_tick.js:98:9)


   ✖ Test results were not received from test/index-test.js
@tony-kerz
Copy link
Author

fwiw, witnessing similar with:

  t.true(wrapper.hasClass('does-not-exist'))

@novemberborn
Copy link
Member

This is fixed in master. If I were to guess, due to #903.

@tony-kerz please try installing AVA from GitHub until the next release is out. Or avoid bugs so your tests don't fail 😜

@tony-kerz
Copy link
Author

@novemberborn oh yeah, my code never has bugs, it's the other devs i'm worried about 😆

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

No branches or pull requests

2 participants