From aed0e9523fd92503d6901d98f161dd807f2de9e9 Mon Sep 17 00:00:00 2001 From: Ahn Date: Sat, 27 Jan 2018 18:59:35 +0100 Subject: [PATCH 1/2] Add documentation to support testing with vendor libraries --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index a50c3f4da5..867d9d1c4a 100644 --- a/README.md +++ b/README.md @@ -222,3 +222,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 From 9b8b8339746fcbcdad1923bf32e3154b50c964b5 Mon Sep 17 00:00:00 2001 From: Ahn Date: Sat, 27 Jan 2018 19:09:15 +0100 Subject: [PATCH 2/2] Mention changes in CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b39c140da..79439ed223 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ ## Changelog (master) +* 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))