Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Prisma test using --frozen #8767

Merged
merged 3 commits into from
Aug 14, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 31 additions & 15 deletions tests/cli-tests/artifacts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,38 @@ import {
testdir,
} from './utils';

describe.each(['postinstall', ['build', '--frozen'], ['prisma', 'migrate', 'status']])(
'%s',
command => {
test('logs an error and exits with 1 when the schemas do not exist', async () => {
const tmp = await testdir({
...symlinkKeystoneDeps,
'keystone.js': basicKeystoneConfig,
});
const recording = recordConsole();
await expect(runCommand(tmp, command)).rejects.toEqual(new ExitError(1));
expect(recording()).toMatchInlineSnapshot(
`"Your Prisma and GraphQL schemas are not up to date"`
);
describe.each(['postinstall', ['build', '--frozen']])('%s', command => {
test('logs an error and exits with 1 when the schemas do not exist', async () => {
const tmp = await testdir({
...symlinkKeystoneDeps,
'keystone.js': basicKeystoneConfig,
});
const recording = recordConsole();
await expect(runCommand(tmp, command)).rejects.toEqual(new ExitError(1));
expect(recording()).toMatchInlineSnapshot(
`"Your Prisma and GraphQL schemas are not up to date"`
);
});
});

describe('prisma migrate status', () => {
test('logs an error and exits with 1 when the schemas do not exist', async () => {
const tmp = await testdir({
...symlinkKeystoneDeps,
'keystone.js': basicKeystoneConfig,
});
}
);
await expect(runCommand(tmp, ['build', '--no-ui', '--frozen'])).rejects.toEqual(
new ExitError(1)
);
const recording = recordConsole();
await expect(runCommand(tmp, ['prisma', '--frozen', 'migrate', 'status'])).rejects.toEqual(
new ExitError(1)
);
expect(recording()).toMatchInlineSnapshot(
`"Your Prisma and GraphQL schemas are not up to date"`
);
});
});

const schemasMatch = ['schema.prisma', 'schema.graphql'];

Expand Down