Skip to content
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

Add disable API boolean #992

Merged
merged 1 commit into from
Nov 17, 2023
Merged

Add disable API boolean #992

merged 1 commit into from
Nov 17, 2023

Conversation

silesky
Copy link
Contributor

@silesky silesky commented Nov 7, 2023

Docs: segmentio/segment-docs#5681

Add 'disable' boolean / function option to allow for disabling Segment in a testing environment, which will allow us to disable segment.

export const analytics = AnalyticsBrowser.load(
  { writeKey: 'foo' }, 
  { disable: true } // no HTTP Requests, all methods are a no-op
)

Copy link

changeset-bot bot commented Nov 7, 2023

🦋 Changeset detected

Latest commit: f3979c9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@segment/analytics-next Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@silesky silesky changed the title Add disabled option Add disable API boolean Nov 7, 2023
@silesky silesky requested a review from oscb November 8, 2023 00:03
@silesky silesky changed the title Add disable API boolean Proposal: Add disable API boolean Nov 8, 2023
@silesky silesky marked this pull request as draft November 13, 2023 18:03
@silesky silesky marked this pull request as ready for review November 15, 2023 20:07
@silesky silesky changed the title Proposal: Add disable API boolean Add disable API boolean Nov 15, 2023
Comment on lines +31 to +36
it('integration: should not touch cookies or localStorage', async () => {
const analytics = new NullAnalytics()
await analytics.track('foo')
const storage = getAjsBrowserStorage()
expect(Object.values(storage).every((v) => !v)).toBe(true)
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea for the test!

@silesky silesky merged commit a72f473 into master Nov 17, 2023
6 checks passed
@silesky silesky deleted the add-disabled-option branch November 17, 2023 19:10
@github-actions github-actions bot mentioned this pull request Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants