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

jest-dev-server: Support an option for a base path #342

Closed
thernstig opened this issue Apr 9, 2020 · 1 comment · Fixed by #382
Closed

jest-dev-server: Support an option for a base path #342

thernstig opened this issue Apr 9, 2020 · 1 comment · Fixed by #382

Comments

@thernstig
Copy link

🚀 Feature Proposal

Add an option for a basePath where server is running, appended to the host:port. E.g.:

module.exports = {
  command: 'npm run start --port 3000',
  host: 'customhost.com',
  port: 3000,
  basePath: 'myservice'
}

Would equal to this URL where the server is hosting files: customhost:3000/myservice.

Motivation

Many cloud native apps support setting a basePath, since ingress/proxies/edge routes often host services/apps under a "prefix". Supporting a basePath means that in local development you can test so that your application works properly when using a basePath, verifying it works properly with such ingress/edge proxies.

Example

See above. Also see e.g. this proxy (most proxies has the same functionality):
https://docs.traefik.io/v1.4/basics/#path-matcher-usage-guidelines

Pitch

jest-dev-server is used to launch "your own app" to test it e.g. when running locally, and we want to be able to mimic real-life scenarios.

@kellyjosephprice
Copy link
Contributor

My workaround:

module.exports = {
  command: 'npm run start --port 3000',
  waitOnScheme: {
    resources: [ 'http-get://customhost.com:3000/myservice' ],
  }
}

The underlying wait-on accepts a url, and it's undocumented, but you can overwrite the options passed to wait-on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants