Coder Social home page Coder Social logo

Comments (7)

stephenmathieson avatar stephenmathieson commented on August 24, 2024 3

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.

stephenmathieson avatar stephenmathieson commented on August 24, 2024 1

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.

stephenmathieson avatar stephenmathieson commented on August 24, 2024

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.

stephenmathieson avatar stephenmathieson commented on August 24, 2024

decided against this. thanks for the suggestion tho!

from analytics-node.

alexpanov avatar alexpanov commented on August 24, 2024

@stephenmathieson could you please explain your reasoning?
We would love to have this feature too.

from analytics-node.

stephenmathieson avatar stephenmathieson commented on August 24, 2024

@alexpanov I began putting this together, but then decided the complexity/overhead isn't worth the gain. see #90 (comment).

from analytics-node.

alexpanov avatar alexpanov commented on August 24, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.