Using a mock front-end in VS Code to develop plugins?

To help me build my plugin in VS Code, I was trying to create a ‘mock frontend’, i.e. another js file that can supply the properties and context.request() method to my server plugin file, since my plugin will be making API calls.

Is this the right approach? I am trying to use fetch() in the mock JS front end to provide the functionality of context.request() but can’t get it to work at all! Here’s the file:

export const properties = {
property1: “some value”,
property2: “another value”

export const context = {
request: async (requestStruct) => {
let respJ = await fetch(requestStruct.uri, {
method: requestStruct.method,
headers: requestStruct.headers,
body: requestStruct.body
let respR = await respJ.json();
return respR;

The console.log prints the correct fetch response to the log, But I can’t for the life of me get that response into my main plugin js function - it just shows up as undefined. I first import using:
import {properties, context} from ‘./frontEndMockUp.js’;
Then try to do the POST request using:
result = context.request(requestStructure);

Do I need another await in my plugin js function, that I then remove later?
Any help appreciated! (I’m a beginner in JS)

Edit: the result = context.request(requestStructure) works in my live Bubble plugin perfectly, so I just need to get it working in VS Code so I can continue development there.

But context is a special bubble function you’d have to recreate. What’s the purpose of this? For testing?

I like to build the plugin in 1 tab and test with a test bubble app open in another tab and jsfiddle in the third for syntax checking and beautification.

I just thought developing/testing in VS Code would be quicker. From context, I’m only using the request method, so I presumed that would be sufficient to create. E.g. now I’m returning a static JSON, which seems to work well. So if I could mimic a POST request, then the entire development could be done in VS Code.

My plugin is a slightly heavier private backend for my app with several cascading API requests before returning a value to the front end, so it’d be really useful to do the full debug before going to Bubble.