Skip to content

Commit 7dfb14d

Browse files
authored
fix: Ensure browser contract tests run during top-level build. (#589)
1 parent 7131e69 commit 7dfb14d

File tree

3 files changed

+9
-15
lines changed

3 files changed

+9
-15
lines changed

packages/sdk/browser/contract-tests/entity/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"type": "module",
66
"description": "Contract test service implementation for @launchdarkly/js-client-sdk",
77
"scripts": {
8-
"start": "vite --open=true",
8+
"start": "tsc --noEmit && vite --open=true",
9+
"build": "tsc --noEmit && vite build",
910
"lint": "eslint ./src",
1011
"prettier": "prettier --write '**/*.@(js|ts|tsx|json|css)' --ignore-path ../../../../.prettierignore"
1112
},

packages/sdk/browser/contract-tests/entity/src/ClientEntity.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
import {
2-
AutoEnvAttributes,
3-
init,
4-
LDClient,
5-
LDLogger,
6-
LDOptions,
7-
} from '@launchdarkly/js-client-sdk';
1+
import { init, LDClient, LDLogger, LDOptions } from '@launchdarkly/js-client-sdk';
82

93
import { CommandParams, CommandType, ValueType } from './CommandParams';
104
import { CreateInstanceParams, SDKConfigParams } from './ConfigParams';
@@ -72,6 +66,8 @@ function makeSdkConfig(options: SDKConfigParams, tag: string) {
7266
};
7367
}
7468

69+
cf.fetchGoals = false;
70+
7571
return cf;
7672
}
7773

@@ -205,11 +201,7 @@ export async function newSdkClientEntity(options: CreateInstanceParams) {
205201
options.configuration.clientSide?.initialUser ||
206202
options.configuration.clientSide?.initialContext ||
207203
makeDefaultInitialContext();
208-
const client = init(
209-
options.configuration.credential || 'unknown-env-id',
210-
AutoEnvAttributes.Disabled, // TODO: Determine capability.
211-
sdkConfig,
212-
);
204+
const client = init(options.configuration.credential || 'unknown-env-id', sdkConfig);
213205
let failed = false;
214206
try {
215207
await Promise.race([

packages/sdk/browser/src/BrowserClient.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
LDContext,
1111
Platform,
1212
} from '@launchdarkly/js-client-sdk-common';
13+
import { LDIdentifyOptions } from '@launchdarkly/js-client-sdk-common/dist/api/LDIdentifyOptions';
1314

1415
import GoalManager from './goals/GoalManager';
1516
import { Goal, isClick } from './goals/Goals';
@@ -135,8 +136,8 @@ export class BrowserClient extends LDClientImpl {
135136
};
136137
}
137138

138-
override async identify(context: LDContext): Promise<void> {
139-
await super.identify(context);
139+
override async identify(context: LDContext, identifyOptions?: LDIdentifyOptions): Promise<void> {
140+
await super.identify(context, identifyOptions);
140141
this.goalManager?.startTracking();
141142
}
142143
}

0 commit comments

Comments
 (0)