Skip to content

Commit ac59153

Browse files
committed
Add leading slash to fix gatsby serve with path prefix, get tests working with path prefix
1 parent f942afa commit ac59153

File tree

5 files changed

+7
-5
lines changed

5 files changed

+7
-5
lines changed

.github/workflows/build_and_publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ jobs:
5757
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5858
SEGMENT_KEY: ${{ secrets.SEGMENT_KEY }}
5959
- run: npm run test:int
60-
if: "github.ref_name != 'main'"
6160
env:
6261
CI: true
62+
PATH_PREFIX: "${{ github.ref_name == 'main' && 'extensions' || '' }}"
6363
PATH_PREFIX_FLAG: "${{ github.ref_name == 'main' && '--prefix-paths' || '' }}"
6464
- name: Deploy
6565
if: "github.repository == 'quarkusio/extensions' && github.ref_name == 'main' && (github.event_name == 'push' || github.event_name == 'schedule')"

gatsby-config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const { segmentSnippet } = require("./src/analytics/segment-snippet.js")
22

33
module.exports = {
4-
pathPrefix: "extensions",
4+
pathPrefix: "/extensions",
55

66
siteMetadata: {
77
title: `Extensions`,

jest-puppeteer.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ require("dotenv").config()
55

66
module.exports = {
77
server: {
8-
command: `./node_modules/.bin/gatsby serve ${process.env.PATH_PREFIX_FLAG}`,
8+
command: `./node_modules/.bin/gatsby serve ${process.env.PATH_PREFIX_FLAG || ""}`,
99
// The protocol, host and port are used to check when your application
1010
// is ready to accept requests. Your tests will start running as soon as
1111
// the port on that host and protocol are available.
@@ -17,6 +17,7 @@ module.exports = {
1717
// your application requires more time to boot.
1818
launchTimeout: 45000,
1919
debug: true,
20+
path: process.env.PATH_PREFIX || "/",
2021
},
2122
launch: {
2223
defaultViewport: {

test-integration/frontpage.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ jest.setTimeout(25 * 1000)
22

33
const { port } = require("../jest-puppeteer.config").server
44

5-
const siteRoot = `http://localhost:${port}`
5+
const siteRoot = `http://localhost:${port}/${process.env.PATH_PREFIX}`
66

77
describe("main site", () => {
88
beforeAll(async () => {

test-integration/links.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ const { curly } = require("node-libcurl")
66
const promiseRetry = require("promise-retry")
77

88
const config = require("../gatsby-config.js")
9+
const { port } = require("../jest-puppeteer.config").server
910

1011
describe("site links", () => {
1112
const deadExternalLinks = []
1213
const deadInternalLinks = []
1314

1415
beforeAll(async () => {
15-
const path = "http://localhost:9000"
16+
const path = `http://localhost:${port}/${process.env.PATH_PREFIX}`
1617

1718
// create a new `LinkChecker` that we'll use to run the scan.
1819
const checker = new link.LinkChecker()

0 commit comments

Comments
 (0)