diff --git a/packages/astro/src/compiler/transform/head.ts b/packages/astro/src/compiler/transform/head.ts index 6efa79c8c..fe3f3ed88 100644 --- a/packages/astro/src/compiler/transform/head.ts +++ b/packages/astro/src/compiler/transform/head.ts @@ -5,8 +5,7 @@ import type { TemplateNode } from '@astrojs/parser'; export default function (opts: TransformOptions): Transformer { let head: TemplateNode; let hasComponents = false; - let isHmrEnabled = typeof opts.compileOptions.hmrPort !== 'undefined' && - opts.compileOptions.mode === 'development'; + let isHmrEnabled = typeof opts.compileOptions.hmrPort !== 'undefined' && opts.compileOptions.mode === 'development'; return { visitors: { diff --git a/packages/astro/test/astro-basic.test.js b/packages/astro/test/astro-basic.test.js index 48edbdd7e..cdec77219 100644 --- a/packages/astro/test/astro-basic.test.js +++ b/packages/astro/test/astro-basic.test.js @@ -49,17 +49,19 @@ Basics('Selector with an empty body', async ({ runtime }) => { }); Basics('Build does not include HMR client', async ({ build, readFile }) => { - await build().catch(err => { - assert.ok(!err, 'Error during the build'); - }); - const clientHTML = await readFile('/client/index.html'); - const $ = doc(clientHTML); + await build().catch((err) => { + assert.ok(!err, 'Error during the build'); + }); + const clientHTML = await readFile('/client/index.html'); + const $ = doc(clientHTML); - assert.equal($('script[src="/_snowpack/hmr-client.js"]').length, 0, 'No HMR client script'); - const hmrPortScript = $('script').filter((i, el) => { - return $(el).text().match(/window\.HMR_WEBSOCKET_PORT/); - }); - assert.equal(hmrPortScript.length, 0, 'No script setting the websocket port'); + assert.equal($('script[src="/_snowpack/hmr-client.js"]').length, 0, 'No HMR client script'); + const hmrPortScript = $('script').filter((i, el) => { + return $(el) + .text() + .match(/window\.HMR_WEBSOCKET_PORT/); + }); + assert.equal(hmrPortScript.length, 0, 'No script setting the websocket port'); }); Basics.run();