-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix keystone prisma error message, and update tests
- Loading branch information
Showing
5 changed files
with
81 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,38 @@ | ||
import execa from 'execa' | ||
import { basicKeystoneConfig, cliBinPath, schemas, symlinkKeystoneDeps, testdir } from './utils' | ||
import { | ||
basicKeystoneConfig, | ||
schemas, | ||
spawnCommand, | ||
spawnCommand2, | ||
symlinkKeystoneDeps, | ||
testdir | ||
} from './utils' | ||
|
||
// testing erroring when the schemas are not up to date is in artifacts.test.ts | ||
|
||
test('keystone prisma exits with the same code as the prisma child process exits with', async () => { | ||
const tmp = await testdir({ | ||
const cwd = await testdir({ | ||
...symlinkKeystoneDeps, | ||
...schemas, | ||
'keystone.js': basicKeystoneConfig, | ||
}) | ||
const result = await execa('node', [cliBinPath, 'prisma', 'bad-thing'], { | ||
reject: false, | ||
all: true, | ||
cwd: tmp, | ||
}) | ||
expect(result.all!.replace(/[^ -~\n]/g, '?').replace(/ \n/g, '\n')).toMatchSnapshot() | ||
expect(result.exitCode).toBe(1) | ||
|
||
await spawnCommand(cwd, ['build', '--no-ui']) | ||
const { exitCode, output } = await spawnCommand2(cwd, ['prisma', 'bad-thing']) | ||
|
||
expect(exitCode).toEqual(1) | ||
expect(output.replace(/[^ -~\n]/g, '?').replace(/ \n/g, '\n')).toMatchSnapshot() | ||
}) | ||
|
||
test('keystone prisma uses the db url in the keystone config', async () => { | ||
const tmp = await testdir({ | ||
const cwd = await testdir({ | ||
...symlinkKeystoneDeps, | ||
...schemas, | ||
'keystone.js': basicKeystoneConfig, | ||
}) | ||
const result = await execa('node', [cliBinPath, 'prisma', 'migrate', 'status'], { | ||
reject: false, | ||
all: true, | ||
cwd: tmp, | ||
}) | ||
expect(result.all!.replace(/[^ -~\n]/g, '?').replace(/ \n/g, '\n')).toMatchSnapshot() | ||
expect(result.exitCode).toBe(1) | ||
|
||
await spawnCommand(cwd, ['build', '--no-ui']) | ||
const { exitCode, output } = await spawnCommand2(cwd, ['prisma', 'migrate', 'status']) | ||
|
||
expect(exitCode).toEqual(1) | ||
expect(output.replace(/[^ -~\n]/g, '?').replace(/ \n/g, '\n')).toMatchSnapshot() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { | ||
basicKeystoneConfig, | ||
cliBinPath, | ||
schemas, | ||
spawnCommand, | ||
symlinkKeystoneDeps, | ||
testdir | ||
} from './utils' | ||
|
||
// testing erroring when the schemas are not up to date is in artifacts.test.ts | ||
|
||
test('keystone prisma exits with the same code as the prisma child process exits with', async () => { | ||
const cwd = await testdir({ | ||
...symlinkKeystoneDeps, | ||
...schemas, | ||
'keystone.js': basicKeystoneConfig, | ||
}) | ||
|
||
const output = await spawnCommand(cwd, ['prisma', 'bad-thing']) | ||
expect(result.all!.replace(/[^ -~\n]/g, '?').replace(/ \n/g, '\n')).toMatchSnapshot() | ||
expect(result.exitCode).toBe(1) | ||
}) | ||
|
||
test('keystone prisma uses the db url in the keystone config', async () => { | ||
const tmp = await testdir({ | ||
...symlinkKeystoneDeps, | ||
...schemas, | ||
'keystone.js': basicKeystoneConfig, | ||
}) | ||
const result = await execa('node', [cliBinPath, 'prisma', 'migrate', 'status'], { | ||
reject: false, | ||
all: true, | ||
cwd: tmp, | ||
}) | ||
expect(result.all!.replace(/[^ -~\n]/g, '?').replace(/ \n/g, '\n')).toMatchSnapshot() | ||
expect(result.exitCode).toBe(1) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters