You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A Jest transformer that enables **GraphQL queries in separate files**, similar to how [`graphql-tag` loader for Webpack](http://dev.apollodata.com/react/webpack.html) works.
4
-
5
-
Since Jest **does not support Webpack loaders**, this package provides the same transformation inside Jest.
3
+
A Jest transformer that allows GraphQL queries in separate files, similar to the `graphql-tag` loader for Webpack, but adapted for Jest, which does not support Webpack loaders. This package provides the same transformation within Jest, enabling seamless GraphQL query imports.
6
4
7
5
---
8
6
9
-
## 🚀 Installation
7
+
## 🚀 Installation
10
8
11
-
Install the package using **npm** or **yarn**:
9
+
Install the package using **npm** or **yarn**:
12
10
13
11
```sh
14
12
npm install --save-dev jest-graphql-transformer
15
13
```
16
14
17
-
or
15
+
or
18
16
19
17
```sh
20
18
yarn add --dev jest-graphql-transformer
21
19
```
22
20
23
21
---
24
22
25
-
## 🔧 Usage
23
+
## 🔧 Usage
26
24
27
-
### ✅ Configure Jest to Use the Transformer
25
+
### ✅ Configure Jest to Use the Transformer
28
26
29
-
#### 📌 **In `package.json`**
27
+
#### 📌 **In `package.json`**
30
28
31
-
Add the following to your Jest configuration:
29
+
Add the following to your Jest configuration:
32
30
33
31
```json
34
32
"jest": {
@@ -39,7 +37,7 @@ Add the following to your Jest configuration:
39
37
}
40
38
```
41
39
42
-
#### 📌 **Or in `jest.config.js` / `jest.config.ts`**
40
+
#### 📌 **Or in `jest.config.js` / `jest.config.ts`**
43
41
44
42
```javascript
45
43
exportdefault {
@@ -49,10 +47,10 @@ export default {
49
47
};
50
48
```
51
49
52
-
### ⚠️ **Note:**
50
+
### ⚠️ **Note:**
53
51
54
-
Once you define the `transform` property, **Jest's default transformations will be overridden**.
55
-
If you need Babel for other files, make sure to include it:
52
+
Once you define the `transform` property, **Jest's default transformations will be overridden**.
53
+
If you need Babel for other files, make sure to include it:
0 commit comments