Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Extension Developers: tip for unit testing with turbine


Community Advisor

This tip is for extension developers (most likely applicable for web extensions only, since I haven't tried this with mobile extensions).

TL;DR create a "global.turbine" variable to mock the turbine free variable, before running your unit tests.

I use jasmine ( for testing my extension. One difficulty that I had was figuring out how to test the "turbine" free variable (

After numerous trials-and-errors, I finally stumbled on this solution:

describe("description of the test suite", function() {
  // create the turbine free variable with "logger"
  global.turbine = {
    logger: jasmine.createSpyObj('', ['debug', 'info', 'warn', 'alert', 'error']),

  // rest of test suite

  it("description of unit test that logs to the logger", function() {
    // run the test

Hope this works for you too!

0 Replies