Skip to content

Commit e09b70f

Browse files
author
=
committed
chore: add test for #295
1 parent 695219a commit e09b70f

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

packages/cli/test/plugins/prisma-plugin.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,25 @@ model User {
5757
runCli('generate', workDir);
5858
expect(fs.existsSync(path.join(workDir, 'prisma/schema.prisma'))).toBe(true);
5959
});
60+
61+
it('can generate a Prisma schema with custom output relative to zenstack.output', () => {
62+
const workDir = createProject(`
63+
plugin prisma {
64+
provider = '@core/prisma'
65+
output = './schema.prisma'
66+
}
67+
68+
model User {
69+
id String @id @default(cuid())
70+
}
71+
`);
72+
73+
const pkgJson = JSON.parse(fs.readFileSync(path.join(workDir, 'package.json'), 'utf8'));
74+
pkgJson.zenstack = {
75+
output: './relative',
76+
};
77+
fs.writeFileSync(path.join(workDir, 'package.json'), JSON.stringify(pkgJson, null, 2));
78+
runCli('generate', workDir);
79+
expect(fs.existsSync(path.join(workDir, 'relative/schema.prisma'))).toBe(true);
80+
});
6081
});

0 commit comments

Comments
 (0)