forked from prisma/prisma
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.ts
34 lines (27 loc) · 1.09 KB
/
test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { getBinaryTargetForCurrentPlatform } from '@prisma/get-platform'
import { ClientEngineType, getClientEngineType } from '@prisma/internals'
import fs from 'fs'
import path from 'path'
import { generateTestClient } from '../../../../utils/getTestClient'
const testIf = (condition: boolean) => (condition ? test : test.skip)
// Tests that no error is being thrown when the binary is manually set to chmod 644 because Client fixes that itself
testIf(process.platform !== 'win32')('chmod', async () => {
await generateTestClient()
const binaryTarget = await getBinaryTargetForCurrentPlatform()
if (getClientEngineType() !== ClientEngineType.Library) {
const binaryPath = path.join(__dirname, 'node_modules/.prisma/client', `query-engine-${binaryTarget}`)
fs.chmodSync(binaryPath, '644')
}
const { PrismaClient } = require('./node_modules/@prisma/client')
const prisma = new PrismaClient({
log: [
{
emit: 'event',
level: 'query',
},
],
})
await prisma.user.findMany()
await prisma.$disconnect()
// TODO expect that chmod is now not 644 any more
})