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: pass env to Node-API and remove patchJest #7581

Merged
merged 14 commits into from
Jun 11, 2021
2 changes: 1 addition & 1 deletion src/packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
"precommit": "lint-staged"
},
"dependencies": {
"@prisma/engines": "2.25.0-14.89926e7ecbebb89657ae2b56ab3454364ad7b5c5"
"@prisma/engines": "2.25.0-24.d580c0e2929f7d38e35a3ee8584e8daf7ffdfacd"
},
"lint-staged": {
"*.ts": [
Expand Down
19 changes: 0 additions & 19 deletions src/packages/client/helpers/patchJest.js

This file was deleted.

7 changes: 3 additions & 4 deletions src/packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"bugs": "https://github.com/prisma/prisma/issues",
"scripts": {
"build": "node helpers/build.js",
"test": "node helpers/patchJest.js && jest --forceExit",
"test": "jest --forceExit",
"format": "prettier --write .",
"lint": "eslint --cache --fix --ext .ts .",
"lint-ci": "eslint --ext .ts .",
Expand All @@ -59,7 +59,7 @@
"devDependencies": {
"@prisma/debug": "workspace:*",
"@prisma/engine-core": "workspace:*",
"@prisma/engines": "2.25.0-14.89926e7ecbebb89657ae2b56ab3454364ad7b5c5",
"@prisma/engines": "2.25.0-24.d580c0e2929f7d38e35a3ee8584e8daf7ffdfacd",
"@prisma/fetch-engine": "workspace:*",
"@prisma/generator-helper": "workspace:*",
"@prisma/get-platform": "workspace:*",
Expand Down Expand Up @@ -103,7 +103,6 @@
"pluralize": "8.0.0",
"prettier": "2.3.1",
"replace-string": "3.1.0",
"resolve-from": "5.0.0",
"rimraf": "3.0.2",
"rollup": "2.51.1",
"rollup-plugin-dts": "3.0.2",
Expand All @@ -127,7 +126,7 @@
}
},
"dependencies": {
"@prisma/engines-version": "2.25.0-14.89926e7ecbebb89657ae2b56ab3454364ad7b5c5"
"@prisma/engines-version": "2.25.0-24.d580c0e2929f7d38e35a3ee8584e8daf7ffdfacd"
},
"lint-staged": {
"*.ts": [
Expand Down
2 changes: 1 addition & 1 deletion src/packages/engine-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
},
"dependencies": {
"@prisma/debug": "workspace:*",
"@prisma/engines": "2.25.0-14.89926e7ecbebb89657ae2b56ab3454364ad7b5c5",
"@prisma/engines": "2.25.0-24.d580c0e2929f7d38e35a3ee8584e8daf7ffdfacd",
"@prisma/generator-helper": "workspace:*",
"@prisma/get-platform": "workspace:*",
"chalk": "^4.0.0",
Expand Down
2 changes: 2 additions & 0 deletions src/packages/engine-core/src/NAPIEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ You may have to run ${chalk.greenBright(
this.engine = new this.QueryEngine(
{
datamodel: this.datamodel,
env: process.env,
logQueries: this.config.logQueries ?? false,
ignoreEnvVarErrors: false,
datasourceOverrides: this.datasourceOverrides,
Expand Down Expand Up @@ -359,6 +360,7 @@ You may have to run ${chalk.greenBright(
datamodel: this.datamodel,
datasourceOverrides: this.datasourceOverrides,
ignoreEnvVarErrors: true,
env: process.env,
})
}
version(forceRun?: boolean): string {
Expand Down
2 changes: 2 additions & 0 deletions src/packages/engine-core/src/napi-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export type QueryEngineConfig = {
logQueries: boolean
ignoreEnvVarErrors: boolean
datasourceOverrides?: Record<string, string>
env: NodeJS.ProcessEnv | Record<string, string>
logLevel: QueryEngineLogLevel
telemetry?: QueryEngineTelemetry
}
Expand Down Expand Up @@ -70,6 +71,7 @@ export type GetConfigOptions = {
datamodel: string
ignoreEnvVarErrors: boolean
datasourceOverrides: Record<string, string>
env: NodeJS.ProcessEnv | Record<string, string>
}
export type GetDMMFOptions = {
datamodel: string
Expand Down
2 changes: 1 addition & 1 deletion src/packages/fetch-engine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
],
"bugs": "https://github.com/prisma/prisma/issues",
"devDependencies": {
"@prisma/engines-version": "2.25.0-14.89926e7ecbebb89657ae2b56ab3454364ad7b5c5",
"@prisma/engines-version": "2.25.0-24.d580c0e2929f7d38e35a3ee8584e8daf7ffdfacd",
"@types/find-cache-dir": "3.2.0",
"@types/jest": "26.0.23",
"@types/node": "12.20.15",
Expand Down
2 changes: 1 addition & 1 deletion src/packages/migrate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"version": "latest"
},
"devDependencies": {
"@prisma/engines-version": "2.25.0-14.89926e7ecbebb89657ae2b56ab3454364ad7b5c5",
"@prisma/engines-version": "2.25.0-24.d580c0e2929f7d38e35a3ee8584e8daf7ffdfacd",
"@prisma/generator-helper": "workspace:*",
"@prisma/sdk": "workspace:*",
"@types/diff": "4.0.2",
Expand Down
48 changes: 24 additions & 24 deletions src/packages/migrate/src/__tests__/rpc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,12 @@ it('evaluateDataLoss - schema-only-sqlite', async () => {
})

await expect(result).resolves.toMatchInlineSnapshot(`
Object {
migrationSteps: Array [
CREATE TABLE "Blog" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"viewCount20" INTEGER NOT NULL
),
],
unexecutableSteps: Array [],
warnings: Array [],
}
`)
Object {
migrationSteps: 1,
unexecutableSteps: Array [],
warnings: Array [],
}
`)
migrate.stop()
})

Expand All @@ -53,12 +48,12 @@ it('evaluateDataLoss - existing-db-1-migration', async () => {
})

await expect(result).resolves.toMatchInlineSnapshot(`
Object {
migrationSteps: Array [],
unexecutableSteps: Array [],
warnings: Array [],
}
`)
Object {
migrationSteps: 0,
unexecutableSteps: Array [],
warnings: Array [],
}
`)
migrate.stop()
})

Expand Down Expand Up @@ -414,13 +409,18 @@ it('devDiagnostic - reset because drift', async () => {
migrationsDirectoryPath: migrate.migrationsDirectoryPath,
})
await expect(result).resolves.toMatchInlineSnapshot(`
Object {
action: Object {
reason: Drift detected: Your database schema is not in sync with your migration history.,
tag: reset,
},
}
`)
Object {
action: Object {
reason: Drift detected: Your database schema is not in sync with your migration history.

[+] Added tables
- Blog
- _Migration
,
tag: reset,
},
}
`)

migrate.stop()
})
5 changes: 2 additions & 3 deletions src/packages/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"format": "prettier --write .",
"lint": "eslint --cache --fix --ext .ts .",
"lint-ci": "eslint --ext .ts .",
"test": "node ./scripts/patchJest && jest",
"test": "jest --verbose --forceExit",
"precommit": "lint-staged"
},
"files": [
Expand Down Expand Up @@ -48,7 +48,7 @@
"dependencies": {
"@prisma/debug": "workspace:*",
"@prisma/engine-core": "workspace:*",
"@prisma/engines": "2.25.0-14.89926e7ecbebb89657ae2b56ab3454364ad7b5c5",
"@prisma/engines": "2.25.0-24.d580c0e2929f7d38e35a3ee8584e8daf7ffdfacd",
"@prisma/fetch-engine": "workspace:*",
"@prisma/generator-helper": "workspace:*",
"@prisma/get-platform": "workspace:*",
Expand All @@ -69,7 +69,6 @@
"node-fetch": "2.6.1",
"p-map": "^4.0.0",
"read-pkg-up": "^7.0.1",
"resolve-from": "^5.0.0",
"resolve-pkg": "^2.0.0",
"rimraf": "^3.0.2",
"shell-quote": "^1.7.2",
Expand Down
17 changes: 0 additions & 17 deletions src/packages/sdk/scripts/patchJest.js

This file was deleted.

1 change: 1 addition & 0 deletions src/packages/sdk/src/engine-commands/getConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ async function getConfigNAPI(
datamodel: options.datamodel,
datasourceOverrides: {},
ignoreEnvVarErrors: options.ignoreEnvVarErrors ?? false,
env: process.env,
})
} catch (e) {
let error
Expand Down