fix: relax challenge validation for multiple seeds
This commit is contained in:
committed by
Mrugesh Mohapatra
parent
5fe16ada3d
commit
b25089d7c8
@ -325,19 +325,15 @@ function populateTestsForLang({ lang, challenges, meta }) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (files.length > 1) {
|
|
||||||
it('Check tests.', () => {
|
|
||||||
throw new Error('Seed file should be only the one.');
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const buildChallenge =
|
const buildChallenge =
|
||||||
challengeType === challengeTypes.js ||
|
challengeType === challengeTypes.js ||
|
||||||
challengeType === challengeTypes.bonfire
|
challengeType === challengeTypes.bonfire
|
||||||
? buildJSChallenge
|
? buildJSChallenge
|
||||||
: buildDOMChallenge;
|
: buildDOMChallenge;
|
||||||
|
|
||||||
|
// TODO: create more sophisticated validation now we allow for more
|
||||||
|
// than one seed/solution file.
|
||||||
|
|
||||||
files = files.map(createPoly);
|
files = files.map(createPoly);
|
||||||
it('Test suite must fail on the initial contents', async function() {
|
it('Test suite must fail on the initial contents', async function() {
|
||||||
this.timeout(5000 * tests.length + 1000);
|
this.timeout(5000 * tests.length + 1000);
|
||||||
@ -410,11 +406,24 @@ function populateTestsForLang({ lang, challenges, meta }) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: solutions will need to be multi-file, too, with a fallback when there
|
||||||
|
// is only one file.
|
||||||
|
// we cannot simply use the solution instead of files, because the are not
|
||||||
|
// just the seed(s), they contain the head and tail code. The best approach
|
||||||
|
// is probably to separate out the head and tail from the files. Then the
|
||||||
|
// files can be entirely replaced by the solution.
|
||||||
|
|
||||||
async function createTestRunner(
|
async function createTestRunner(
|
||||||
{ required = [], template, files },
|
{ required = [], template, files },
|
||||||
solution,
|
solution,
|
||||||
buildChallenge
|
buildChallenge
|
||||||
) {
|
) {
|
||||||
|
// TODO: solutions will need to be multi-file, too, with a fallback when there
|
||||||
|
// is only one file.
|
||||||
|
// we cannot simply use the solution instead of files, because the are not
|
||||||
|
// just the seed(s), they contain the head and tail code. The best approach
|
||||||
|
// is probably to separate out the head and tail from the files. Then the
|
||||||
|
// files can be entirely replaced by the solution.
|
||||||
if (solution) {
|
if (solution) {
|
||||||
files[0].contents = solution;
|
files[0].contents = solution;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user