Comments (7)
fwiw, here's what you could do on your end:
const Analytics = require('analytics-node')
const { NODE_ENV } = process.env
if (NODE_ENV === 'test') { // or w/e
Analytics.prototype.flush = fn => fn()
}
from analytics-node.
I feel this should be documented somewhere.
I'd gladly merge a PR =)
Any idea how to do the same thing for the web js library?
I'm not technically maintainer for analytics.js, so I don't want to provide the wrong information... but on my side-projects, I stub out window.analytics
fully rather than including it on my page. see https://github.com/stephenmathieson/bikeshedding.us/blob/7ac014901afe0b1b189d73e99c75b83b5d30b5ac/src/dev.html#L6-L13 for an example.
from analytics-node.
Yep, not a bad idea. We've got some old code that sends events to a "fake" source when we run our test suite.
I'll add something =D
from analytics-node.
decided against this. thanks for the suggestion tho!
from analytics-node.
@stephenmathieson could you please explain your reasoning?
We would love to have this feature too.
from analytics-node.
@alexpanov I began putting this together, but then decided the complexity/overhead isn't worth the gain. see #90 (comment).
from analytics-node.
@stephenmathieson Thank you sooo much! I feel this should be documented somewhere.
Any idea how to do the same thing for the web js library?
from analytics-node.
Related Issues (20)
- Bad Request (400) when batching HOT 1
- Flush on first message should be explicit configurable HOT 1
- analytics-node might cause an unhandledRejection HOT 13
- Should we switch to the `@segmentio/analytics-next` package? HOT 2
- Unhandled Promise Rejection Can Crash App HOT 10
- What does calling identify on the server actually do? HOT 5
- Areas for Performance Improvements
- Chrome extension background service worker + analytics-node = fail HOT 1
- Resolve vulnerability axios 0.21.4 HOT 2
- Including sentAt in the event payload of /v1/batch request makes specified timestamp ignored
- Not all sent 'track' events receive to the debugger tab of the source HOT 4
- Npm version update for Axios Version update HOT 1
- Support for other backend JS runtimes (Web Workers, Deno) HOT 6
- Support middleware functions HOT 8
- Typescript support HOT 6
- Cross-Domain Misconfiguration HOT 6
- `Analytics` intialization doesn't catch invalid/non-existent write key HOT 2
- Update axios to `1.6.0` to make it possible to get a security fix HOT 2
- Track call fails when property has bigint attribute
- context.device.token ignored HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from analytics-node.