Skip to content

Commit

Permalink
Add check for window on jQuery imports so build passes
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-t-james committed Oct 7, 2018
1 parent 22a0fb4 commit 1f0adbd
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
21 changes: 17 additions & 4 deletions README.md
Expand Up @@ -20,7 +20,7 @@ By doing this we can focus on creating a beautiful web experience with a focus o

## Getting Started

These instuctions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

### Prerequisites

Expand Down Expand Up @@ -51,22 +51,35 @@ You should be able to view the website locally at `http://localhost:8000/`.

In a terminal window run these commands to install jest globally and run the jest test suite.

```
```sh
$ cd vwc-site
$ yarn test
```

In a terminal window run these commands to run the jest test suite in watch mode.
<details>
<summary>If you get a Watchman Error/Warning</summary>
<br>

```sh
$ watchman shutdown-server
$ brew update
$ brew reinstall watchman
```
</details>

<br>

In a terminal window run these commands to run the jest test suite in watch mode.

```sh
$ npm -i -g jest
$ cd vwc-site
$ yarn test:watch
```

In a terminal window run these commands to view the jest coverage report.

```
```sh
$ cd vwc-site
$ yarn test:coverage
$ yarn view:coverage
Expand Down
10 changes: 6 additions & 4 deletions src/pages/index.js
Expand Up @@ -7,10 +7,12 @@ import Header from '../components/Header'

import { TroopsAtGoogle } from '../components/TroopsAtGoogle'

global.jQuery = require('../../static/vendor/jquery/dist/jquery')
require('../../static/vendor/bootstrap/dist/bootstrap')
window.$ = jQuery
window.jQuery = jQuery
if (typeof window !== `undefined`) {
global.jQuery = require('../../static/vendor/jquery/dist/jquery')
require('../../static/vendor/bootstrap/dist/bootstrap')
window.$ = jQuery
window.jQuery = jQuery
}

class IndexPage extends Component {
state = {
Expand Down

0 comments on commit 1f0adbd

Please sign in to comment.