fix: only include frame-runner when running tests (#44337)
* fix: only include frame-runner when running tests * fix: handle missing options * test: use test runner for curriculum tests
This commit is contained in:
committed by
GitHub
parent
8372623f69
commit
a23a47750b
@ -86,7 +86,8 @@ export function* executeChallengeSaga({ payload }) {
|
|||||||
const protect = isLoopProtected(challengeMeta);
|
const protect = isLoopProtected(challengeMeta);
|
||||||
const buildData = yield buildChallengeData(challengeData, {
|
const buildData = yield buildChallengeData(challengeData, {
|
||||||
preview: false,
|
preview: false,
|
||||||
protect
|
protect,
|
||||||
|
usesTestRunner: true
|
||||||
});
|
});
|
||||||
const document = yield getContext('document');
|
const document = yield getContext('document');
|
||||||
const testRunner = yield call(
|
const testRunner = yield call(
|
||||||
|
@ -138,12 +138,13 @@ async function getDOMTestRunner(buildData, { proxyLogger }, document) {
|
|||||||
runTestInTestFrame(document, testString, testTimeout);
|
runTestInTestFrame(document, testString, testTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function buildDOMChallenge({
|
export function buildDOMChallenge(
|
||||||
challengeFiles,
|
{ challengeFiles, required = [], template = '' },
|
||||||
required = [],
|
{ usesTestRunner } = { usesTestRunner: false }
|
||||||
template = ''
|
) {
|
||||||
}) {
|
const finalRequires = [...globalRequires, ...required];
|
||||||
const finalRequires = [...globalRequires, ...required, ...frameRunner];
|
if (usesTestRunner) finalRequires.push(...frameRunner);
|
||||||
|
|
||||||
const loadEnzyme = challengeFiles.some(
|
const loadEnzyme = challengeFiles.some(
|
||||||
challengeFile => challengeFile.ext === 'jsx'
|
challengeFile => challengeFile.ext === 'jsx'
|
||||||
);
|
);
|
||||||
|
@ -570,11 +570,14 @@ async function createTestRunner(
|
|||||||
challengeFile.editableContents = solutionFile.editableContents;
|
challengeFile.editableContents = solutionFile.editableContents;
|
||||||
});
|
});
|
||||||
|
|
||||||
const { build, sources, loadEnzyme } = await buildChallenge({
|
const { build, sources, loadEnzyme } = await buildChallenge(
|
||||||
challengeFiles,
|
{
|
||||||
required,
|
challengeFiles,
|
||||||
template
|
required,
|
||||||
});
|
template
|
||||||
|
},
|
||||||
|
{ usesTestRunner: true }
|
||||||
|
);
|
||||||
|
|
||||||
const code = {
|
const code = {
|
||||||
contents: sources.index,
|
contents: sources.index,
|
||||||
|
Reference in New Issue
Block a user