-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MWPW-134706 Reevaluate bacom-blog repo #11
Conversation
Hello, I'm Franklin Bot and I will run some test suites that validate the page speed.
|
|
1377b78
to
794d169
Compare
This comment was marked as outdated.
This comment was marked as outdated.
Codecov Report
@@ Coverage Diff @@
## main #11 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 1 2 +1
Lines 31 67 +36
=========================================
+ Hits 31 67 +36
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
This comment was marked as outdated.
This comment was marked as outdated.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I correct in assuming that other than changing the mount point, these changes are all to match milo?
/* eslint-disable import/no-extraneous-dependencies */ | ||
import { importMapsPlugin } from '@web/dev-server-import-maps'; | ||
import { defaultReporter } from '@web/test-runner'; | ||
|
||
function customReporter() { | ||
return { | ||
async reportTestFileResults({ logger, sessionsForTestFile }) { | ||
sessionsForTestFile.forEach((session) => { | ||
session.testResults.tests.forEach((test) => { | ||
if (!test.passed && !test.skipped) { | ||
logger.log(test); | ||
} | ||
}); | ||
}); | ||
}, | ||
}; | ||
} | ||
export default { | ||
coverageConfig: { | ||
exclude: [ | ||
'**/mocks/**', | ||
'**/node_modules/**', | ||
'**/test/**', | ||
'**/deps/**', | ||
], | ||
}, | ||
plugins: [importMapsPlugin({})], | ||
reporters: [ | ||
defaultReporter({ reportTestResults: true, reportTestProgress: true }), | ||
customReporter(), | ||
], | ||
testRunnerHtml: (testFramework) => ` | ||
<html> | ||
<head> | ||
<script type='module'> | ||
const oldFetch = window.fetch; | ||
window.fetch = async (resource, options) => { | ||
if (!resource.startsWith('/') && !resource.startsWith('http://localhost')) { | ||
console.error( | ||
'** fetch request for an external resource is disallowed in unit tests, please find a way to mock! https://github.com/orgs/adobecom/discussions/814#discussioncomment-6060759 provides guidance on how to fix the issue.', | ||
resource | ||
); | ||
} | ||
return oldFetch.call(window, resource, options); | ||
}; | ||
|
||
const oldXHROpen = XMLHttpRequest.prototype.open; | ||
XMLHttpRequest.prototype.open = async function (...args) { | ||
let [method, url, asyn] = args; | ||
if (!resource.startsWith('/') && url.startsWith('http://localhost')) { | ||
console.error( | ||
'** XMLHttpRequest request for an external resource is disallowed in unit tests, please find a way to mock! https://github.com/orgs/adobecom/discussions/814#discussioncomment-6060759 provides guidance on how to fix the issue.', | ||
url | ||
); | ||
} | ||
return oldXHROpen.apply(this, args); | ||
}; | ||
const observer = new MutationObserver((mutationsList, observer) => { | ||
for(let mutation of mutationsList) { | ||
if (mutation.type === 'childList') { | ||
for(let node of mutation.addedNodes) { | ||
if(node.nodeName === 'SCRIPT' && node.src && !node.src.startsWith('http://localhost')) { | ||
console.error( | ||
'** An external 3rd script has been added. This is disallowed in unit tests, please find a way to mock! https://github.com/orgs/adobecom/discussions/814#discussioncomment-6060891 provides guidance on how to fix the issue.', | ||
node.src | ||
); | ||
} | ||
} | ||
} | ||
} | ||
}); | ||
observer.observe(document.head, { childList: true }); | ||
</script> | ||
</head> | ||
<body> | ||
<script type='module' src='${testFramework}'></script> | ||
</body> | ||
</html>`, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file has the mjs extension in milo, why change it here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To match milo-college, it is using "type": "module"
in package.json so mjs is redundant.
@meganthecoder To match milo consumers, I using milo-college to see what changed: adobecom/milo-college@53743b7...main |
Resolves: MWPW-134706
Test URLs: