docs: added note about test timeout (#10041)

This commit is contained in:
Shahed Nasser
2024-11-13 11:01:47 +02:00
committed by GitHub
parent 5fec006371
commit 2d469ba587
3 changed files with 33 additions and 0 deletions

View File

@@ -60,6 +60,8 @@ medusaIntegrationTestRunner({
})
},
})
jest.setTimeout(60 * 1000)
```
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.
### 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

View File

@@ -36,6 +36,8 @@ medusaIntegrationTestRunner({
// TODO write tests...
},
})
jest.setTimeout(60 * 1000)
```
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/).
### 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

View File

@@ -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!"`.
### 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