diff --git a/packages/dev-middleware/src/__tests__/embedderScriptStub-test.js b/packages/dev-middleware/src/__tests__/embedderScriptStub-test.js new file mode 100644 index 00000000000000..2885727f37cf1e --- /dev/null +++ b/packages/dev-middleware/src/__tests__/embedderScriptStub-test.js @@ -0,0 +1,32 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + * @oncall react_native + */ + +import {fetchLocal} from './FetchUtils'; +import {withServerForEachTest} from './ServerUtils'; + +jest.useRealTimers(); +jest.setTimeout(10000); + +describe('embedder script', () => { + const serverRef = withServerForEachTest({ + logger: undefined, + projectRoot: '', + }); + + test('is always served', async () => { + const resp = await fetchLocal( + serverRef.serverBaseUrl + + '/debugger-frontend/embedder-static/embedderScript.js', + ); + expect(resp.ok).toBeTruthy(); + expect(resp.status).toBe(200); + }); +}); diff --git a/packages/dev-middleware/src/createDevMiddleware.js b/packages/dev-middleware/src/createDevMiddleware.js index 150ad2ad88ea4e..cee44c37c7ec1a 100644 --- a/packages/dev-middleware/src/createDevMiddleware.js +++ b/packages/dev-middleware/src/createDevMiddleware.js @@ -105,6 +105,13 @@ export default function createDevMiddleware({ logger, }), ) + .use( + '/debugger-frontend/embedder-static/embedderScript.js', + (_req, res) => { + res.setHeader('Content-Type', 'application/javascript'); + res.end(''); + }, + ) .use( '/debugger-frontend', serveStaticMiddleware(path.join(reactNativeDebuggerFrontendPath), {