Skip to content

Commit

Permalink
refactor: importSpec sync compat
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Feb 13, 2025
1 parent fbaf965 commit 7bff6b3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions packages/boot/test/upgrading/upgrade-contracts.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import { buildVatController } from '@agoric/swingset-vat';
const test = anyTest;

const bfile = name => new URL(name, import.meta.url).pathname;
const importSpec = spec =>
importMetaResolve(spec, import.meta.url).then(u => new URL(u).pathname);
const importSpec = async spec =>
new URL(importMetaResolve(spec, import.meta.url)).pathname;

test('upgrade mintHolder', async t => {
/** @type {SwingSetConfig} */
Expand Down
4 changes: 2 additions & 2 deletions packages/boot/test/upgrading/upgrade-vats.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { matchAmount, matchIter, matchRef } from '../../tools/supports.js';
import type { buildRootObject as buildTestMintVat } from './vat-mint.js';

const bfile = name => new URL(name, import.meta.url).pathname;
const importSpec = spec =>
importMetaResolve(spec, import.meta.url).then(u => new URL(u).pathname);
const importSpec = async spec =>
new URL(importMetaResolve(spec, import.meta.url)).pathname;

const makeCallOutbound = t => (srcID, obj) => {
t.log(`callOutbound(${srcID}, ${obj})`);
Expand Down
6 changes: 3 additions & 3 deletions packages/boot/tools/supports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,13 @@ interface Powers {
fs: typeof import('node:fs/promises');
}

const importSpec = async spec =>
new URL(importMetaResolve(spec, import.meta.url)).pathname;

export const makeProposalExtractor = ({ childProcess, fs }: Powers) => {
const getPkgPath = (pkg, fileName = '') =>
new URL(`../../${pkg}/${fileName}`, import.meta.url).pathname;

const importSpec = spec =>
importMetaResolve(spec, import.meta.url).then(u => new URL(u).pathname);

const runPackageScript = (
outputDir: string,
scriptPath: string,
Expand Down
4 changes: 2 additions & 2 deletions packages/smart-wallet/test/addAsset.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import { makeDefaultTestContext } from './contexts.js';
import { ActionType, headValue, makeMockTestSpace } from './supports.js';
import { makeImportContext } from '../src/marshal-contexts.js';

const importSpec = spec =>
importMetaResolve(spec, import.meta.url).then(u => new URL(u).pathname);
const importSpec = async spec =>
new URL(importMetaResolve(spec, import.meta.url)).pathname;

/**
* @type {import('ava').TestFn<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import {
// so paths can be expresssed relative to this file and made absolute
const bfile = name => new URL(name, import.meta.url).pathname;

const importSpec = spec =>
importMetaResolve(spec, import.meta.url).then(u => new URL(u).pathname);
const importSpec = async spec =>
new URL(importMetaResolve(spec, import.meta.url)).pathname;

test('walletFactory service upgrade', async t => {
/** @type {SwingSetConfig} */
Expand Down

0 comments on commit 7bff6b3

Please sign in to comment.