feat(tests): use client build pipeline and test runners for testing curriculum
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import { throwers } from '../rechallenge/throwers';
|
||||
import { transformers } from '../rechallenge/transformers';
|
||||
import { cssToHtml, jsToHtml, concatHtml } from '../rechallenge/builders.js';
|
||||
|
||||
@@ -27,9 +26,8 @@ const applyFunction = fn =>
|
||||
return newFile;
|
||||
}
|
||||
return file;
|
||||
} catch {
|
||||
// return { error };
|
||||
return file;
|
||||
} catch (error) {
|
||||
return { ...file, error };
|
||||
}
|
||||
};
|
||||
|
||||
@@ -55,7 +53,7 @@ export function buildDOMChallenge(files, meta = {}) {
|
||||
const { required = [], template = '' } = meta;
|
||||
const finalRequires = [...globalRequires, ...required, ...frameRunner];
|
||||
const toHtml = [jsToHtml, cssToHtml];
|
||||
const pipeLine = composeFunctions(...throwers, ...transformers, ...toHtml);
|
||||
const pipeLine = composeFunctions(...transformers, ...toHtml);
|
||||
const finalFiles = Object.keys(files)
|
||||
.map(key => files[key])
|
||||
.map(pipeLine);
|
||||
@@ -68,7 +66,7 @@ export function buildDOMChallenge(files, meta = {}) {
|
||||
}
|
||||
|
||||
export function buildJSChallenge(files) {
|
||||
const pipeLine = composeFunctions(...throwers, ...transformers);
|
||||
const pipeLine = composeFunctions(...transformers);
|
||||
const finalFiles = Object.keys(files)
|
||||
.map(key => files[key])
|
||||
.map(pipeLine);
|
||||
|
@@ -1,10 +1,9 @@
|
||||
import { homeLocation } from '../../../../config/env.json';
|
||||
|
||||
class WorkerExecutor {
|
||||
constructor(workerName) {
|
||||
constructor(workerName, location) {
|
||||
this.workerName = workerName;
|
||||
this.worker = null;
|
||||
this.observers = {};
|
||||
this.location = location;
|
||||
|
||||
this.execute = this.execute.bind(this);
|
||||
this.killWorker = this.killWorker.bind(this);
|
||||
@@ -13,7 +12,7 @@ class WorkerExecutor {
|
||||
|
||||
getWorker() {
|
||||
if (this.worker === null) {
|
||||
this.worker = new Worker(`${homeLocation}/js/${this.workerName}.js`);
|
||||
this.worker = new Worker(`${this.location}${this.workerName}.js`);
|
||||
}
|
||||
|
||||
return this.worker;
|
||||
@@ -72,6 +71,6 @@ class WorkerExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
export default function createWorkerExecutor(workerName) {
|
||||
return new WorkerExecutor(workerName);
|
||||
export default function createWorkerExecutor(workerName, location = '/js/') {
|
||||
return new WorkerExecutor(workerName, location);
|
||||
}
|
||||
|
Reference in New Issue
Block a user