fix: relax challenge validation for multiple seeds

pull/39553/head
Oliver Eyton-Williams 2020-06-01 09:53:34 +02:00 committed by Mrugesh Mohapatra
parent 5fe16ada3d
commit b25089d7c8
1 changed files with 16 additions and 7 deletions

View File

@ -325,19 +325,15 @@ function populateTestsForLang({ lang, challenges, meta }) {
return;
}
if (files.length > 1) {
it('Check tests.', () => {
throw new Error('Seed file should be only the one.');
});
return;
}
const buildChallenge =
challengeType === challengeTypes.js ||
challengeType === challengeTypes.bonfire
? buildJSChallenge
: buildDOMChallenge;
// TODO: create more sophisticated validation now we allow for more
// than one seed/solution file.
files = files.map(createPoly);
it('Test suite must fail on the initial contents', async function() {
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(
{ required = [], template, files },
solution,
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) {
files[0].contents = solution;
}