Skip to content

Commit b6ecec8

Browse files
committed
naming
1 parent cf15192 commit b6ecec8

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

packages/addons/_tests/_setup/suite.ts

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -130,26 +130,25 @@ export function setupTest<Addons extends AddonMap>(
130130
type PrepareServerOptions = {
131131
cwd: string;
132132
page: Page;
133-
previewCommand?: string;
134-
buildCommand?: string;
135133
installCommand?: string;
134+
beforeBuild?: () => Promise<any> | any;
135+
buildCommand?: string;
136+
previewCommand?: string;
136137
};
137138
// installs dependencies, builds the project, and spins up the preview server
138-
async function prepareServer(
139-
{
140-
cwd,
141-
page,
142-
installCommand,
143-
buildCommand = 'pnpm build',
144-
previewCommand = 'pnpm preview'
145-
}: PrepareServerOptions,
146-
afterInstall?: () => Promise<any> | any
147-
) {
139+
async function prepareServer({
140+
cwd,
141+
page,
142+
installCommand, // should happen in the beforeAll hook
143+
beforeBuild,
144+
buildCommand = 'pnpm build',
145+
previewCommand = 'pnpm preview'
146+
}: PrepareServerOptions) {
148147
// install deps
149148
if (installCommand) execSync(installCommand, { cwd, stdio: 'pipe' });
150149

151150
// ...do commands and any other extra stuff
152-
await afterInstall?.();
151+
await beforeBuild?.();
153152

154153
// build project
155154
if (buildCommand) execSync(buildCommand, { cwd, stdio: 'pipe' });

packages/addons/_tests/drizzle/test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,12 @@ test.concurrent.for(flavors)('drizzle $kind.type $variant', async (flavor, { pag
6868
const pageServerPath = path.resolve(routes, `+page.server.${ts ? 'ts' : 'js'}`);
6969
fs.writeFileSync(pageServerPath, pageServer, 'utf8');
7070

71-
const { close } = await prepareServer({ cwd, page }, () => {
72-
execSync('npm run db:push', { cwd, stdio: 'pipe' });
71+
const { close } = await prepareServer({
72+
cwd,
73+
page,
74+
beforeBuild: () => {
75+
execSync('npm run db:push', { cwd, stdio: 'pipe' });
76+
}
7377
});
7478
// kill server process when we're done
7579
ctx.onTestFinished(async () => await close());

0 commit comments

Comments
 (0)