chore: calculate code coverage

This commit is contained in:
2024-03-23 22:20:11 +01:00
parent c4878caef3
commit 4cb8daf908
6 changed files with 1137 additions and 1156 deletions

View File

@@ -4,7 +4,7 @@ exports[`live-reload 1`] = `
[
{
"code": "
(function(l, r) { if (!l || l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (self.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.getElementsByTagName('head')[0].appendChild(r) })(self.document);
(function(l, r) { if (!l || l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (self.location.host || 'localhost').split(':')[0] + ':<port>/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.getElementsByTagName('head')[0].appendChild(r) })(self.document);
const test = ()=>{
return \`I'm "annoying" \${"in case we need to test \\\`string\\\` escaping."}. Hence this files \\'tries\\' to include all allowed forms of 'it'\`;
};

View File

@@ -26,6 +26,12 @@ test('live-reload', async () => {
const code = await getCode(bundle);
await bundle.close();// Make sure live-reload closes itself
debugPrintOutput('live-reload',code);
const portRE = /:[0-9]+\/livereload\.js/gi;
for(const file of code){
if(file.code && portRE.test(file.code)){
file.code = file.code.replaceAll(portRE,":<port>/livereload.js"); // remove any references to a port
}
}
expect(code).toMatchSnapshot();
});