Skip to content

Commit b84d765

Browse files
authored
Merge pull request #55 from datalust/feat/integration-tweaks
Adjust integration test strategy following TypeScript port
2 parents ecbfbc9 + 4d2f380 commit b84d765

12 files changed

Lines changed: 121 additions & 559 deletions

File tree

.github/workflows/ci.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ dev ]
6+
pull_request:
7+
branches: [ dev ]
8+
9+
jobs:
10+
test-seq:
11+
name: Build and Test
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
node-version: [18.x, 20.x, 22.x]
17+
18+
services:
19+
seq:
20+
image: datalust/seq:latest
21+
ports:
22+
- 5341:80
23+
- 5342:5342
24+
env:
25+
ACCEPT_EULA: Y
26+
SEQ_FIRSTRUN_NOAUTHENTICATION: True
27+
28+
steps:
29+
- uses: actions/checkout@v4
30+
- name: Use Node.js ${{ matrix.node-version }}
31+
uses: actions/setup-node@v4
32+
with:
33+
node-version: ${{ matrix.node-version }}
34+
- run: npm ci
35+
- run: npm run build
36+
- run: npm test
37+
- run: npm run test:integration
38+
- run: cd example && npm link && node example.js

.github/workflows/node.js.yml

Lines changed: 0 additions & 60 deletions
This file was deleted.

.github/workflows/npm-publish.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
3-
41
name: Publish
52

63
on:
@@ -31,4 +28,4 @@ jobs:
3128
- run: npm ci
3229
- run: npm publish
3330
env:
34-
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
31+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

.vscode/launch.json

Lines changed: 0 additions & 62 deletions
This file was deleted.

README.md

Lines changed: 0 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -65,102 +65,6 @@ The `createStream()` function accepts a configuration object with the following
6565
- `batchSizeLimit` (number, optional): Maximum size of a batch
6666
- `onError` (function, optional): Error handler callback
6767

68-
## Development
69-
70-
### Running Tests
71-
72-
The test suite includes:
73-
- **Integration tests** that verify round-trip logging to Seq by querying the API
74-
- **Example tests** that verify examples work as users would use them (via `npm link`)
75-
76-
#### Test Modes
77-
78-
Tests can run in two modes controlled by the `MOCK_SEQ` environment variable:
79-
80-
**Real Seq Mode (default, `MOCK_SEQ=false`):**
81-
- Tests connect to actual Seq instance at `http://localhost:5341`
82-
- Verifies full end-to-end integration
83-
- Requires Seq running locally
84-
85-
**Mock Mode (`MOCK_SEQ=true`):**
86-
- Tests use mock transport instead of real Seq
87-
- No Seq instance required
88-
- Verifies code paths without network calls
89-
- Example tests are skipped (they require real Seq)
90-
91-
#### For Contributors (Local Development)
92-
93-
**Option 1: Test with real Seq (recommended):**
94-
95-
```bash
96-
# Start Seq container (with health check)
97-
npm run test:setup
98-
99-
# Run tests with real Seq integration
100-
npm test
101-
102-
# Stop Seq
103-
npm run test:teardown
104-
```
105-
106-
**Option 2: Test with mocks (no Docker required):**
107-
108-
```bash
109-
# Run tests in mock mode
110-
MOCK_SEQ=true npm test
111-
112-
# Or on Windows PowerShell:
113-
$env:MOCK_SEQ="true"; npm test
114-
```
115-
116-
**Option 3: Manage your own Seq instance:**
117-
118-
```bash
119-
# Start Seq however you prefer (Docker, local install, etc.)
120-
# Ensure it's running on http://localhost:5341
121-
122-
npm test
123-
```
124-
125-
**Build only (no tests):**
126-
127-
```bash
128-
npm run build # Just compiles TypeScript
129-
```
130-
131-
#### For CI/CD
132-
133-
GitHub Actions runs tests in both modes:
134-
- **Mock mode**: Tests on Linux, Windows, macOS (9 jobs: 3 OS × 3 Node versions)
135-
- **Real Seq mode**: Tests on Linux only with Seq service container (3 jobs: 3 Node versions)
136-
137-
This ensures cross-platform compatibility while maintaining full integration testing coverage.
138-
139-
### Running the Example
140-
141-
```bash
142-
# Start Seq
143-
npm run test:setup
144-
145-
# Run the example
146-
npm start
147-
148-
# View logs at http://localhost:5341
149-
150-
# Stop Seq
151-
npm run test:teardown
152-
```
153-
154-
### Building
155-
156-
```bash
157-
npm run build
158-
```
159-
160-
The build uses the TypeScript compiler (`tsc`) to produce ES Module output in the `dist/` directory with automatic type definitions.
161-
162-
**Note:** This package is ESM-only (like its dependency `seq-logging`). If you need CommonJS support, please use version 2.x or earlier.
163-
16468
## Acknowledgements
16569

16670
Originally by Simi Hartstein and published as `simihartstein/pino-seq`; maintainership transferred to Datalust at version 0.5.

example/tsconfig.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,8 @@
1919
"scripts": {
2020
"build": "tsc",
2121
"prepublishOnly": "npm run build",
22-
"test": "npm run build && mocha",
23-
"test:setup": "docker pull datalust/seq:latest && docker compose -f test/docker-compose.yml up -d --wait",
24-
"test:teardown": "docker compose -f test/docker-compose.yml down",
25-
"start": "npm run build && node ./example/example.js",
22+
"test": "npm run build && mocha --ignore test/integration*.js",
23+
"test:integration": "npm run build && mocha --include test/integration*.js --timeout 10000",
2624
"dev": "tsc --watch"
2725
},
2826
"repository": {

test/docker-compose.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)