Skip to content

Commit

Permalink
fix: take advantage of /.../ being stripped from stack traces
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Feb 5, 2021
1 parent b529446 commit 7acacc0
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/SwingSet/src/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export async function makeSwingsetController(
}
const kernelBundle = JSON.parse(hostStorage.get('kernelBundle'));
const kernelNS = await importBundle(kernelBundle, {
filePrefix: 'kernel',
filePrefix: 'kernel/...',
endowments: {
console: makeConsole(`${debugPrefix}SwingSet:kernel`),
assert,
Expand Down
2 changes: 1 addition & 1 deletion packages/SwingSet/src/kernel/kernel.js
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ export default function buildKernel(
const devConsole = makeConsole(`${debugPrefix}SwingSet:dev-${name}`);
// eslint-disable-next-line no-await-in-loop
const NS = await importBundle(source.bundle, {
filePrefix: `dev-${name}`,
filePrefix: `dev-${name}/...`,
endowments: harden({ ...vatEndowments, console: devConsole, assert }),
});
assert(
Expand Down
2 changes: 1 addition & 1 deletion packages/SwingSet/src/kernel/vatManager/manager-local.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export function makeLocalVatManagerFactory(tools) {
}

const vatNS = await importBundle(bundle, {
filePrefix: vatID,
filePrefix: `vat-${vatID}/...`,
endowments,
inescapableTransforms,
inescapableGlobalLexicals,
Expand Down
2 changes: 1 addition & 1 deletion packages/bundle-source/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { SourceMapConsumer } from 'source-map';
import './types';

const DEFAULT_MODULE_FORMAT = 'nestedEvaluate';
const DEFAULT_FILE_PREFIX = '/bundled-source';
const DEFAULT_FILE_PREFIX = '/bundled-source/...';
const SUPPORTED_FORMATS = ['getExport', 'nestedEvaluate', 'endoZipBase64'];

const IMPORT_RE = new RegExp('\\b(import)(\\s*(?:\\(|/[/*]))', 'sg');
Expand Down
6 changes: 3 additions & 3 deletions packages/bundle-source/test/test-sanity.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ test('nestedEvaluate', async t => {
const err = bundle.makeError('foo');
// console.log(err.stack);
t.assert(
err.stack.indexOf('(/bundled-source/encourage.js:3:') >= 0,
err.stack.indexOf('(/bundled-source/.../encourage.js:3:') >= 0,
'bundled source is in stack trace with correct line number',
);

const err2 = bundle.makeError2('bar');
t.assert(
err2.stack.indexOf('(/bundled-source/index.js:8:') >= 0,
err2.stack.indexOf('(/bundled-source/.../index.js:8:') >= 0,
'bundled source is in second stack trace with correct line number',
);

Expand Down Expand Up @@ -99,7 +99,7 @@ test('getExport', async t => {
const bundle = ex1.default();
const err = bundle.makeError('foo');
t.assert(
err.stack.indexOf('(/bundled-source/encourage.js:') < 0,
err.stack.indexOf('(/bundled-source/.../encourage.js:') < 0,
'bundled source is not in stack trace',
);

Expand Down

0 comments on commit 7acacc0

Please sign in to comment.