Skip to content

Commit

Permalink
Use test mode; use pretty SQL in test mode
Browse files Browse the repository at this point in the history
  • Loading branch information
benjie committed Feb 22, 2024
1 parent 3736539 commit 7b6a4e4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion grafast/dataplan-pg/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"scripts": {
"update-schema": "ts-node ./__tests__/exampleSchema.ts",
"test:install-schema": "psql -X1v ON_ERROR_STOP=1 -f __tests__/schema.sql -f __tests__/sequence_reset.sql \"${TEST_DATABASE_URL:-graphile_crystal}\"",
"test": "yarn test:install-schema && jest -i",
"test": "GRAPHILE_ENV=test yarn test:install-schema && jest -i",
"posttest": "yarn test:exportSchema:graphql-js && yarn test:exportSchema:typeDefs",
"test:exportSchema:graphql-js": "ENABLE_DEFER_STREAM=1 ts-node ./scripts/exportExampleSchema.ts graphql-js && node ./scripts/runExampleSchema.mjs",
"test:exportSchema:typeDefs": "ENABLE_DEFER_STREAM=1 ts-node ./scripts/exportExampleSchema.ts typeDefs && node ./scripts/runExampleSchema.mjs",
Expand Down
2 changes: 1 addition & 1 deletion jest.config.base.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
if (!("GRAPHILE_ENV" in process.env)) {
process.env.GRAPHILE_ENV = "development";
process.env.GRAPHILE_ENV = "test";
}
module.exports = (dir) => {
const packageJson = require(`${dir}/package.json`);
Expand Down
4 changes: 3 additions & 1 deletion utils/pg-sql2/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ function exportAs<T>(thing: T, exportName: string) {
export const $$symbolToIdentifier = Symbol("symbolToIdentifier");

const isDev =
typeof process !== "undefined" && process.env.GRAPHILE_ENV === "development";
typeof process !== "undefined" &&
(process.env.GRAPHILE_ENV === "development" ||
process.env.GRAPHILE_ENV === "test");

/**
* Represents raw SQL, the text will be output verbatim into the compiled query.
Expand Down

0 comments on commit 7b6a4e4

Please sign in to comment.