Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewp committed May 31, 2024
1 parent a36eb05 commit e38edeb
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,21 @@ if (!isWindows) {
const files = await fixture.readdir('');
assert.equal(files.includes('chunks'), false, 'chunks folder removed');
});

it('hoisted script is built', async () => {
const html = await fixture.readFile('/launch-week-component-scripts/index.html');
const $ = cheerio.load(html);

const allScripts = $('head > script[type="module"]');
assert.ok(allScripts.length > 0);

// Includes hoisted script
assert.notEqual(
[...allScripts].find((script) => $(script).attr('src')?.includes('/_astro/WithScripts')),
undefined,
'hoisted script missing from head.'
);
});
});
});
});
Expand Down

0 comments on commit e38edeb

Please sign in to comment.