Skip to content

Jest fails with window is not defiend in cre-bus-fra #15

@chaobidomain

Description

@chaobidomain

Please find attached the stack traces:

Summary of all failing tests
FAIL ClientApp/components/details/PropertyListingDetails.test.tsx
● render PropertyListingDetails

ReferenceError: window is not defined

  100 |   componentDidMount = () => {
  101 |     this.unsubscribe = this.experiment.subscribe(() => this.forceUpdate());
> 102 |     this.experiment.activate();
      |                     ^
  103 |   };
  104 |   componentWillUnmount = () => {
  105 |     this.unsubscribe();

  at Optimize.<anonymous> (node_modules/react-experimentify/dist/optimize.js:48:5)
  at Optimize.addEventListener (node_modules/react-experimentify/node_modules/lodash/before.js:31:21)
  at Optimize.activate (node_modules/react-experimentify/dist/optimize.js:35:11)
  at PropertyListingDetails.componentDidMount (ClientApp/components/details/PropertyListingDetails.tsx:102:21)
  at node_modules/enzyme/build/ShallowWrapper.js:215:22
  at Object.batchedUpdates (node_modules/enzyme-adapter-react-16/build/ReactSixteenAdapter.js:474:22)
  at new ShallowWrapper (node_modules/enzyme/build/ShallowWrapper.js:214:26)
  at Object.shallow (node_modules/enzyme/build/shallow.js:21:10)
  at Object.<anonymous>.test (ClientApp/components/details/PropertyListingDetails.test.tsx:47:24)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions