Gatsby: [v2] testing components that inherit from <Layout> component have history undefined error in Jest

Created on 30 Jun 2018  ยท  7Comments  ยท  Source: gatsbyjs/gatsby

Description

I had previously encountered an issue with unit testing certain components in Gatsby v1, captured in my comment in https://github.com/gatsbyjs/gatsby/issues/2932#issuecomment-376306319 that seemed to stem from certain component's I was testing that were using the Gatsby <Link> component.

It seems that his may have followed into Gatsby v2, but possibly expanded with the introduction of the <Layout> component? Does Gaysby pull in the <Link> component through the Layout component pattern now?

For example, given this layout + page integration test scenario that was working in v1

src/layout/layout.jsx

import React from 'react';
import PropTypes from 'prop-types';
import Helmet from 'react-helmet';
import Typography from 'typography';
import Footer from '../footer/footer';
import Header from '../header/header';
import Navigation from '../navigation/navigation';
import SocialLinksService from '../../services/social-links/social-links-service';
import './layout.css';

const typography = new Typography({
  baseFontSize: '18px',
  baseLineHeight: 1.45,
  headerFontFamily: [
    'Avenir Next',
    'Helvetica Neue',
    'Segoe UI',
    'Helvetica',
    'Arial',
    'sans-serif'
  ],
  bodyFontFamily: ['Avenir Next', 'serif']
});

typography.injectStyles();

// TODO fix why bombs out because of <Link> being used in the component
// https://github.com/thegreenhouseio/www.thegreenhouse.io/issues/34
class Layout extends React.Component {

  constructor() {
    super();

    this.links = new SocialLinksService().getLinksAsArray();
  }

  render() {

    return (
      <div className='layout'>
        <Helmet>
          <title>The Greenhouse I/O</title>
          <meta name='viewport' content='width=device-width, initial-scale=1'/>
          <meta name='mobile-web-app-capable' content='yes'/>
          <meta name='apple-mobile-web-app-capable' content='yes'/>
          <meta name='apple-mobile-web-app-status-bar-style' content='black'/>
          <meta name="description" content="Personal site and blog for Owen Buckley and The Greenhouse I/O"/>

          <meta property="og:title" content="The Greenhouse I/O" />
          <meta property="og:type" content="website" />
          <meta property="og:url" content="https://www.thegreenhouse.io/" />
          <meta property="og:image" content="https://s3.amazonaws.com/www.thegreenhouse.io/static/banner.4b3f4ebd.jpg" />
          <meta property="og:description" content="Personal site and blog for Owen Buckley and The Greenhouse I/O.  Ideas are built here." />

          <meta name="twitter:site" content="@thegreenhouseio" />
          <meta name="twitter:creator" content="@thegreenhouseio" />

          <html lang="en" prefix="og:http://ogp.me/ns#"/>
        </Helmet>

        <section className='row'>
          <Header/>
        </section>

        <section className='row'>
          <Navigation/>
        </section>

        <section className='outlet row'>
          <div>{ this.props.children }</div>
        </section>

        <section className='row'>
          <Footer links={this.links}/>
        </section>
      </div>
    );
  }
}

Layout.propTypes = {
  children: PropTypes.node.isRequired
};

export default Layout;

src/about/about.jsx

import React from 'react';
import { OutboundLink } from 'gatsby-plugin-google-analytics';
import Layout from '../components/layout/layout';
import ArticlesService from '../services/articles/articles-service';
import PresentationsService from '../services/presentations/presentations-service';
import SocialLinksService from '../services/social-links/social-links-service';
import CardList from '../components/card-list/card-list';

class PublicationsPage extends React.Component {
  constructor() {
    super();

    this.SECTIONS = {
      SPEAKING: 'SPEAKING',
      WRITING: 'WRITING'
    };

    this.state = {
      socialLinksMap: new SocialLinksService().getLinksAsMap(),
      articles: new ArticlesService().getModeledArticles(),
      presentations: new PresentationsService().getModeledPresentations(),
      activeSection: this.SECTIONS.SPEAKING
    };
  }

  setActiveSection(section) {
    this.setState({
      ...this.state,
      activeSection: section
    });
  }

  getContent() {
    let content;

    switch (this.state.activeSection) {

      case this.SECTIONS.SPEAKING:
        content = <CardList className="content-speaking" items={this.state.presentations}/>;
        break;
      case this.SECTIONS.WRITING:
        content = 
          <div>
            <CardList className="content-writing" items={this.state.articles}/>
            <span className="cta">Visit my <OutboundLink target="_blank" href={this.state.socialLinksMap.get('medium')}>Medium</OutboundLink> page for other articles I&apos;ve done!</span>
          </div>;
        break;
      default:
        content = '';

    }

    return content;
  }

  render() {

    return (
      <Layout>
        <div id="about">
          <p className="sub-heading">I think the best way to tell you about myself is to show you what I am passionate about.  Below are some featured articles
            and presentations I&apos;ve worked on.</p>

          <div className="content-links">
            <h2 className="link-speaking" onClick={() => this.setActiveSection(this.SECTIONS.SPEAKING)}><u>Speaking</u></h2>
            <h2 className="link-writing" onClick={() => this.setActiveSection(this.SECTIONS.WRITING)}><u>Writing</u></h2>
          </div>

          <div className="content-output">
            { this.getContent() }
          </div>

        </div>
      </Layout>
    );
  }
}

export default PublicationsPage;

test/integration/pages/about.spec.jsx

import * as React from 'react';
import { mount, configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import About from '../../../src/pages/about';

configure({ adapter: new Adapter() });

describe('About Page', () => {
  let about;

  beforeEach(() => {
    about = mount(<About/>);
  });

  describe('default state', () => {

    it('should be defined', () => {
      expect(about).toBeDefined();
      expect(about.find('#about').length).toBe(1);
    });

     // more specs here, but the above alone will reproduce the issue ^
});

All my other tests work great now in v2 thanks to a little help from friends over in https://github.com/gatsbyjs/gatsby/issues/5824 !

You can see the full branch of my v2 WIP here.

Steps to reproduce

  1. Followed the v2 Upgrade guide
  2. Updated relevant specs to use enzyme-adapter-react-16
  3. Moved Babel configuration to Jest
  4. Mapped an empty _pages.json_

Expected result

Tests would continue to pass

Actual result

Jest errors

$ yarn test
yarn run v1.7.0
$ rimraf ./reports && jest --config ./jest.config.json --no-cache
 PASS  src/services/presentations/presentations-service.spec.js
  PresentationsService
    โœ“ should be defined (4ms)
    โœ“ should return some presentations from getPresentations (1ms)
    โœ“ should return modeled presentations from getModeledPresentations with basic properties (4ms)

 PASS  src/services/social-links/social-links-service.spec.js
  SocialLinksService
    โœ“ should be defined (5ms)
    getLinks (default)
      โœ“ should have 4 links (1ms)
      โœ“ should return the expected links from getLinks (2ms)
    getLinksAsMap
      โœ“ should be a Map (1ms)
      โœ“ should return the expected links from getLinks (1ms)
    getLinksAsArray
      โœ“ should be an array of four items
      โœ“ should return the expected links from getLinks (1ms)

 PASS  src/services/articles/articles-service.spec.js
  ArticlesService
    โœ“ should be defined (3ms)
    โœ“ should return some articles from getArticles
    โœ“ should return modeled articles from getModeledArticles with basic properties (3ms)

 PASS  src/services/projects/projects-service.spec.js
  ProjectsService
    โœ“ should be defined (1ms)
    โœ“ should return some projects from getProjects (1ms)
    โœ“ should return modeled projects from getModeledProjects with basic properties (4ms)

 PASS  src/components/footer/footer.spec.jsx
  Footer Component
    โœ“ should not be null (36ms)
    โœ“ should have no <SocialIcon/> components (3ms)
    โœ“ should display copyright text (3ms)
    โœ“ should display the correct <SocialIcon/> components based on urls prop (20ms)

 PASS  src/components/card-list/card-list.spec.jsx
  CardList Component
    โœ“ should not be null (32ms)
    Counting Cards
      โœ“ should display zero <Card> components when zero items are passed as props (3ms)
      โ—‹ skipped 1 test

 PASS  src/components/blog-post/blog-post.spec.jsx
  BlogPost Component
    slugifyDate
      โœ“ should return a slugified date when the right format is provided (5ms)
    basic functionality
      โœ“ should not be null (31ms)
      โœ“ should display the correct title (5ms)
      โœ“ should display the correct date (4ms)
      โœ“ should display the correct image if the image path is local (2ms)
      โœ“ should display the correct content (6ms)
      <meta> tags for Social Sharing
        โœ“ should have a <Helmet> component (5ms)
        โœ“ should have a <meta> tag for title (5ms)
        โœ“ should have a <meta> tag for type (4ms)
        โœ“ should have a <meta> tag for url (4ms)
        โœ“ should have a <meta> tag for image with a remote path (5ms)
        โœ“ should have a <meta> tag for description (11ms)
    Extended Meta Tag Functionality
      โœ“ should have a <meta> tag for image with a remote URL / path when provided an external URL (2ms)

 PASS  src/components/card/card.spec.jsx
  Card Component
    basic layout
      โœ“ should not be null (47ms)
      โœ“ should have a header element (8ms)
      โœ“ should have a content element (14ms)
      โœ“ should have a footer element (7ms)
    rendering an item with (required) paramaters
      โœ“ should have the title set in a heading (8ms)
      โœ“ should have the link set in an <a> tag (6ms)
      โœ“ should have an abstract set in an article (6ms)
      โ—‹ skipped 1 test
    rendering an item with an image
      โœ“ should have an image tag in the footer  (6ms)
    rendering an item with video
      โœ“ should have an iframe tag in the footer  (6ms)
    rendering an item with a date
      โœ“ should have a span tag with the date set (7ms)


 RUNS  test/integration/pages/about.spec.jsx

Test Suites: 1 skipped, 8 passed, 8 of 10 total
Tests:       3 skipped, 45 passed, 48 total
Snapshots:   0 total
  console.error node_modules/jsdom/lib/jsdom/virtual-console.js:29
    Error: Uncaught [TypeError: Cannot read property 'history' of undefined]
        at reportException (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/helpers/runtime-script-errors.js:66:24)
        at invokeEventListeners (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:209:9)
        at HTMLUnknownElementImpl._dispatch (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:119:9)
        at HTMLUnknownElementImpl.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:82:17)
        at HTMLUnknownElementImpl.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/nodes/HTMLElement-impl.js:30:27)
        at HTMLUnknownElement.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:157:21)
        at Object.invokeGuardedCallbackDev (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:138:16)
        at invokeGuardedCallback (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:187:29)
        at replayUnitOfWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:15194:5)
        at renderRoot (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:15840:11) TypeError: Cannot read property 'history' of undefined
        at new GatsbyLink (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/gatsby-link/index.js:82:35)
        at constructClassInstance (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:11333:18)
        at updateClassComponent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:13036:7)
        at beginWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:13715:14)
        at performUnitOfWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:15741:12)
        at workLoop (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:15780:24)
        at HTMLUnknownElement.callCallback (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:100:14)
        at invokeEventListeners (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:193:27)
        at HTMLUnknownElementImpl._dispatch (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:119:9)
        at HTMLUnknownElementImpl.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:82:17)
        at HTMLUnknownElementImpl.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/nodes/HTMLElement-impl.js:30:27)
        at HTMLUnknownElement.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:157:21)
        at Object.invokeGuardedCallbackDev (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:138:16)
        at invokeGuardedCallback (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:187:29)
        at replayUnitOfWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:15194:5)
        at renderRoot (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:15840:11)
        at performWorkOnRoot (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:16437:22)
        at performWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:16358:7)
        at performSyncWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:16330:3)
        at requestWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:16230:5)
        at scheduleWork$1 (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:16096:11)
        at scheduleRootUpdate (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:16663:3)
        at updateContainerAtExpirationTime (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:16690:10)
        at updateContainer (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:16717:10)
        at ReactRoot.Object.<anonymous>.ReactRoot.render (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:17000:3)
        at /Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:17140:14
        at unbatchedUpdates (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:16557:10)
        at legacyRenderSubtreeIntoContainer (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:17136:5)
        at Object.render (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:17195:12)
        at Object.render (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/enzyme-adapter-react-16/build/ReactSixteenAdapter.js:218:50)
        at new ReactWrapper (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/enzyme/build/ReactWrapper.js:98:16)
        at mount (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/enzyme/build/mount.js:19:10)
        at Object.<anonymous> (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/test/integration/pages/about.spec.jsx:27:31)
        at Object.asyncFn (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-jasmine2/build/jasmine_async.js:51:37)
        at resolve (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-jasmine2/build/queue_runner.js:52:12)
        at new Promise (<anonymous>)
        at mapper (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-jasmine2/build/queue_runner.js:39:19)
        at promise.then (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-jasmine2/build/queue_runner.js:73:82)
        at <anonymous>
        at process._tickCallback (internal/process/next_tick.js:188:7)

  console.error node_modules/jsdom/lib/jsdom/virtual-console.js:29
    Error: Uncaught [TypeError: Cannot read property 'history' of undefined]
        at reportException (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/helpers/runtime-script-errors.js:66:24)
        at invokeEventListeners (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:209:9)
        at HTMLUnknownElementImpl._dispatch (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:119:9)
        at HTMLUnknownElementImpl.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:82:17)
        at HTMLUnknownElementImpl.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/nodes/HTMLElement-impl.js:30:27)
        at HTMLUnknownElement.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:157:21)
        at Object.invokeGuardedCallbackDev (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:138:16)
        at invokeGuardedCallback (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:187:29)
        at replayUnitOfWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:15194:5)
        at renderRoot (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:15840:11) TypeError: Cannot read property 'history' of undefined
        at new GatsbyLink (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/gatsby-link/index.js:82:35)
        at constructClassInstance (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:11333:18)
        at updateClassComponent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:13036:7)
        at beginWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:13715:14)
        at performUnitOfWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:15741:12)
        at workLoop (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:15780:24)
        at HTMLUnknownElement.callCallback (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:100:14)
        at invokeEventListeners (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:193:27)
        at HTMLUnknownElementImpl._dispatch (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:119:9)
        at HTMLUnknownElementImpl.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:82:17)
        at HTMLUnknownElementImpl.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/nodes/HTMLElement-impl.js:30:27)
        at HTMLUnknownElement.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:157:21)
        at Object.invokeGuardedCallbackDev (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:138:16)
        at invokeGuardedCallback (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:187:29)
        at replayUnitOfWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:15194:5)
        at renderRoot (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:15840:11)
        at performWorkOnRoot (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:16437:22)
        at performWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:16358:7)
        at performSyncWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:16330:3)
        at requestWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:16230:5)
        at scheduleWork$1 (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:16096:11)
        at scheduleRootUpdate (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:16663:3)
        at updateContainerAtExpirationTime (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:16690:10)
        at updateContainer (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:16717:10)
        at ReactRoot.Object.<anonymous>.ReactRoot.render (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:17000:3)
        at /Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:17140:14
        at unbatchedUpdates (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:16557:10)
        at legacyRenderSubtreeIntoContainer (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:17136:5)
        at Object.render (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:17195:12)
        at Object.render (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/enzyme-adapter-react-16/build/ReactSixteenAdapter.js:218:50)
        at new ReactWrapper (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/enzyme/build/ReactWrapper.js:98:16)
        at mount (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/enzyme/build/mount.js:19:10)
        at Object.<anonymous> (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/test/integration/pages/about.spec.jsx:27:31)
        at Object.asyncFn (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-jasmine2/build/jasmine_async.js:51:37)
        at resolve (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-jasmine2/build/queue_runner.js:52:12)
        at new Promise (<anonymous>)
        at mapper (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-jasmine2/build/queue_runner.js:39:19)
        at promise.then (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-jasmine2/build/queue_runner.js:73:82)
        at <anonymous>
        at process._tickCallback (internal/process/next_tick.js:188:7)

  console.error node_modules/jsdom/lib/jsdom/virtual-console.js:29
    Error: Uncaught [TypeError: Cannot read property 'history' of undefined]
        at reportException (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/helpers/runtime-script-errors.js:66:24)
        at invokeEventListeners (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:209:9)
        at HTMLUnknownElementImpl._dispatch (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:119:9)
        at HTMLUnknownElementImpl.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:82:17)
        at HTMLUnknownElementImpl.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/nodes/HTMLElement-impl.js:30:27)
        at HTMLUnknownElement.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:157:21)
        at Object.invokeGuardedCallbackDev (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:138:16)
        at invokeGuardedCallback (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:187:29)
        at replayUnitOfWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:15194:5)
        at renderRoot (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:15840:11) TypeError: Cannot read property 'history' of undefined
        at new GatsbyLink (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/gatsby-link/index.js:82:35)
        at constructClassInstance (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:11333:18)
        at updateClassComponent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:13036:7)
        at beginWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:13715:14)
        at performUnitOfWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:15741:12)
        at workLoop (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:15780:24)
        at HTMLUnknownElement.callCallback (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:100:14)
        at invokeEventListeners (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:193:27)
        at HTMLUnknownElementImpl._dispatch (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:119:9)
        at HTMLUnknownElementImpl.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:82:17)
        at HTMLUnknownElementImpl.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/nodes/HTMLElement-impl.js:30:27)
        at HTMLUnknownElement.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:157:21)
        at Object.invokeGuardedCallbackDev (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:138:16)
        at invokeGuardedCallback (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:187:29)
        at replayUnitOfWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:15194:5)
        at renderRoot (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:15840:11)
        at performWorkOnRoot (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:16437:22)
        at performWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:16358:7)
        at performSyncWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:16330:3)
        at requestWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:16230:5)
        at scheduleWork$1 (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:16096:11)
        at scheduleRootUpdate (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:16663:3)
        at updateContainerAtExpirationTime (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:16690:10)
        at updateContainer (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:16717:10)
        at ReactRoot.Object.<anonymous>.ReactRoot.render (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:17000:3)
        at /Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:17140:14
        at unbatchedUpdates (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:16557:10)
        at legacyRenderSubtreeIntoContainer (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:17136:5)
        at Object.render (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:17195:12)
        at Object.render (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/enzyme-adapter-react-16/build/ReactSixteenAdapter.js:218:50)
        at new ReactWrapper (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/enzyme/build/ReactWrapper.js:98:16)
        at mount (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/enzyme/build/mount.js:19:10)
        at Object.<anonymous> (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/test/integration/pages/about.spec.jsx:27:31)
        at Object.asyncFn (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-jasmine2/build/jasmine_async.js:51:37)
        at resolve (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-jasmine2/build/queue_runner.js:52:12)
        at new Promise (<anonymous>)
        at mapper (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-jasmine2/build/queue_runner.js:39:19)
        at promise.then (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-jasmine2/build/queue_runner.js:73:82)
        at <anonymous>
        at process._tickCallback (internal/process/next_tick.js:188:7)

  console.error node_modules/jsdom/lib/jsdom/virtual-console.js:29
    Error: Uncaught [TypeError: Cannot read property 'history' of undefined]
        at reportException (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/helpers/runtime-script-errors.js:66:24)
        at invokeEventListeners (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:209:9)
        at HTMLUnknownElementImpl._dispatch (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:119:9)
        at HTMLUnknownElementImpl.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:82:17)
        at HTMLUnknownElementImpl.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/nodes/HTMLElement-impl.js:30:27)
        at HTMLUnknownElement.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:157:21)
        at Object.invokeGuardedCallbackDev (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:138:16)
        at invokeGuardedCallback (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:187:29)
        at replayUnitOfWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:15194:5)
        at renderRoot (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:15840:11) TypeError: Cannot read property 'history' of undefined
        at new GatsbyLink (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/gatsby-link/index.js:82:35)
        at constructClassInstance (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:11333:18)
        at updateClassComponent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:13036:7)
        at beginWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:13715:14)
        at performUnitOfWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:15741:12)
        at workLoop (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:15780:24)
        at HTMLUnknownElement.callCallback (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:100:14)
        at invokeEventListeners (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:193:27)
        at HTMLUnknownElementImpl._dispatch (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:119:9)
        at HTMLUnknownElementImpl.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:82:17)
        at HTMLUnknownElementImpl.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/nodes/HTMLElement-impl.js:30:27)
        at HTMLUnknownElement.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:157:21)
        at Object.invokeGuardedCallbackDev (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:138:16)
        at invokeGuardedCallback (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:187:29)
        at replayUnitOfWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:15194:5)
        at renderRoot (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:15840:11)
        at performWorkOnRoot (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:16437:22)
        at performWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:16358:7)
        at performSyncWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:16330:3)
        at requestWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:16230:5)
        at scheduleWork$1 (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:16096:11)
        at scheduleRootUpdate (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:16663:3)
        at updateContainerAtExpirationTime (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:16690:10)
        at updateContainer (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:16717:10)
        at ReactRoot.Object.<anonymous>.ReactRoot.render (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:17000:3)
        at /Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:17140:14
        at unbatchedUpdates (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:16557:10)
        at legacyRenderSubtreeIntoContainer (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:17136:5)
        at Object.render (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-dom/cjs/react-dom.development.js:17195:12)
        at Object.render (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/enzyme-adapter-react-16/build/ReactSixteenAdapter.js:218:50)
        at new ReactWrapper (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/enzyme/build/ReactWrapper.js:98:16)
        at mount (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/enzyme/build/mount.js:19:10)
        at Object.<anonymous> (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/test/integration/pages/about.spec.jsx:27:31)
        at Object.asyncFn (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-jasmine2/build/jasmine_async.js:51:37)
        at resolve (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-jasmine2/build/queue_runner.js:52:12)
        at new Promise (<anonymous>)
        at mapper (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-jasmine2/build/queue_runner.js:39:19)
        at promise.then (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-jasmine2/build/queue_runner.js:73:82)
        at <anonymous>
        at process._tickCallback (internal/process/next_tick.js:188:7)

  console.error node_modules/react-dom/cjs/react-dom.development.js:14113
    The above error occurred in the <GatsbyLink> component:
        in GatsbyLink (created by Header)
        in div (created by Header)
        in Header (created by Layout)
        in section (created by Layout)
        in div (created by Layout)
        in Layout (created by PublicationsPage)
        in PublicationsPage (created by WrapperComponent)
        in WrapperComponent

    Consider adding an error boundary to your tree to customize error handling behavior.
    Visit https://fb.me/react-error-boundaries to learn more about error boundaries.

  console.error node_modules/react-dom/cjs/react-dom.development.js:14113
    The above error occurred in the <GatsbyLink> component:
        in GatsbyLink (created by Naviagation)
        in li (created by Naviagation)
        in ul (created by Naviagation)
        in nav (created by Naviagation)
        in div (created by Naviagation)
        in Naviagation (created by Layout)
        in section (created by Layout)
        in div (created by Layout)
        in Layout (created by PublicationsPage)
        in PublicationsPage (created by WrapperComponent)
        in WrapperComponent

    Consider adding an error boundary to your tree to customize error handling behavior.
    Visit https://fb.me/react-error-boundaries to learn more about error boundaries.

  console.error node_modules/react-dom/cjs/react-dom.development.js:14113
    The above error occurred in the <GatsbyLink> component:
        in GatsbyLink (created by Naviagation)
        in li (created by Naviagation)
        in ul (created by Naviagation)
        in nav (created by Naviagation)
        in div (created by Naviagation)
        in Naviagation (created by Layout)
        in section (created by Layout)
        in div (created by Layout)
        in Layout (created by PublicationsPage)
        in PublicationsPage (created by WrapperComponent)
        in WrapperComponent

    Consider adding an error boundary to your tree to customize error handling behavior.
    Visit https://fb.me/react-error-boundaries to learn more about error boundaries.

  console.error node_modules/react-dom/cjs/react-dom.development.js:14113
    The above error occurred in the <GatsbyLink> component:
        in GatsbyLink (created by Naviagation)
        in li (created by Naviagation)
        in ul (created by Naviagation)
        in nav (created by Naviagation)
        in div (created by Naviagation)
        in Naviagation (created by Layout)
        in section (created by Layout)
        in div (created by Layout)
        in Layout (created by PublicationsPage)
 FAIL  test/integration/pages/about.spec.jsxperComponent)
  About Page
    default state
      โœ• should be defined (95ms)
      โ—‹ skipped 8 tests
    Speaking Content Section
      โ—‹ skipped 1 test
    Writing Content Section
      โ—‹ skipped 2 tests

  โ— About Page โ€บ default state โ€บ should be defined

    TypeError: Cannot read property 'history' of undefined

      10 |
      11 |   beforeEach(() => {
    > 12 |     about = mount(<About/>);
      13 |   });
      14 |
      15 |   describe('default state', () => {

      at new GatsbyLink (node_modules/gatsby-link/index.js:82:35)
      at constructClassInstance (node_modules/react-dom/cjs/react-dom.development.js:11333:18)
      at updateClassComponent (node_modules/react-dom/cjs/react-dom.development.js:13036:7)
      at beginWork (node_modules/react-dom/cjs/react-dom.development.js:13715:14)
      at performUnitOfWork (node_modules/react-dom/cjs/react-dom.development.js:15741:12)
      at workLoop (node_modules/react-dom/cjs/react-dom.development.js:15780:24)
      at renderRoot (node_modules/react-dom/cjs/react-dom.development.js:15820:7)
      at performWorkOnRoot (node_modules/react-dom/cjs/react-dom.development.js:16437:22)
      at performWork (node_modules/react-dom/cjs/react-dom.development.js:16358:7)
      at performSyncWork (node_modules/react-dom/cjs/react-dom.development.js:16330:3)
      at requestWork (node_modules/react-dom/cjs/react-dom.development.js:16230:5)
      at scheduleWork$1 (node_modules/react-dom/cjs/react-dom.development.js:16096:11)
      at scheduleRootUpdate (node_modules/react-dom/cjs/react-dom.development.js:16663:3)
      at updateContainerAtExpirationTime (node_modules/react-dom/cjs/react-dom.development.js:16690:10)
      at updateContainer (node_modules/react-dom/cjs/react-dom.development.js:16717:10)
      at ReactRoot.Object.<anonymous>.ReactRoot.render (node_modules/react-dom/cjs/react-dom.development.js:17000:3)
      at node_modules/react-dom/cjs/react-dom.development.js:17140:14
      at unbatchedUpdates (node_modules/react-dom/cjs/react-dom.development.js:16557:10)
      at legacyRenderSubtreeIntoContainer (node_modules/react-dom/cjs/react-dom.development.js:17136:5)
      at Object.render (node_modules/react-dom/cjs/react-dom.development.js:17195:12)
      at Object.render (node_modules/enzyme-adapter-react-16/build/ReactSixteenAdapter.js:218:50)
      at new ReactWrapper (node_modules/enzyme/build/ReactWrapper.js:98:16)
      at mount (node_modules/enzyme/build/mount.js:19:10)
      at Object.<anonymous> (test/integration/pages/about.spec.jsx:12:13)

  โ— About Page โ€บ default state โ€บ should be defined

    expect(received).toBeDefined()

    Expected value to be defined, instead received
      undefined

      16 |
      17 |     it('should be defined', () => {
    > 18 |       expect(about).toBeDefined();
      19 |       expect(about.find('#about').length).toBe(1);
      20 |     });
      21 |

      at Object.<anonymous> (test/integration/pages/about.spec.jsx:18:21)

Test Suites: 1 failed, 1 skipped, 8 passed, 9 of 10 total
Tests:       1 failed, 14 skipped, 45 passed, 60 total
Snapshots:   0 total
Time:        3.422s
Ran all test suites.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Environment


  System:
    OS: macOS High Sierra 10.13.5
    CPU: x64 Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 8.9.4 - /usr/local/bin/node
    Yarn: 1.7.0 - /usr/local/bin/yarn
    npm: 5.6.0 - /usr/local/bin/npm
  Browsers:
    Chrome: 67.0.3396.99
    Firefox: 60.0.1
    Safari: 11.1.1
  npmPackages:
    gatsby: ^2.0.0-beta.1 => 2.0.0-beta.1 
    gatsby-cli: ^1.1.58 => 1.1.58 
    gatsby-plugin-google-analytics: ^1.0.20-10 => 1.0.20-10 
    gatsby-plugin-react-helmet: ^2.0.12-7 => 2.0.12-7 
    gatsby-plugin-sitemap: ^1.2.14-10 => 1.2.14-10 
    gatsby-plugin-typography: ^2.0.1-11 => 2.0.1-11 

File contents (if changed)

gatsby-config.js: N/A
package.json: N/A
gatsby-node.js: N/A
gatsby-browser.js: N/A
gatsby-ssr.js: N/A

question or discussion

All 7 comments

Wrapping your component in a MemoryRouter should fix this. e.g.

<MemoryRouter><About /></MemoryRouter>

I'm not sure of the best place to document this, or if there's a way to remove the need for it.

Thanks @ascorbic , will give that a try!

@ascorbic
I gave that a try and got the same result unfortunately. I see there have been a couple more beta releases of Gatsby, let me see if upgrading helps.

FWIW, here is my repo and branch with the v2 upgrade work I'm referencing.

Hmm, so I upgraded to 2.0.0-beta.18 and now commented out specs are giving me trouble, even when wrapping in MemoryModule

component

import React from 'react';
import { Link } from 'gatsby';
import './header.css';

const Header = () => {
  return (
    <div className="header"> 
      <Link to="/">
        <header></header>
        <h2 className="caption">A DREAMER BY DESIGN</h2>
      </Link>
    </div>
  );
};

export default Header;

spec

import * as React from 'react';
import { mount, configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import Header from './header';
import { MemoryRouter } from 'react-router-dom';

configure({ adapter: new Adapter() });

describe('Header Component', () => {
  let header;

  beforeEach(() => {
    header = mount(<MemoryRouter><Header/></MemoryRouter>);
  });

  it('should not be null', () => {
    expect(header).not.toBeNull();
    expect(header.find('.header').length).toEqual(1);
  });

});

error

 FAIL  src/components/header/header.spec.jsx
  โ— Test suite failed to run

    /Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/gatsby/cache-dir/gatsby-browser-entry.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import React from "react"
                                                                                             ^^^^^^

    SyntaxError: Unexpected token import

       9 |     <div className="header">
      10 |       <Link to="/">
    > 11 |         <header></header>
      12 |         <h2 className="caption">A DREAMER BY DESIGN</h2>
      13 |       </Link>
      14 |     </div>

      at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/script_transformer.js:316:17)
      at Object.<anonymous> (src/components/header/header.jsx:11:15)
      at Object.<anonymous> (src/components/header/header.spec.jsx:13:15)

@ascorbic
Thanks for the great work on the Jest Testing Guide, it was really helpful and I've updated my testing environment to include all your recommendations.

Unfortunately I am still seeing an error (although it is a new one). I have upgraded to the latest version of Gatsby in this process (2.0.0-beta.61).

In short, my beforeEach now looks like this

  beforeEach(() => {
    about = mount(
      <MemoryRouter>
        <About/>
      </MemoryRouter>
    );
  });

  // a basic example with test renderer
  beforeEach(() => {
    about = TestRenderer.create(
      <MemoryRouter>
        <About/>
      </MemoryRouter>
    );
  });


  describe('default state', () => {

    it('should be defined', () => {
      expect(about).toBeDefined();
      // expect(about.find('#about').length).toBe(1);
    });
  });

The error

yarn run v1.7.0
Test Suites: 8 passed, 8 of 13 total
Tests:       2 skipped, 45 passed, 47 total
Snapshots:   0 total
  console.error node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/virtual-console.js:29
    Error: Uncaught [ReferenceError: ___loader is not defined]
        at reportException (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/helpers/runtime-script-errors.js:66:24)
        at invokeEventListeners (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:209:9)
        at HTMLUnknownElementImpl._dispatch (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:119:9)
        at HTMLUnknownElementImpl.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:82:17)
        at HTMLUnknownElementImpl.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/nodes/HTMLElement-impl.js:30:27)
        at HTMLUnknownElement.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:157:21)
        at Object.invokeGuardedCallbackDev (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:1937:16)
        at invokeGuardedCallback (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:1986:29)
        at commitRoot (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:7681:7)
        at completeRoot (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8650:34) ReferenceError: ___loader is not defined
        at GatsbyLink.componentDidMount (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/gatsby-link/index.js:116:7)
        at commitLifeCycles (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:6444:22)
        at commitAllLifeCycles (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:7540:7)
        at HTMLUnknownElement.callCallback (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:1899:14)
        at invokeEventListeners (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:193:27)
        at HTMLUnknownElementImpl._dispatch (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:119:9)
        at HTMLUnknownElementImpl.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:82:17)
        at HTMLUnknownElementImpl.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/nodes/HTMLElement-impl.js:30:27)
        at HTMLUnknownElement.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:157:21)
        at Object.invokeGuardedCallbackDev (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:1937:16)
        at invokeGuardedCallback (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:1986:29)
        at commitRoot (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:7681:7)
        at completeRoot (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8650:34)
        at performWorkOnRoot (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8595:9)
        at performWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8527:7)
        at performSyncWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8499:3)
        at requestWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8399:5)
        at scheduleWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8274:11)
        at scheduleRootUpdate (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8739:3)
        at updateContainerAtExpirationTime (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8766:10)
        at updateContainer (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8777:10)
        at Object.create (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:9260:5)
        at Object.<anonymous> (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/test/integration/pages/about.spec.jsx:14:26)
        at Object.asyncFn (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-jasmine2/build/jasmine_async.js:63:37)
        at resolve (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-jasmine2/build/queue_runner.js:56:12)
        at new Promise (<anonymous>)
        at mapper (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-jasmine2/build/queue_runner.js:43:19)
        at promise.then (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-jasmine2/build/queue_runner.js:87:41)
        at <anonymous>
        at process._tickCallback (internal/process/next_tick.js:188:7)

  console.error node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/virtual-console.js:29
    Error: Uncaught [ReferenceError: ___loader is not defined]
        at reportException (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/helpers/runtime-script-errors.js:66:24)
        at invokeEventListeners (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:209:9)
        at HTMLUnknownElementImpl._dispatch (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:119:9)
        at HTMLUnknownElementImpl.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:82:17)
        at HTMLUnknownElementImpl.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/nodes/HTMLElement-impl.js:30:27)
        at HTMLUnknownElement.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:157:21)
        at Object.invokeGuardedCallbackDev (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:1937:16)
        at invokeGuardedCallback (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:1986:29)
        at commitRoot (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:7681:7)
        at completeRoot (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8650:34) ReferenceError: ___loader is not defined
        at GatsbyLink.componentDidMount (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/gatsby-link/index.js:116:7)
        at commitLifeCycles (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:6444:22)
        at commitAllLifeCycles (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:7540:7)
        at HTMLUnknownElement.callCallback (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:1899:14)
        at invokeEventListeners (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:193:27)
        at HTMLUnknownElementImpl._dispatch (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:119:9)
        at HTMLUnknownElementImpl.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:82:17)
        at HTMLUnknownElementImpl.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/nodes/HTMLElement-impl.js:30:27)
        at HTMLUnknownElement.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:157:21)
        at Object.invokeGuardedCallbackDev (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:1937:16)
        at invokeGuardedCallback (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:1986:29)
        at commitRoot (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:7681:7)
        at completeRoot (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8650:34)
        at performWorkOnRoot (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8595:9)
        at performWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8527:7)
        at performSyncWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8499:3)
        at requestWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8399:5)
        at scheduleWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8274:11)
        at scheduleRootUpdate (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8739:3)
        at updateContainerAtExpirationTime (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8766:10)
        at updateContainer (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8777:10)
        at Object.create (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:9260:5)
        at Object.<anonymous> (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/test/integration/pages/about.spec.jsx:14:26)
        at Object.asyncFn (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-jasmine2/build/jasmine_async.js:63:37)
        at resolve (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-jasmine2/build/queue_runner.js:56:12)
        at new Promise (<anonymous>)
        at mapper (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-jasmine2/build/queue_runner.js:43:19)
        at promise.then (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-jasmine2/build/queue_runner.js:87:41)
        at <anonymous>
        at process._tickCallback (internal/process/next_tick.js:188:7)

  console.error node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/virtual-console.js:29
    Error: Uncaught [ReferenceError: ___loader is not defined]
        at reportException (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/helpers/runtime-script-errors.js:66:24)
        at invokeEventListeners (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:209:9)
        at HTMLUnknownElementImpl._dispatch (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:119:9)
        at HTMLUnknownElementImpl.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:82:17)
        at HTMLUnknownElementImpl.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/nodes/HTMLElement-impl.js:30:27)
        at HTMLUnknownElement.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:157:21)
        at Object.invokeGuardedCallbackDev (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:1937:16)
        at invokeGuardedCallback (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:1986:29)
        at commitRoot (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:7681:7)
        at completeRoot (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8650:34) ReferenceError: ___loader is not defined
        at GatsbyLink.componentDidMount (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/gatsby-link/index.js:116:7)
        at commitLifeCycles (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:6444:22)
        at commitAllLifeCycles (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:7540:7)
        at HTMLUnknownElement.callCallback (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:1899:14)
        at invokeEventListeners (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:193:27)
        at HTMLUnknownElementImpl._dispatch (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:119:9)
        at HTMLUnknownElementImpl.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:82:17)
        at HTMLUnknownElementImpl.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/nodes/HTMLElement-impl.js:30:27)
        at HTMLUnknownElement.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:157:21)
        at Object.invokeGuardedCallbackDev (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:1937:16)
        at invokeGuardedCallback (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:1986:29)
        at commitRoot (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:7681:7)
        at completeRoot (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8650:34)
        at performWorkOnRoot (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8595:9)
        at performWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8527:7)
        at performSyncWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8499:3)
        at requestWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8399:5)
        at scheduleWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8274:11)
        at scheduleRootUpdate (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8739:3)
        at updateContainerAtExpirationTime (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8766:10)
        at updateContainer (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8777:10)
        at Object.create (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:9260:5)
        at Object.<anonymous> (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/test/integration/pages/about.spec.jsx:14:26)
        at Object.asyncFn (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-jasmine2/build/jasmine_async.js:63:37)
        at resolve (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-jasmine2/build/queue_runner.js:56:12)
        at new Promise (<anonymous>)
        at mapper (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-jasmine2/build/queue_runner.js:43:19)
        at promise.then (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-jasmine2/build/queue_runner.js:87:41)
        at <anonymous>
        at process._tickCallback (internal/process/next_tick.js:188:7)

  console.error node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/virtual-console.js:29
    Error: Uncaught [ReferenceError: ___loader is not defined]
        at reportException (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/helpers/runtime-script-errors.js:66:24)
        at invokeEventListeners (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:209:9)
        at HTMLUnknownElementImpl._dispatch (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:119:9)
        at HTMLUnknownElementImpl.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:82:17)
        at HTMLUnknownElementImpl.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/nodes/HTMLElement-impl.js:30:27)
        at HTMLUnknownElement.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:157:21)
        at Object.invokeGuardedCallbackDev (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:1937:16)
        at invokeGuardedCallback (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:1986:29)
        at commitRoot (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:7681:7)
        at completeRoot (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8650:34) ReferenceError: ___loader is not defined
        at GatsbyLink.componentDidMount (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/gatsby-link/index.js:116:7)
        at commitLifeCycles (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:6444:22)
        at commitAllLifeCycles (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:7540:7)
        at HTMLUnknownElement.callCallback (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:1899:14)
        at invokeEventListeners (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:193:27)
        at HTMLUnknownElementImpl._dispatch (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:119:9)
        at HTMLUnknownElementImpl.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:82:17)
        at HTMLUnknownElementImpl.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/nodes/HTMLElement-impl.js:30:27)
        at HTMLUnknownElement.dispatchEvent (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:157:21)
        at Object.invokeGuardedCallbackDev (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:1937:16)
        at invokeGuardedCallback (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:1986:29)
        at commitRoot (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:7681:7)
        at completeRoot (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8650:34)
        at performWorkOnRoot (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8595:9)
        at performWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8527:7)
        at performSyncWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8499:3)
        at requestWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8399:5)
        at scheduleWork (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8274:11)
        at scheduleRootUpdate (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8739:3)
        at updateContainerAtExpirationTime (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8766:10)
        at updateContainer (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8777:10)
        at Object.create (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:9260:5)
        at Object.<anonymous> (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/test/integration/pages/about.spec.jsx:14:26)
        at Object.asyncFn (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-jasmine2/build/jasmine_async.js:63:37)
        at resolve (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-jasmine2/build/queue_runner.js:56:12)
        at new Promise (<anonymous>)
        at mapper (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-jasmine2/build/queue_runner.js:43:19)
        at promise.then (/Users/owenbuckley/Workspace/thegreenhouse.io/repo/www.thegreenhouse.io/node_modules/jest-jasmine2/build/queue_runner.js:87:41)
        at <anonymous>
        at process._tickCallback (internal/process/next_tick.js:188:7)

  console.error node_modules/react-test-renderer/cjs/react-test-renderer.development.js:6309
    The above error occurred in the <GatsbyLink> component:
        in GatsbyLink (created by Header)
        in div (created by Header)
        in Header (created by Layout)
        in section (created by Layout)
        in div (created by Layout)
        in Layout (created by PublicationsPage)
        in PublicationsPage
        in Router (created by MemoryRouter)
        in MemoryRouter

    Consider adding an error boundary to your tree to customize error handling behavior.
    Visit https://fb.me/react-error-boundaries to learn more about error boundaries.

  console.error node_modules/react-test-renderer/cjs/react-test-renderer.development.js:6309
    The above error occurred in the <GatsbyLink> component:
        in GatsbyLink (created by Naviagation)
        in li (created by Naviagation)
        in ul (created by Naviagation)
        in nav (created by Naviagation)
        in div (created by Naviagation)
        in Naviagation (created by Layout)
        in section (created by Layout)
        in div (created by Layout)
        in Layout (created by PublicationsPage)
        in PublicationsPage
        in Router (created by MemoryRouter)
        in MemoryRouter

    Consider adding an error boundary to your tree to customize error handling behavior.
    Visit https://fb.me/react-error-boundaries to learn more about error boundaries.

  console.error node_modules/react-test-renderer/cjs/react-test-renderer.development.js:6309
    The above error occurred in the <GatsbyLink> component:
        in GatsbyLink (created by Naviagation)
        in li (created by Naviagation)
        in ul (created by Naviagation)
        in nav (created by Naviagation)
        in div (created by Naviagation)
        in Naviagation (created by Layout)
        in section (created by Layout)
        in div (created by Layout)
        in Layout (created by PublicationsPage)
        in PublicationsPage
        in Router (created by MemoryRouter)
        in MemoryRouter

    Consider adding an error boundary to your tree to customize error handling behavior.
    Visit https://fb.me/react-error-boundaries to learn more about error boundaries.

  console.error node_modules/react-test-renderer/cjs/react-test-renderer.development.js:6309
    The above error occurred in the <GatsbyLink> component:
        in GatsbyLink (created by Naviagation)
        in li (created by Naviagation)
        in ul (created by Naviagation)
        in nav (created by Naviagation)
        in div (created by Naviagation)
        in Naviagation (created by Layout)
        in section (created by Layout)
 FAIL  test/integration/pages/about.spec.jsx
  About Page
    default state
      โœ• should be defined (79ms)
    Speaking Content Section
      โ—‹ skipped 1 test
    Writing Content Section
      โ—‹ skipped 2 tests

  โ— About Page โ€บ default state โ€บ should be defined

    ReferenceError: ___loader is not defined

      12 |
      13 |   beforeEach(() => {
    > 14 |     about = TestRenderer.create(
         |                          ^
      15 |       <MemoryRouter>
      16 |         <About/>
      17 |       </MemoryRouter>

      at GatsbyLink.componentDidMount (node_modules/gatsby-link/index.js:116:7)
      at commitLifeCycles (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:6444:22)
      at commitAllLifeCycles (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:7540:7)
      at HTMLUnknownElement.callCallback (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:1899:14)
      at Object.invokeGuardedCallbackDev (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:1937:16)
      at invokeGuardedCallback (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:1986:29)
      at commitRoot (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:7681:7)
      at completeRoot (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8650:34)
      at performWorkOnRoot (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8595:9)
      at performWork (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8527:7)
      at performSyncWork (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8499:3)
      at requestWork (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8399:5)
      at scheduleWork (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8274:11)
      at scheduleRootUpdate (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8739:3)
      at updateContainerAtExpirationTime (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8766:10)
      at updateContainer (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8777:10)
      at Object.create (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:9260:5)
      at Object.<anonymous> (test/integration/pages/about.spec.jsx:14:26)

  โ— About Page โ€บ default state โ€บ should be defined

    expect(received).toBeDefined()

    Received: undefined

      22 |
      23 |     it('should be defined', () => {
    > 24 |       expect(about).toBeDefined();
         |                     ^
      25 |       // expect(about.find('#about').length).toBe(1);
      26 |     });
      27 |

      at Object.<anonymous> (test/integration/pages/about.spec.jsx:24:21)

Test Suites: 1 failed, 4 skipped, 8 passed, 9 of 13 total
Tests:       1 failed, 14 skipped, 45 passed, 60 total
Snapshots:   0 total
Time:        6.895s
Ran all test suites.

Watch Usage: Press w to show more.

The latest code here

I also tried installing react-router-dom and jsdom as a devDependency but got the same output.

Any thoughts would be much appreciated!

I will give react-test-renderer a try in the meantime.

Update @ascorbic !!

I think I've found a solution! From this thread

Added this in my beforeEach

    global.___loader = {
      enqueue: jest.fn()
    };

And now the error is gone and some of the tests are passing. Some issues around accessing state though

 test/integration/pages/about.spec.jsx
  About Page
    default state
      โœ“ should be defined (98ms)
      โœ“ should have a sub heading (48ms)
      โœ“ should have sub nav links (52ms)
      โœ“ should have a content section (43ms)
      โœ• should have the Speaking Content section be the active section by default (44ms)
      โœ“ should NOT have any other content sections displayed by default (51ms)
      โœ• should have articles (33ms)
      โœ• should have presentations (38ms)
      โœ• should have social links (26ms)
    Speaking Content Section
      โ—‹ skipped 1 test
    Writing Content Section
      โ—‹ skipped 2 tests

  โ— About Page โ€บ default state โ€บ should have the Speaking Content section be the active section by default

    TypeError: Cannot read property 'activeSection' of null

      54 |
      55 |     it('should have the Speaking Content section be the active section by default', () => {
    > 56 |       expect(about.state().activeSection).toBe('SPEAKING');
         |              ^
      57 |       expect(about.find('.content-speaking').length).toBe(1);
      58 |     });
      59 |

      at Object.<anonymous> (test/integration/pages/about.spec.jsx:56:14)

  โ— About Page โ€บ default state โ€บ should have articles

    TypeError: Cannot read property 'articles' of null

      63 |
      64 |     it('should have articles', () => {
    > 65 |       expect(about.state().articles.length).toBeGreaterThanOrEqual(1);
         |              ^
      66 |     });
      67 |
      68 |     it('should have presentations', () => {

      at Object.<anonymous> (test/integration/pages/about.spec.jsx:65:14)

  โ— About Page โ€บ default state โ€บ should have presentations

    TypeError: Cannot read property 'presentations' of null

      67 |
      68 |     it('should have presentations', () => {
    > 69 |       expect(about.state().presentations.length).toBeGreaterThanOrEqual(1);
         |              ^
      70 |     });
      71 |
      72 |     it('should have social links', () => {

      at Object.<anonymous> (test/integration/pages/about.spec.jsx:69:14)

  โ— About Page โ€บ default state โ€บ should have social links

    TypeError: Cannot read property 'socialLinksMap' of null

      71 |
      72 |     it('should have social links', () => {
    > 73 |       expect(about.state().socialLinksMap).toBeDefined();
         |              ^
      74 |     });
      75 |   });
      76 |

      at Object.<anonymous> (test/integration/pages/about.spec.jsx:73:14)

Test Suites: 1 failed, 4 skipped, 8 passed, 9 of 13 total
Tests:       4 failed, 14 skipped, 50 passed, 68 total
Snapshots:   0 total
Time:        6.851s
Ran all test suites.

So not sure if that's a React or Enzyme thing, but this seems like an promising development.

EDIT
My guess is the passing tests are a false positive. I think the issue to resolve now is that (with either Enzyme or ReactTestRender) <MemoryRouter> is now the root component code being returned, not <About/>, so all the tests looking to test <About> need to go down three a node / child first. Will hack away and see what I can come up with.

@ascorbic
So if I don't include those state() calling tests, I would say I still have a pretty good testing suite, IMO.

Changes:

  1. Add <MemoryRouter/> (per Testing Guide)
  2. Added globals.___loader.enqueue shim, per #2932
  3. return children from Enzyme mount just to avoid having the additional <MemoryRouter/> component in my tree (just my personal preference)
  4. don't test internals ๐Ÿ˜Š

Otherwise, I didn't have to touch anything about my tests! ๐ŸŽ‰

Final Code

import * as React from 'react';
import { mount, configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import { MemoryRouter } from 'react-router-dom';
import About from '../../../src/pages/about';

configure({ adapter: new Adapter() });

describe('About Page', () => {
  let about;

  global.___loader = { // eslint-disable-line no-underscore-dangle
    enqueue: jest.fn()
  };

  beforeEach(() => {
    about = mount(
      <MemoryRouter>
        <About/>
      </MemoryRouter>
    ).children();
  });

  describe('default state', () => {
    it('should be defined', () => {
      expect(about).toBeDefined();
      expect(about.find('#about').length).toBe(1);
    });

    it('should have a sub heading', () => {
      const subHeading = about.find('.sub-heading');

      expect(subHeading.length).toBe(1);
      expect(subHeading.text()).toBeDefined();
    });

    it('should have sub nav links', () => {
      const subHeading = about.find('.content-links');
      const links = subHeading.find('h2');

      expect(subHeading.length).toBe(1);
      expect(subHeading.text()).toBeDefined();
      expect(links.length).toBe(2);
    });

    it('should have a content section', () => {
      const subHeading = about.find('.content-output');

      expect(subHeading.length).toBe(1);
      expect(subHeading.text()).toBeDefined();
    });

    it('should have the Speaking Content section be the active section by default', () => {
      expect(about.find('.content-speaking').length).toBe(1);
    });

    it('should NOT have any other content sections displayed by default', () => {
      expect(about.find('.content-writing').length).toBe(0);
    });
  });

  describe('Speaking Content Section', () => {
    it('should display the speaking content when the link is clicked after another click', () => {
      about.find('.link-writing').simulate('click');
      about.find('.link-speaking').simulate('click');

      expect(about.find('.content-speaking').length).toBe(1);
      expect(about.find('.content-writing').length).toBe(0);
    });
  });

  describe('Writing Content Section', () => {
    beforeEach(() => {
      about = mount(
        <MemoryRouter>
          <About/>
        </MemoryRouter>
      );

      about.find('.link-writing').simulate('click');
    });

    it('should display speaking content when the speaking link is clicked', () => {
      expect(about.find('.content-writing').length).toBe(1);
      expect(about.find('.content-speaking').length).toBe(0);
    });

    it('should have a call to action when displayed', () => {      
      const cta = about.find('.cta');

      expect(cta.length).toBe(1);
      expect(cta.text()).toBeDefined();
    });
  });

});

Observations

With this in place, I was now able to greatly expand the amount of code I could cover that was using <Link> tag and that I had been blocked in unit testing for in v1

Coverage: Before

=============================== Coverage summary ===============================
Statements   : 73.33% ( 66/90 )
Branches     : 82.35% ( 14/17 )
Functions    : 87.5% ( 35/40 )
Lines        : 73.33% ( 66/90 )
================================================================================
Test Suites: 2 skipped, 11 passed, 11 of 13 total
Tests:       5 skipped, 63 passed, 68 total

Coverage: After

=============================== Coverage summary ===============================
Statements   : 98.72% ( 77/78 )
Branches     : 93.33% ( 14/15 )
Functions    : 100% ( 40/40 )
Lines        : 98.72% ( 77/78 )
================================================================================
Test Suites: 14 passed, 14 total
Tests:       81 passed, 81 total
Snapshots:   0 total

And just as importantly, the build is passing. ๐Ÿค“

Thanks for all the help!

@ascorbic
Let me know if any of this would be useful in the testing guide, I can comment more on it over there in that PR.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  ยท  3Comments

totsteps picture totsteps  ยท  3Comments

KyleAMathews picture KyleAMathews  ยท  3Comments

brandonmp picture brandonmp  ยท  3Comments

dustinhorton picture dustinhorton  ยท  3Comments