Skip to content

Commit 1d8585f

Browse files
authored
fix(measure): fix port option (#192)
When building the Flashlight CLI, for some reason the comment in the HTML file got removed Actually it's unclear to me why it wasn't getting removed before, now at least we're sure that this will never get removed by parcel
1 parent bd1f486 commit 1d8585f

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

packages/commands/measure/src/__tests__/server/ServerApp.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ describe("ServerApp", () => {
2020
});
2121

2222
beforeEach(() => {
23-
(fs.promises.readFile as jest.Mock).mockResolvedValue("<html>/* %FLASHLIGHT_DATA% */</html>");
23+
(fs.promises.readFile as jest.Mock).mockResolvedValue(
24+
"<html><script>__FLASHLIGHT_DATA__;</script></html>"
25+
);
2426

2527
app = createExpressApp(injected);
2628
});
@@ -37,6 +39,6 @@ describe("ServerApp", () => {
3739
test("index.html contains the FlashlightData placeholder", async () => {
3840
const fsPromises = jest.requireActual("fs").promises;
3941
const fileContent = await fsPromises.readFile(`${__dirname}/../../webapp/index.html`, "utf8");
40-
expect(fileContent).toContain("/* %FLASHLIGHT_DATA% */");
42+
expect(fileContent).toContain("__FLASHLIGHT_DATA__;");
4143
});
4244
});

packages/commands/measure/src/server/ServerApp.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const createExpressApp = (injected: FlashlightData) => {
2525
const indexHtml = path.join(pathToDist, "index.html");
2626
let data = await fs.readFile(indexHtml, "utf8");
2727
data = data.replace(
28-
"/* %FLASHLIGHT_DATA% */",
28+
"__FLASHLIGHT_DATA__;",
2929
`window.__FLASHLIGHT_DATA__ = ${JSON.stringify(injected)};`
3030
);
3131
res.send(data);

packages/commands/measure/src/webapp/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<div id="app"></div>
2525
<script type="module" src="index.js"></script>
2626
<script>
27-
/* %FLASHLIGHT_DATA% */
27+
__FLASHLIGHT_DATA__;
2828
</script>
2929
</body>
3030
</html>

0 commit comments

Comments
 (0)