docs: added note about test timeout (#10041)
This commit is contained in:
+11
@@ -60,6 +60,8 @@ medusaIntegrationTestRunner({
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
jest.setTimeout(60 * 1000)
|
||||||
```
|
```
|
||||||
|
|
||||||
You use the `medusaIntegrationTestRunner` to write your tests.
|
You use the `medusaIntegrationTestRunner` to write your tests.
|
||||||
@@ -86,6 +88,15 @@ If you don't have a `test:integration` script in `package.json`, refer to the [M
|
|||||||
|
|
||||||
This runs your Medusa application and runs the tests available under the `src/integrations/http` directory.
|
This runs your Medusa application and runs the tests available under the `src/integrations/http` directory.
|
||||||
|
|
||||||
|
### Jest Timeout
|
||||||
|
|
||||||
|
Since your tests connect to the database and perform actions that require more time than the typical tests, make sure to increase the timeout in your test:
|
||||||
|
|
||||||
|
```ts title="integration-tests/http/custom-routes.spec.ts"
|
||||||
|
// in your test's file
|
||||||
|
jest.setTimeout(60 * 1000)
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Test a POST API Route
|
## Test a POST API Route
|
||||||
|
|||||||
+11
@@ -36,6 +36,8 @@ medusaIntegrationTestRunner({
|
|||||||
// TODO write tests...
|
// TODO write tests...
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
jest.setTimeout(60 * 1000)
|
||||||
```
|
```
|
||||||
|
|
||||||
The `medusaIntegrationTestRunner` function accepts an object as a parameter. The object has a required property `testSuite`.
|
The `medusaIntegrationTestRunner` function accepts an object as a parameter. The object has a required property `testSuite`.
|
||||||
@@ -50,6 +52,15 @@ The `medusaIntegrationTestRunner` function accepts an object as a parameter. The
|
|||||||
|
|
||||||
The tests in the `testSuite` function are written using [Jest](https://jestjs.io/).
|
The tests in the `testSuite` function are written using [Jest](https://jestjs.io/).
|
||||||
|
|
||||||
|
### Jest Timeout
|
||||||
|
|
||||||
|
Since your tests connect to the database and perform actions that require more time than the typical tests, make sure to increase the timeout in your test:
|
||||||
|
|
||||||
|
```ts title="integration-tests/http/test.spec.ts"
|
||||||
|
// in your test's file
|
||||||
|
jest.setTimeout(60 * 1000)
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Run Tests
|
### Run Tests
|
||||||
|
|||||||
+11
@@ -61,10 +61,21 @@ medusaIntegrationTestRunner({
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
jest.setTimeout(60 * 1000)
|
||||||
```
|
```
|
||||||
|
|
||||||
You use the `medusaIntegrationTestRunner` to write an integration test for the workflow. The test pases if the workflow returns the string `"Hello, World!"`.
|
You use the `medusaIntegrationTestRunner` to write an integration test for the workflow. The test pases if the workflow returns the string `"Hello, World!"`.
|
||||||
|
|
||||||
|
### Jest Timeout
|
||||||
|
|
||||||
|
Since your tests connect to the database and perform actions that require more time than the typical tests, make sure to increase the timeout in your test:
|
||||||
|
|
||||||
|
```ts title="integration-tests/http/custom-routes.spec.ts"
|
||||||
|
// in your test's file
|
||||||
|
jest.setTimeout(60 * 1000)
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Run Test
|
## Run Test
|
||||||
|
|||||||
Reference in New Issue
Block a user