Skip to content

Commit

Permalink
Add documentation to support testing with vendor libraries (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahnpnl authored and thymikee committed Jan 27, 2018
1 parent 2273e1f commit 8e9d860
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## Changelog (master)
* Feature: Simplify installation by adding @types/jest as a package dependency ([#116](https://github.com/thymikee/jest-preset-angular/pull/116))
* Chore: Upgrade example app to Angular 5.2 using Angular CLI 1.6 ([#116](https://github.com/thymikee/jest-preset-angular/pull/116))
* Docs: Add a configuration section with vendor libraries like jQuery ([#117](https://github.com/thymikee/jest-preset-angular/pull/117))

### v5.0.0
* Breaking: Upgrade Jest to 22 ([#109](https://github.com/thymikee/jest-preset-angular/pull/109))
Expand Down
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,3 +224,22 @@ import 'rxjs/add/operator/catch';

import './jestGlobalMocks';
```

### Allow vendor libraries like jQuery, etc...

The same like normal Jest configuration, you can load jQuery in your Jest setup file. For example your Jest setup file is `setupJest.ts` you can declare jQuery:

```
window.$ = require('path/to/jquery');
``
or
```
import $ from 'jquery';
global.$ = global.jQuery = $;
```
The same declaration can be applied to other vendor libraries.
Reference: https://github.com/facebook/jest/issues/708

0 comments on commit 8e9d860

Please sign in to comment.