question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

react-input-autosize "window" reference breaks test environment

See original GitHub issue

Are you reporting a bug or runtime error?

Yes.

Version

Any version of react-select that pulls in react-input-autosize at 2.2.0.

Summary

Our test suite will no longer run (in a headless environment) due to this error:

/node_modules/react-input-autosize/lib/AutosizeInput.js:57
var isIE = typeof window === 'undefined' && window.document ? false : /MSIE |Trident\/|Edge\//.test(window.navigator.userAgent);
                                            ^

ReferenceError: window is not defined
    at Object.<anonymous> (/Users/emily/webapp/node_modules/react-input-autosize/lib/AutosizeInput.js:57:45)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
JedWatsoncommented, Jan 10, 2018

Fixed in react-input-autosize@2.2.1

1reaction
hafeez1042commented, Jan 10, 2018

This is the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Re-render a React Component on Window Resize | Pluralsight
This will create n new event bindings of handleResize to the resize event. If this component is re-rendered often, this could create a...
Read more >
Test Utilities - React
ReactTestUtils makes it easy to test React components in the testing framework of your choice. At Facebook we use Jest for painless JavaScript...
Read more >
JedWatson/react-input-autosize - GitHub
React -Input-Autosize generates an input field, wrapped in a <div> tag so it can detect the size of its value. Otherwise it behaves...
Read more >
Rerender view on browser resize with React - Stack Overflow
Using React Hooks: You can define a custom Hook that listens to the window resize event, something like this: import React, { useLayoutEffect,...
Read more >
How To Test a React App with Jest and React Testing Library
js suffix in __tests__ folders. When you make changes to the relevant test files, they will be detected automatically. As test cases are ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found