-
Notifications
You must be signed in to change notification settings - Fork 31
fix: Ensure browser contract tests run during top-level build. #589
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,8 @@ | |
| "type": "module", | ||
| "description": "Contract test service implementation for @launchdarkly/js-client-sdk", | ||
| "scripts": { | ||
| "start": "vite --open=true", | ||
| "start": "tsc --noEmit && vite --open=true", | ||
| "build": "tsc --noEmit && vite build", | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There wasn't a build command, so it didn't run with the root build. |
||
| "lint": "eslint ./src", | ||
| "prettier": "prettier --write '**/*.@(js|ts|tsx|json|css)' --ignore-path ../../../../.prettierignore" | ||
| }, | ||
|
|
||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I forgot to update this when I removed AutoEnvAttributes. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,4 @@ | ||
| import { | ||
| AutoEnvAttributes, | ||
| init, | ||
| LDClient, | ||
| LDLogger, | ||
| LDOptions, | ||
| } from '@launchdarkly/js-client-sdk'; | ||
| import { init, LDClient, LDLogger, LDOptions } from '@launchdarkly/js-client-sdk'; | ||
|
|
||
| import { CommandParams, CommandType, ValueType } from './CommandParams'; | ||
| import { CreateInstanceParams, SDKConfigParams } from './ConfigParams'; | ||
|
|
@@ -72,6 +66,8 @@ function makeSdkConfig(options: SDKConfigParams, tag: string) { | |
| }; | ||
| } | ||
|
|
||
| cf.fetchGoals = false; | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't fetch goals. It confuses the test harness. |
||
|
|
||
| return cf; | ||
| } | ||
|
|
||
|
|
@@ -205,11 +201,7 @@ export async function newSdkClientEntity(options: CreateInstanceParams) { | |
| options.configuration.clientSide?.initialUser || | ||
| options.configuration.clientSide?.initialContext || | ||
| makeDefaultInitialContext(); | ||
| const client = init( | ||
| options.configuration.credential || 'unknown-env-id', | ||
| AutoEnvAttributes.Disabled, // TODO: Determine capability. | ||
| sdkConfig, | ||
| ); | ||
| const client = init(options.configuration.credential || 'unknown-env-id', sdkConfig); | ||
| let failed = false; | ||
| try { | ||
| await Promise.race([ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,7 @@ import { | |
| LDContext, | ||
| Platform, | ||
| } from '@launchdarkly/js-client-sdk-common'; | ||
| import { LDIdentifyOptions } from '@launchdarkly/js-client-sdk-common/dist/api/LDIdentifyOptions'; | ||
|
|
||
| import GoalManager from './goals/GoalManager'; | ||
| import { Goal, isClick } from './goals/Goals'; | ||
|
|
@@ -135,8 +136,8 @@ export class BrowserClient extends LDClientImpl { | |
| }; | ||
| } | ||
|
|
||
| override async identify(context: LDContext): Promise<void> { | ||
| await super.identify(context); | ||
| override async identify(context: LDContext, identifyOptions?: LDIdentifyOptions): Promise<void> { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I missed this, which doesn't make the SDK not work, but does cause problems for the test harness. |
||
| await super.identify(context, identifyOptions); | ||
| this.goalManager?.startTracking(); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure the typescript it valid when running the dev server.