Skip to content

Commit

Permalink
VACMS-15314: Shift localhost port for dev server to 3999. (#358)
Browse files Browse the repository at this point in the history
Co-authored-by: Josh Mills <[email protected]>
Co-authored-by: Ryan Koch <[email protected]>
Co-authored-by: Tanner Heffner <[email protected]>
  • Loading branch information
4 people authored Jan 30, 2024
1 parent 9a0b282 commit 9094220
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ public/generated/*
/out/*
/storybook-static/*
playwright.config.ts
playwright/utils/next-test.ts
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ You should set these up before attempting to install the repo.

8. Run `yarn dev`.

You will now have a Next.js development server running at http://localhost:3000, which will refresh with changes to your local environment.
You will now have a Next.js development server running at http://localhost:3999, which will refresh with changes to your local environment. (Note: your local port may differ if you changed the value for `PORT` in .env.local).

## Environment Flags

Expand Down
3 changes: 3 additions & 0 deletions envs/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ NEXT_PUBLIC_ASSETS_URL=/generated/
NEXT_PUBLIC_GOOGLE_TAG_MANAGER_ID=GTM-WFJWBD
NEXT_PUBLIC_GOOGLE_TAG_MANAGER_AUTH=N9BisSDKAwJENFQtQIEvXQ
NEXT_PUBLIC_GOOGLE_TAG_MANAGER_PREVIEW=env-423

# Configure the localhost port for the Next.js dev server
PORT=3999
4 changes: 3 additions & 1 deletion playwright/utils/next-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ export const test = base.extend<NextFixtures>({
async ({ context }, use, testInfo) => {
// Any code here will be run as a before each hook
await context.route(/gtm.js*/, (route) => route.abort())
await context.route(/:3000*/, (route) => route.abort())
// Do not make requests to the localhost server.
await context.route(`/:${process.env.PORT}*/`, (route) => route.abort())
// Do not make requests to a running vets-website server.
await context.route(/:3001*/, (route) => route.abort())

// This is the individual test run
Expand Down
6 changes: 3 additions & 3 deletions src/lib/drupal/getGlobalElements.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import nock from 'nock'
axios.defaults.adapter = 'http'

const getData = async () => {
const res = await axios.get('http://localhost:3000/api/')
const res = await axios.get(`http://localhost:${process.env.PORT}/api/`)
const data = res.data
return data
}

const slugRoute = async () => {
nock('http://localhost:3000/api/')
nock(`http://localhost:${process.env.PORT}/api/`)
.get('/')
.reply(200, {
data: {
Expand All @@ -25,7 +25,7 @@ const slugRoute = async () => {
}

const homeRoute = async () => {
nock('http://localhost:3000/api/')
nock(`http://localhost:${process.env.PORT}/api/`)
.get('/')
.reply(200, {
data: {
Expand Down

0 comments on commit 9094220

Please sign in to comment.