feat(package): Initial Curriculum separation (#17174)
* feat(package): Initial Curriculum separation * feat(package): Add org scope to package * chore(ooops): Remove development file * feat(npm): Add .npmignore * fix(paths): Fix curriculum paths * feat(build): Add a build step * chore(seed): Move package file back to seed * fix(ignore): Fix .npmIgnore file * chore(docs): Update README * chore(seed): Rename coding interview blocks * fix(seed): Challenge files now fit into learn * chore(seed): Update seed files for use in learn * chore(escapes): Unescape script tags of jQuery
This commit is contained in:
committed by
mrugesh mohapatra
parent
63482406ea
commit
ee66d84ccb
@@ -4,18 +4,28 @@ import {Observable} from 'rx';
|
||||
import tape from 'tape';
|
||||
|
||||
import getChallenges from './getChallenges';
|
||||
import { modern } from '../common/app/utils/challengeTypes';
|
||||
|
||||
import MongoIds from './mongoIds';
|
||||
import ChallengeTitles from './challengeTitles';
|
||||
import addAssertsToTapTest from './addAssertsToTapTest';
|
||||
|
||||
// modern challengeType
|
||||
const modern = 6;
|
||||
|
||||
let mongoIds = new MongoIds();
|
||||
let challengeTitles = new ChallengeTitles();
|
||||
|
||||
function evaluateTest(solution, assert,
|
||||
react, redux, reactRedux,
|
||||
head, tail,
|
||||
test, tapTest) {
|
||||
function evaluateTest(
|
||||
solution,
|
||||
assert,
|
||||
react,
|
||||
redux,
|
||||
reactRedux,
|
||||
head,
|
||||
tail,
|
||||
test,
|
||||
tapTest
|
||||
) {
|
||||
|
||||
let code = solution;
|
||||
|
||||
@@ -94,14 +104,22 @@ function evaluateTest(solution, assert,
|
||||
try {
|
||||
(() => {
|
||||
return eval(
|
||||
head + '\n;;' +
|
||||
solution + '\n;;' +
|
||||
tail + '\n;;' +
|
||||
test
|
||||
head + '\n' +
|
||||
solution + '\n' +
|
||||
tail + '\n' +
|
||||
test.testString
|
||||
);
|
||||
})();
|
||||
} catch (e) {
|
||||
console.log(
|
||||
head + '\n' +
|
||||
solution + '\n' +
|
||||
tail + '\n' +
|
||||
test.testString
|
||||
);
|
||||
console.log(e);
|
||||
tapTest.fail(e);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,8 +128,7 @@ function createTest({
|
||||
id = '',
|
||||
tests = [],
|
||||
solutions = [],
|
||||
head = [],
|
||||
tail = [],
|
||||
files = [],
|
||||
react = false,
|
||||
redux = false,
|
||||
reactRedux = false
|
||||
@@ -128,12 +145,18 @@ function createTest({
|
||||
console.log(`Replacing Async Tests for Challenge ${title}`);
|
||||
tests = tests.map(challengeTestSource =>
|
||||
isAsync(challengeTestSource) ?
|
||||
"assert(true, 'message: great');" :
|
||||
challengeTestSource);
|
||||
}
|
||||
|
||||
head = head.join('\n');
|
||||
tail = tail.join('\n');
|
||||
"assert(true, 'message: great');" :
|
||||
challengeTestSource);
|
||||
}
|
||||
const { head, tail } = Object.keys(files)
|
||||
.map(key => files[key])
|
||||
.reduce(
|
||||
(result, file) => ({
|
||||
head: result.head + ';' + file.head.join('\n'),
|
||||
tail: result.tail + ';' + file.tail.join('\n')
|
||||
}),
|
||||
{ head: '', tail: '' }
|
||||
);
|
||||
const plan = tests.length;
|
||||
if (!plan) {
|
||||
return Observable.just({
|
||||
@@ -161,8 +184,17 @@ function createTest({
|
||||
.doOnNext(assert => {
|
||||
solutions.forEach(solution => {
|
||||
tests.forEach(test => {
|
||||
evaluateTest(solution, assert, react, redux, reactRedux,
|
||||
head, tail, test, tapTest);
|
||||
evaluateTest(
|
||||
solution,
|
||||
assert,
|
||||
react,
|
||||
redux,
|
||||
reactRedux,
|
||||
head,
|
||||
tail,
|
||||
test,
|
||||
tapTest
|
||||
);
|
||||
});
|
||||
});
|
||||
})
|
||||
|
Reference in New Issue
Block a user