Skip to content

Commit

Permalink
add APP_URL to tests in next
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-burel committed May 24, 2022
1 parent eba4f78 commit 2069416
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 42 deletions.
10 changes: 10 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,15 @@
"**/.next": true,
"**/.vn/scripts/js-generated": true,
"**/remix/**/build": true
},
// syntax highlight .env
"files.associations": {
"*.env.development": "env",
"*.env.production": "env",
"*.env.development.local": "env",
"*.env.production.local": "env",
".env.local": "env",
".env.test": "env",
".env.test.local": "env"
}
}
45 changes: 31 additions & 14 deletions starters/next/.env.development
Original file line number Diff line number Diff line change
@@ -1,33 +1,50 @@
# If token is less than 32 char you'll get "Password too short error"!
TOKEN_SECRET="this-is-a-token-secret-with-at-least-32-chars"
# DO NOT EDIT .env.development! (except during development)
# COPY ME in ".env.development.local" beforehand

NEXT_PUBLIC_GRAPHQL_URI="http://localhost:3000/api/graphql"
# ## App setup

# Set to 1 when relying on a cross-domain API (provided by Vulcan Express, Vulcan Meteor backend or another Vulcan Next app for instance)
# NEXT_PUBLIC_CROSS_DOMAIN_GRAPHQL_URI=1
# Setup in production with your final main URL
# With port and protocol: https://origin:port
APP_URL=

APOLLO_SERVER_CORS_WHITELIST="http://localhost:3000"

# ## Environment

NEXT_PUBLIC_NODE_ENV=development

# Needed for Cypress tests as middleware env variables are defined at build time
# @see https://github.com/vercel/next.js/discussions/36338
NEXT_PUBLIC_IS_LOCAL=1
NEXT_PUBLIC_IS_CI=0

# ## Auth and security

# If token is less than 32 char you'll get "Password too short error"!
TOKEN_SECRET="this-is-a-token-secret-with-at-least-32-chars"

ADMIN_EMAIL="you.need.to.change.this.value@vulcanjs.com"
# if you have changed ADMIN_INITIAL_PASSWORD here in .env.development, please add the
# value in your local .env.test.local (it's safe, it's not tracked by git) so Cypress can work correctly
ADMIN_INITIAL_PASSWORD="vulcan_is_cool"

# ## API
NEXT_PUBLIC_GRAPHQL_URI="http://localhost:3000/api/graphql"
# Set to 1 when relying on a cross-domain API (provided by Vulcan Express, Vulcan Meteor backend or another Vulcan Next app for instance)
# NEXT_PUBLIC_CROSS_DOMAIN_GRAPHQL_URI=1
APOLLO_SERVER_CORS_WHITELIST="http://localhost:3000"

MONGO_URI="mongodb+srv://johnDoe:T74OcxqL15TRt7Zn@lbke-demo-ara2d.mongodb.net/sample_restaurants?retryWrites=true&w=majority"
# MONGO_URI="mongodb://localhost:27017/vulcan-next-app"

# ## Testing

# Replace with your own token, see https://www.chromatic.com
CHROMATIC_PROJECT_TOKEN=

# ## Emails

# Replace with your SMTP server configuration
MAIL_FROM="My App <myapp@changethisname.whatever>",
SMTP_HOST=
SMTP_PORT=
SMTP_SECURE=

NEXT_PUBLIC_NODE_ENV=development

# Needed for Cypress tests as middleware env variables are defined at build time
# @see https://github.com/vercel/next.js/discussions/36338
NEXT_PUBLIC_IS_LOCAL=1
NEXT_PUBLIC_IS_CI=0
SMTP_SECURE=
12 changes: 10 additions & 2 deletions starters/next/.env.test
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# ## App setup

# Setup in production with your final main URL
# With port and protocol: https://origin:port
APP_URL=http://localhost:3000

# ## Environment

NEXT_PUBLIC_NODE_ENV=test

# If token is less than 32 char you'll get "Password too short error"!
TOKEN_SECRET="test-secret-token-must-be-at-least-32-chars"
NEXT_PUBLIC_GRAPHQL_URI="http://localhost:3000/api/graphql"
Expand All @@ -14,5 +24,3 @@ ADMIN_INITIAL_PASSWORD="vulcan_is_cool"
SMTP_HOST=localhost
SMTP_PORT=7777
SMTP_SECURE=

NEXT_PUBLIC_NODE_ENV=test
4 changes: 3 additions & 1 deletion starters/next/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
"*.env.production": "env",
"*.env.development.local": "env",
"*.env.production.local": "env",
".env.local": "env"
".env.local": "env",
".env.test": "env",
".env.test.local": "env"
}
}
50 changes: 25 additions & 25 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10181,7 +10181,7 @@ __metadata:
languageName: unknown
linkType: soft

"@vulcanjs/graphql@^0.6.7, @vulcanjs/graphql@workspace:packages/graphql":
"@vulcanjs/graphql@^0.6.8-alpha.4, @vulcanjs/graphql@workspace:packages/graphql":
version: 0.0.0-use.local
resolution: "@vulcanjs/graphql@workspace:packages/graphql"
dependencies:
Expand Down Expand Up @@ -10229,11 +10229,11 @@ __metadata:
languageName: unknown
linkType: soft

"@vulcanjs/meteor-legacy@^0.6.7, @vulcanjs/meteor-legacy@workspace:packages/meteor-legacy":
"@vulcanjs/meteor-legacy@^0.6.8-alpha.4, @vulcanjs/meteor-legacy@workspace:packages/meteor-legacy":
version: 0.0.0-use.local
resolution: "@vulcanjs/meteor-legacy@workspace:packages/meteor-legacy"
dependencies:
"@vulcanjs/graphql": ^0.6.7
"@vulcanjs/graphql": ^0.6.8-alpha.4
lodash: ^4.17.21
peerDependencies:
"@apollo/client": ">= 3.2.0"
Expand All @@ -10250,12 +10250,12 @@ __metadata:
languageName: unknown
linkType: soft

"@vulcanjs/mongo-apollo@^0.6.7, @vulcanjs/mongo-apollo@workspace:packages/mongo-apollo":
"@vulcanjs/mongo-apollo@^0.6.8-alpha.4, @vulcanjs/mongo-apollo@workspace:packages/mongo-apollo":
version: 0.0.0-use.local
resolution: "@vulcanjs/mongo-apollo@workspace:packages/mongo-apollo"
dependencies:
"@vulcanjs/crud": ^0.6.7
"@vulcanjs/graphql": ^0.6.7
"@vulcanjs/graphql": ^0.6.8-alpha.4
"@vulcanjs/mongo": ^0.6.7
"@vulcanjs/utils": ^0.6.7
apollo-datasource-mongodb: ^0.5.2
Expand Down Expand Up @@ -10299,13 +10299,13 @@ __metadata:
languageName: unknown
linkType: soft

"@vulcanjs/react-hooks@^0.6.7, @vulcanjs/react-hooks@workspace:packages/react-hooks":
"@vulcanjs/react-hooks@^0.6.8-alpha.4, @vulcanjs/react-hooks@workspace:packages/react-hooks":
version: 0.0.0-use.local
resolution: "@vulcanjs/react-hooks@workspace:packages/react-hooks"
dependencies:
"@testing-library/react-hooks": ^3.4.1
"@vulcanjs/crud": ^0.6.7
"@vulcanjs/graphql": ^0.6.7
"@vulcanjs/graphql": ^0.6.8-alpha.4
"@vulcanjs/mongo": ^0.6.7
"@vulcanjs/schema": ^0.6.7
debug: ^4.3.1
Expand Down Expand Up @@ -10340,7 +10340,7 @@ __metadata:
dependencies:
"@types/lodash": ^4.14.168
"@types/underscore": ^1.11.1
"@vulcanjs/graphql": ^0.6.7
"@vulcanjs/graphql": ^0.6.8-alpha.4
"@vulcanjs/model": ^0.6.7
"@vulcanjs/schema": ^0.6.7
classnames: ^2.3.1
Expand All @@ -10358,18 +10358,18 @@ __metadata:
languageName: unknown
linkType: soft

"@vulcanjs/react-ui-lite@^0.6.8-alpha.2, @vulcanjs/react-ui-lite@workspace:packages/react-ui-lite":
"@vulcanjs/react-ui-lite@^0.6.8-alpha.4, @vulcanjs/react-ui-lite@workspace:packages/react-ui-lite":
version: 0.0.0-use.local
resolution: "@vulcanjs/react-ui-lite@workspace:packages/react-ui-lite"
dependencies:
"@types/lodash": ^4.14.168
"@vulcanjs/graphql": ^0.6.7
"@vulcanjs/graphql": ^0.6.8-alpha.4
"@vulcanjs/i18n": ^0.6.7
"@vulcanjs/model": ^0.6.7
"@vulcanjs/permissions": ^0.6.7
"@vulcanjs/react-hooks": ^0.6.7
"@vulcanjs/react-hooks": ^0.6.8-alpha.4
"@vulcanjs/react-i18n": ^0.6.7
"@vulcanjs/react-ui": ^0.6.8-alpha.2
"@vulcanjs/react-ui": ^0.6.8-alpha.4
"@vulcanjs/schema": ^0.6.7
"@vulcanjs/utils": ^0.6.7
classnames: ^2.3.1
Expand All @@ -10396,10 +10396,10 @@ __metadata:
"@types/lodash": ^4.14.168
"@types/underscore": ^1.11.1
"@vulcanjs/core": ^0.6.7
"@vulcanjs/graphql": ^0.6.7
"@vulcanjs/graphql": ^0.6.8-alpha.4
"@vulcanjs/model": ^0.6.7
"@vulcanjs/permissions": ^0.6.7
"@vulcanjs/react-hooks": ^0.6.7
"@vulcanjs/react-hooks": ^0.6.8-alpha.4
"@vulcanjs/react-i18n": ^0.6.7
"@vulcanjs/schema": ^0.6.7
"@vulcanjs/utils": ^0.6.7
Expand All @@ -10421,18 +10421,18 @@ __metadata:
languageName: unknown
linkType: soft

"@vulcanjs/react-ui@^0.6.8-alpha.2, @vulcanjs/react-ui@workspace:packages/react-ui":
"@vulcanjs/react-ui@^0.6.8-alpha.4, @vulcanjs/react-ui@workspace:packages/react-ui":
version: 0.0.0-use.local
resolution: "@vulcanjs/react-ui@workspace:packages/react-ui"
dependencies:
"@types/lodash": ^4.14.168
"@types/underscore": ^1.11.1
"@vulcanjs/core": ^0.6.7
"@vulcanjs/graphql": ^0.6.7
"@vulcanjs/graphql": ^0.6.8-alpha.4
"@vulcanjs/i18n": ^0.6.7
"@vulcanjs/model": ^0.6.7
"@vulcanjs/permissions": ^0.6.7
"@vulcanjs/react-hooks": ^0.6.7
"@vulcanjs/react-hooks": ^0.6.8-alpha.4
"@vulcanjs/react-i18n": ^0.6.7
"@vulcanjs/schema": ^0.6.7
"@vulcanjs/utils": ^0.6.7
Expand Down Expand Up @@ -36210,9 +36210,9 @@ __metadata:
resolution: "vulcan-express@workspace:starters/express"
dependencies:
"@graphql-tools/schema": ^8.3.2
"@vulcanjs/graphql": ^0.6.7
"@vulcanjs/graphql": ^0.6.8-alpha.4
"@vulcanjs/mongo": ^0.6.7
"@vulcanjs/mongo-apollo": ^0.6.7
"@vulcanjs/mongo-apollo": ^0.6.8-alpha.4
apollo-server-express: ^3.6.4
express: ^4.17.3
mongodb-memory-server: ^8.4.0
Expand Down Expand Up @@ -36271,15 +36271,15 @@ __metadata:
"@types/shelljs": ^0.8.8
"@vercel/ncc": ^0.30.0
"@vulcanjs/crud": ^0.6.7
"@vulcanjs/graphql": ^0.6.7
"@vulcanjs/graphql": ^0.6.8-alpha.4
"@vulcanjs/mdx": ^0.6.7
"@vulcanjs/meteor-legacy": ^0.6.7
"@vulcanjs/meteor-legacy": ^0.6.8-alpha.4
"@vulcanjs/model": ^0.6.7
"@vulcanjs/mongo": ^0.6.7
"@vulcanjs/mongo-apollo": ^0.6.7
"@vulcanjs/react-hooks": ^0.6.7
"@vulcanjs/react-ui": ^0.6.8-alpha.2
"@vulcanjs/react-ui-lite": ^0.6.8-alpha.2
"@vulcanjs/mongo-apollo": ^0.6.8-alpha.4
"@vulcanjs/react-hooks": ^0.6.8-alpha.4
"@vulcanjs/react-ui": ^0.6.8-alpha.4
"@vulcanjs/react-ui-lite": ^0.6.8-alpha.4
"@vulcanjs/schema": ^0.6.7
apollo-datasource-mongodb: ^0.5.2
apollo-server: ^3
Expand Down

0 comments on commit 2069416

Please sign in to comment.