From 6eafba85e666f12e0da4444c141b1a27cd691d79 Mon Sep 17 00:00:00 2001 From: Jamie Mason Date: Thu, 27 Jul 2017 19:43:06 +0100 Subject: [PATCH] docs(readme): add @davguij's information on typescript --- README.md | 37 +++++++++++++++++++++++++++++++++++ scripts/readme/integration.md | 36 ++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) diff --git a/README.md b/README.md index 5e5e2ee..88e3d62 100644 --- a/README.md +++ b/README.md @@ -250,6 +250,42 @@ Use the [Jasmine CLI](https://www.npmjs.com/package/jasmine) and include the pat } ``` +### TypeScript and Angular CLI Projects + +If you are using TypeScript, you might want to +`npm install @types/jasmine-expect --save-dev` in order to prevent your IDE from +complaining about the new Matchers. + +Also, if you run into TypeScript compilation errors when running your tests, +add `"jasmine-expect"` to the `"types"` array in your tests' `tsconfig` file. + +As an example, for an Angular CLI based project, this would be your +`tsconfig.spec.json` file: + +```json +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "outDir": "../out-tsc/spec", + "baseUrl": "./", + "module": "commonjs", + "target": "es5", + "types": [ + "jasmine", + "node", + "jasmine-expect" + ] + }, + "files": [ + "test.ts" + ], + "include": [ + "**/*.spec.ts", + "**/*.d.ts" + ] +} +``` + ### Sublime Text [Jasmine-Matchers-Snippets](https://github.com/JamieMason/Jasmine-Matchers-Snippets) or [Jasmine-Matchers-ES6-Snippets](https://github.com/JamieMason/Jasmine-Matchers-ES6-Snippets) can be installed with [Package Control](https://packagecontrol.io/packages/Jasmine%20Matchers%20Snippets) to ease development with Jasmine Matchers in Sublime Text. @@ -276,3 +312,4 @@ Opera | 11 - 12 Safari | 6 - 9* \* Safari 5.1 and iOS 5.1 are actually fully supported except for `toBeIso8601`. + diff --git a/scripts/readme/integration.md b/scripts/readme/integration.md index 1b47c8f..595c1b1 100644 --- a/scripts/readme/integration.md +++ b/scripts/readme/integration.md @@ -36,6 +36,42 @@ Use the [Jasmine CLI](https://www.npmjs.com/package/jasmine) and include the pat } ``` +### TypeScript and Angular CLI Projects + +If you are using TypeScript, you might want to +`npm install @types/jasmine-expect --save-dev` in order to prevent your IDE from +complaining about the new Matchers. + +Also, if you run into TypeScript compilation errors when running your tests, +add `"jasmine-expect"` to the `"types"` array in your tests' `tsconfig` file. + +As an example, for an Angular CLI based project, this would be your +`tsconfig.spec.json` file: + +```json +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "outDir": "../out-tsc/spec", + "baseUrl": "./", + "module": "commonjs", + "target": "es5", + "types": [ + "jasmine", + "node", + "jasmine-expect" + ] + }, + "files": [ + "test.ts" + ], + "include": [ + "**/*.spec.ts", + "**/*.d.ts" + ] +} +``` + ### Sublime Text [Jasmine-Matchers-Snippets](https://github.com/JamieMason/Jasmine-Matchers-Snippets) or [Jasmine-Matchers-ES6-Snippets](https://github.com/JamieMason/Jasmine-Matchers-ES6-Snippets) can be installed with [Package Control](https://packagecontrol.io/packages/Jasmine%20Matchers%20Snippets) to ease development with Jasmine Matchers in Sublime Text.