Skip to content

Testing onMessage listeners #136

@kmarple1

Description

@kmarple1

I'm attempting to test my onMessage listeners, but I keep getting the error TypeError: sendResponse is not a function. It appears that the implementation of runtime.sendMessage accepts a callback as the second argument, but doesn't actually pass it to the listener.

I've also tried the MDN-recommended method of returning a promise from the onMessage listener and using .then() from runtime.sendMessage, but this doesn't work either.

My workaround thus far has been to export the listener function and hit it directly. This works but is less than ideal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions