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: this.contextRender is not a function when using shallow #91

Open
kolnogorov opened this issue Aug 9, 2019 · 1 comment
Open

Comments

@kolnogorov
Copy link

kolnogorov commented Aug 9, 2019

When i run test, it fails with the TypeError: this.contextRender is not a function when using shallow error.

This is my test:

import { h } from 'preact'
import { shallow } from 'preact-render-spy'
import { App } from '../../src/app'

describe('App', () => {
  test('renders', () => {
    const context = shallow(<App />)
    expect(context.find('div').contains(<a>link</a>)).toBeTruthy()
  })
})

This is error i get:

 FAIL  test/src/app.test.js
  App
    ✕ renders (4ms)

  ● App › renders

    TypeError: this.contextRender is not a function

       5 | describe('App', () => {
       6 |   test('renders', () => {
    >  7 |     const context = shallow(<App />)
         |                     ^
       8 |     expect(context.find('div').contains(<a>link</a>)).toBeTruthy()
       9 |   })
      10 | })

      at RenderContext.render (node_modules/preact-render-spy/src/preact-render-spy.js:462:10)
      at deep (node_modules/preact-render-spy/src/preact-render-spy.js:472:76)
      at shallow (node_modules/preact-render-spy/src/preact-render-spy.js:473:25)
      at Object.<anonymous> (test/src/app.test.js:7:21)

Test Suites: 1 failed, 1 total
Tests:       1 failed, 1 total
Snapshots:   0 total
Time:        2.196s
Ran all test suites.
@shelacek
Copy link

shelacek commented Oct 7, 2019

This error occurs when you use Preact 10 (issue #92). Is this also true in this case?

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