feat: make editable code available in tests
This commit is contained in:
committed by
Mrugesh Mohapatra
parent
6e091a7cdb
commit
68b223322f
@@ -53,13 +53,15 @@ function buildSourceMap(files) {
|
||||
// the same name 'index'. This made the last file the only file to appear in
|
||||
// sources.
|
||||
// A better solution is to store and handle them separately. Perhaps never
|
||||
// setting the name to 'index'.
|
||||
// setting the name to 'index'. Use 'contents' instead?
|
||||
// TODO: is file.source ever defined?
|
||||
return files.reduce(
|
||||
(sources, file) => {
|
||||
sources[file.name] += file.source || file.contents;
|
||||
sources.editableContents += file.editableContents;
|
||||
return sources;
|
||||
},
|
||||
{ index: '' }
|
||||
{ index: '', editableContents: '' }
|
||||
);
|
||||
}
|
||||
|
||||
@@ -111,7 +113,10 @@ export function getTestRunner(buildData, { proxyLogger }, document) {
|
||||
}
|
||||
|
||||
function getJSTestRunner({ build, sources }, proxyLogger) {
|
||||
const code = sources && 'index' in sources ? sources['index'] : '';
|
||||
const code = {
|
||||
contents: sources.index,
|
||||
editableContents: sources.editableContents
|
||||
};
|
||||
|
||||
const testWorker = createWorker(testEvaluator, { terminateWorker: true });
|
||||
|
||||
|
Reference in New Issue
Block a user