0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-01-27 22:19:04 -05:00

[ci] yarn format

This commit is contained in:
matthewp 2021-06-16 17:38:46 +00:00 committed by GitHub Actions
parent 5601efa257
commit 7fdb7ceca6
2 changed files with 13 additions and 12 deletions

View file

@ -5,8 +5,7 @@ import type { TemplateNode } from '@astrojs/parser';
export default function (opts: TransformOptions): Transformer { export default function (opts: TransformOptions): Transformer {
let head: TemplateNode; let head: TemplateNode;
let hasComponents = false; let hasComponents = false;
let isHmrEnabled = typeof opts.compileOptions.hmrPort !== 'undefined' && let isHmrEnabled = typeof opts.compileOptions.hmrPort !== 'undefined' && opts.compileOptions.mode === 'development';
opts.compileOptions.mode === 'development';
return { return {
visitors: { visitors: {

View file

@ -49,17 +49,19 @@ Basics('Selector with an empty body', async ({ runtime }) => {
}); });
Basics('Build does not include HMR client', async ({ build, readFile }) => { Basics('Build does not include HMR client', async ({ build, readFile }) => {
await build().catch(err => { await build().catch((err) => {
assert.ok(!err, 'Error during the build'); assert.ok(!err, 'Error during the build');
}); });
const clientHTML = await readFile('/client/index.html'); const clientHTML = await readFile('/client/index.html');
const $ = doc(clientHTML); const $ = doc(clientHTML);
assert.equal($('script[src="/_snowpack/hmr-client.js"]').length, 0, 'No HMR client script'); assert.equal($('script[src="/_snowpack/hmr-client.js"]').length, 0, 'No HMR client script');
const hmrPortScript = $('script').filter((i, el) => { const hmrPortScript = $('script').filter((i, el) => {
return $(el).text().match(/window\.HMR_WEBSOCKET_PORT/); return $(el)
}); .text()
assert.equal(hmrPortScript.length, 0, 'No script setting the websocket port'); .match(/window\.HMR_WEBSOCKET_PORT/);
});
assert.equal(hmrPortScript.length, 0, 'No script setting the websocket port');
}); });
Basics.run(); Basics.run();