fix(client): get jquery from cdn (#44421)
* fix: ensures jquery exists for those challenges
For tests frame-runner.js imports jquery, but jquery challenges always
need it
* Revert "Revert "fix: only include frame-runner when running tests (#44337)" (#44419)"
This reverts commit c19bf504b8
.
This commit is contained in:
committed by
GitHub
parent
fee0ac3846
commit
87f5cff3cd
@ -86,7 +86,8 @@ export function* executeChallengeSaga({ payload }) {
|
||||
const protect = isLoopProtected(challengeMeta);
|
||||
const buildData = yield buildChallengeData(challengeData, {
|
||||
preview: false,
|
||||
protect
|
||||
protect,
|
||||
usesTestRunner: true
|
||||
});
|
||||
const document = yield getContext('document');
|
||||
const testRunner = yield call(
|
||||
|
@ -132,12 +132,13 @@ async function getDOMTestRunner(buildData, { proxyLogger }, document) {
|
||||
runTestInTestFrame(document, testString, testTimeout);
|
||||
}
|
||||
|
||||
export function buildDOMChallenge({
|
||||
challengeFiles,
|
||||
required = [],
|
||||
template = ''
|
||||
}) {
|
||||
const finalRequires = [...required, ...frameRunner];
|
||||
export function buildDOMChallenge(
|
||||
{ challengeFiles, required = [], template = '' },
|
||||
{ usesTestRunner } = { usesTestRunner: false }
|
||||
) {
|
||||
const finalRequires = [...required];
|
||||
if (usesTestRunner) finalRequires.push(...frameRunner);
|
||||
|
||||
const loadEnzyme = challengeFiles.some(
|
||||
challengeFile => challengeFile.ext === 'jsx'
|
||||
);
|
||||
|
@ -8,6 +8,9 @@
|
||||
"required": [
|
||||
{
|
||||
"link": "https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css"
|
||||
},
|
||||
{
|
||||
"src": "https://code.jquery.com/jquery-3.6.0.min.js"
|
||||
}
|
||||
],
|
||||
"superBlock": "front-end-development-libraries",
|
||||
|
@ -577,11 +577,14 @@ async function createTestRunner(
|
||||
solutionFiles
|
||||
);
|
||||
|
||||
const { build, sources, loadEnzyme } = await buildChallenge({
|
||||
challengeFiles,
|
||||
required,
|
||||
template
|
||||
});
|
||||
const { build, sources, loadEnzyme } = await buildChallenge(
|
||||
{
|
||||
challengeFiles,
|
||||
required,
|
||||
template
|
||||
},
|
||||
{ usesTestRunner: true }
|
||||
);
|
||||
|
||||
const code = {
|
||||
contents: sources.index,
|
||||
|
Reference in New Issue
Block a user