Skip to content

Commit aafe68b

Browse files
Add integration tests
This adds integration tests that test the core functionality of the SDK. I had originally written these as a single `describe` containing four `it`s, each of which included the test setup and then a list of scenarios, these scenarios just being separated by comments. However, Dom was keen for me to make more use of the vitest APIs for structuring my tests. This resulted in the current setup, where there is one `describe` for each area of functionality, each of these `describe`s then containing multiple `it`s. Each `it` within a given `describe` relies on the side effects of the previous `it`s within that `describe`. Dom preferred this new approach and was happy to accept the compromises that this resulted in, such as having `describe`-level local variables which have no type information, and the fact that the failure of one `it` does not prevent the subsequent `it`s (which rely on the preceding `it`s all having succeeded) from running. With my initial approach, I was able to get the tests running in parallel using `describe.concurrent` on the top-level `describe`. I wasn’t able to figure out how to achieve this in the new approach, in which we want to run all `describe`s in parallel, but run the `it`s within a given `describe` sequentially. I tried using `.concurrent` on the top-level `describe` and `.sequential` on each nested `describe`, but it still just ran everything sequentially. Resolves COL-56.
1 parent c60aaa3 commit aafe68b

File tree

4 files changed

+661
-4
lines changed

4 files changed

+661
-4
lines changed

.github/workflows/dev-ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ jobs:
3838
runs-on: ubuntu-latest
3939
steps:
4040
- uses: actions/checkout@v2
41+
with:
42+
submodules: true
4143
- uses: actions/setup-node@v1
4244
with:
4345
node-version: 18

CONTRIBUTING.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@
2929

3030
## Test suite
3131

32+
### Setup
33+
34+
Before running the tests, you first need to initialize the repository’s submodules:
35+
36+
```
37+
git submodule update --init
38+
```
39+
40+
### Running the tests
41+
3242
To run the Jest tests, simply run the following command:
3343

3444
```bash
@@ -39,7 +49,6 @@ npm test
3949

4050
To test the bundle that we upload to the CDN:
4151

42-
1. Initialize submodules: `git submodule update --init`
43-
2. Install browser for Playwright to use: `npx run playwright install chromium`
44-
3. Build the bundle: `npm run build`
45-
4. Run the test: `npm run test:cdn-bundle`
52+
1. Install browser for Playwright to use: `npx run playwright install chromium`
53+
2. Build the bundle: `npm run build`
54+
3. Run the test: `npm run test:cdn-bundle`

0 commit comments

Comments
 (0)