Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
12b4489
feat: add server-side TestHook and migrate server-node/shopify-oxygen…
devin-ai-integration[bot] Mar 10, 2026
353db64
fix: use source exports for ./server subpath and fix module resolution
devin-ai-integration[bot] Mar 10, 2026
3800e73
fix: revert ./server to compiled dist exports, add build:server step …
devin-ai-integration[bot] Mar 10, 2026
e513780
fix: narrow tsconfig.server.json to only server-side files
devin-ai-integration[bot] Mar 10, 2026
b0c2780
fix: move got and node-server-sdk to optional peerDependencies
devin-ai-integration[bot] Mar 10, 2026
c0c27e7
fix: make build script no-op to prevent server deps from breaking unr…
devin-ai-integration[bot] Mar 10, 2026
5f85bf7
fix: revert .js extensions in index.ts to fix Turbopack/Next.js resol…
devin-ai-integration[bot] Mar 10, 2026
746e3bb
refactor: deduplicate server-node contract tests with shared types an…
devin-ai-integration[bot] Mar 10, 2026
aac306c
fix: prettier formatting for newSdkClientEntity function signature
devin-ai-integration[bot] Mar 10, 2026
1d7581b
fix: revert shared type re-exports from server.ts to avoid js-client-…
devin-ai-integration[bot] Mar 10, 2026
6cf71df
fix: prettier formatting for newSdkClientEntity with shorter type name
devin-ai-integration[bot] Mar 10, 2026
6d0ee27
refactor: split types into shared/client/server modules for proper SD…
devin-ai-integration[bot] Mar 10, 2026
be05c46
refactor: simplify type deduplication using compat.ts pattern from PR…
devin-ai-integration[bot] Mar 10, 2026
5a0fcf6
refactor: make ./client and ./server exports consistent (both from di…
devin-ai-integration[bot] Mar 11, 2026
0e2c233
fix: revert ./client and ./ exports to source, keep ./server at dist/
devin-ai-integration[bot] Mar 11, 2026
7d1a980
refactor: make all exports consistent from dist/, add build steps to …
devin-ai-integration[bot] Mar 11, 2026
2d3b75a
fix: use compat LDLogger type and exclude client files from server build
devin-ai-integration[bot] Mar 11, 2026
473dc35
fix: split builds into universal/client/server for different CI envir…
devin-ai-integration[bot] Mar 11, 2026
49a0e27
fix: add build:client step to React CI workflow for contract-test-utils
devin-ai-integration[bot] Mar 11, 2026
2540561
fix: move build:client before topological build in React CI
devin-ai-integration[bot] Mar 11, 2026
3bd329e
Merge branch 'main' into devin/1773165219-sdk-2009-server-testhook-mi…
joker23 Mar 12, 2026
850f7d5
chore: consolidating shared implementation
joker23 Mar 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/browser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ jobs:
- name: Install Playwright browsers
run: yarn workspace browser-contract-test-service install-playwright-browsers

- name: Build shared contract test utils
run: yarn workspace @launchdarkly/js-contract-test-utils build:client

- name: Build contract test adapter
run: yarn workspace browser-contract-test-adapter run build

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/electron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
ELECTRON_DISABLE_SANDBOX: '1'
run: |
yarn workspaces focus @internal/electron-contract-tests-entity
yarn workspace @launchdarkly/js-contract-test-utils build:client
yarn workspace @internal/electron-contract-tests-entity build
sudo apt-get install -y xvfb
Xvfb :99 -screen 0 1024x768x24 > /tmp/xvfb.log 2>&1 &
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/react-native-contract-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ jobs:
- name: Build SDK and dependencies
run: yarn workspaces foreach -pR --topological-dev --from '@launchdarkly/react-native-client-sdk' run build

- name: Build shared contract test utils
run: yarn workspace @launchdarkly/js-contract-test-utils build:client

- name: Build contract test adapter
run: yarn workspace react-native-contract-test-adapter run build

Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/react.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ jobs:
yarn workspaces foreach -pR --topological-dev --from "@launchdarkly/react-sdk-contract-tests" install
yarn workspaces foreach -pR --topological-dev --from 'browser-contract-test-adapter' run build
yarn workspaces foreach -pR --topological-dev --from "@launchdarkly/react-sdk-contract-tests" run build
- name: Install Playwright browsers
run: yarn workspace @launchdarkly/react-sdk-contract-tests install-playwright-browsers
yarn workspace @launchdarkly/react-sdk-contract-tests install-playwright-browsers
Comment thread
joker23 marked this conversation as resolved.
- name: Run test adapter
run: |
yarn workspace @launchdarkly/react-sdk-contract-tests run start:adapter > /tmp/adapter.log 2>&1 &
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/server-node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ jobs:
workspace_path: packages/sdk/server-node
- name: Install contract test service dependencies
run: yarn workspace node-server-sdk-contract-tests install --no-immutable
- name: Build shared contract test utils (server)
run: yarn workspace @launchdarkly/js-contract-test-utils build:server
- name: Build the test service
run: yarn workspace node-server-sdk-contract-tests build
- name: Launch the test service in the background
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/shopify-oxygen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ jobs:
workspace_path: packages/sdk/shopify-oxygen
- name: Install contract test service dependencies
run: yarn workspace @launchdarkly/shopify-oxygen-contract-tests install --no-immutable
- name: Build shared contract test utils
run: yarn workspace @launchdarkly/js-contract-test-utils build:server
Comment thread
joker23 marked this conversation as resolved.
- name: Build the test service
run: yarn workspace @launchdarkly/shopify-oxygen-contract-tests build
- name: Launch the test service in the background
Expand Down
1 change: 1 addition & 0 deletions packages/sdk/server-node/contract-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"license": "Apache-2.0",
"private": true,
"dependencies": {
"@launchdarkly/js-contract-test-utils": "workspace:^",
"@launchdarkly/node-server-sdk": "workspace:^",
"body-parser": "^1.19.0",
"express": "^4.17.1",
Expand Down
75 changes: 0 additions & 75 deletions packages/sdk/server-node/contract-tests/src/TestHook.ts

This file was deleted.

19 changes: 8 additions & 11 deletions packages/sdk/server-node/contract-tests/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import bodyParser from 'body-parser';
import express, { Request, Response } from 'express';
import { Server } from 'http';

import { ClientPool } from '@launchdarkly/js-contract-test-utils/server';

import { Log } from './log.js';
import { badCommandError, newSdkClientEntity, SdkClientEntity } from './sdkClientEntity.js';

Expand All @@ -10,8 +12,7 @@ let server: Server | null = null;

const port = 8000;

let clientCounter = 0;
const clients: Record<string, SdkClientEntity> = {};
const clients = new ClientPool<SdkClientEntity>();

const mainLog = Log('service');

Expand Down Expand Up @@ -66,16 +67,12 @@ app.delete('/', (req: Request, res: Response) => {
app.post('/', async (req: Request, res: Response) => {
const options = req.body;

clientCounter += 1;
const clientId = clientCounter.toString();
const resourceUrl = `/clients/${clientId}`;

try {
const client = await newSdkClientEntity(options);
clients[clientId] = client;
const clientId = clients.add(client);

res.status(201);
res.set('Location', resourceUrl);
res.set('Location', `/clients/${clientId}`);
} catch (e) {
res.status(500);
const message = e instanceof Error ? e.message : JSON.stringify(e);
Expand All @@ -86,7 +83,7 @@ app.post('/', async (req: Request, res: Response) => {
});

app.post('/clients/:id', async (req: Request, res: Response) => {
const client = clients[req.params.id];
const client = clients.get(req.params.id);
if (!client) {
res.status(404);
} else {
Expand All @@ -113,13 +110,13 @@ app.post('/clients/:id', async (req: Request, res: Response) => {
});

app.delete('/clients/:id', async (req: Request, res: Response) => {
const client = clients[req.params.id];
const client = clients.get(req.params.id);
if (!client) {
res.status(404);
res.send();
} else {
client.close();
delete clients[req.params.id];
clients.remove(req.params.id);
res.status(204);
res.send();
}
Expand Down
Loading
Loading