Skip to content

Commit

Permalink
fix(spawner): get tests to pass by fighting the esm package
Browse files Browse the repository at this point in the history
This ugly hack will go away once we excise the esm package.
  • Loading branch information
michaelfig committed Feb 28, 2020
1 parent efc6b4a commit 6993c1b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/spawner/src/contractHost.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ function makeContractHost(E, evaluate, additionalEndowments = {}) {
sameStructure,
mustBeSameStructure,
};

const fullEndowments = Object.create(null, {
...Object.getOwnPropertyDescriptors(defaultEndowments),
...Object.getOwnPropertyDescriptors(additionalEndowments),
Expand All @@ -71,6 +72,12 @@ function makeContractHost(E, evaluate, additionalEndowments = {}) {
`"${functionSrcString}" must be a string, but was ${typeof functionSrcString}`,
);

// FIXME: Defeat ESM!
functionSrcString = functionSrcString.replace(
/sameStructure\.((mustBeS|s)ameStructure)/g,
'$1',
);

// Refill a meter each crank.
const { meter, refillFacet } = makeMeter();
const doRefill = () => {
Expand Down Expand Up @@ -172,7 +179,7 @@ function makeContractHost(E, evaluate, additionalEndowments = {}) {
function spawn(termsP) {
let startFn;
if (moduleFormat === 'object') {
startFn = evaluateStringToFn(contractSrcs.start, );
startFn = evaluateStringToFn(contractSrcs.start);
} else if (
moduleFormat === 'getExport' ||
moduleFormat === 'nestedEvaluate'
Expand Down

0 comments on commit 6993c1b

Please sign in to comment.