File tree Expand file tree Collapse file tree 1 file changed +29
-1
lines changed Expand file tree Collapse file tree 1 file changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,8 @@ yarn add --dev @testing-library/jasmine-dom
99
99
100
100
## Usage
101
101
102
+ ### With JavaScript
103
+
102
104
You should have a directory for helpers specified inside the helpers array in your ` jasmine.json ` file.
103
105
Example:
104
106
@@ -122,7 +124,33 @@ beforeAll(() => {
122
124
});
123
125
```
124
126
125
- That's it! You're good to go.
127
+ ### With TypeScript
128
+
129
+ Add ` "@testing-library/jasmine-dom" ` to ` types ` in the tests ` tsconfig ` (e.g. ` tsconfig.spec.json ` in an Angular project).
130
+
131
+ Example:
132
+
133
+ ``` json
134
+ {
135
+ "compilerOptions" : {
136
+ "types" : [
137
+ " jasmine" ,
138
+ " node" ,
139
+ " @testing-library/jasmine-dom"
140
+ ]
141
+ }
142
+ }
143
+ ```
144
+
145
+ In your tests setup file, (` test.ts ` in an Angular project) import jasmine-dom and add the matchers like so:
146
+
147
+ ``` typescript
148
+ import JasmineDOM from ' @testing-library/jasmine-dom/dist' ;
149
+
150
+ beforeAll (() => {
151
+ jasmine .getEnv ().addMatchers (JasmineDOM );
152
+ });
153
+ ```
126
154
127
155
## Matchers
128
156
You can’t perform that action at this time.
0 commit comments