You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Preview Aliases: Force alias generation to meet stricter naming requirements.
6
+
7
+
For cases where CI is requesting Wrangler to generate the alias based on the branch name, we want a stricter check around the generated alias name in order to avoid version upload failures. If a valid alias name was not able to be generated, we warn and do not provide an alias (avoiding a version upload failure).
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+23-14Lines changed: 23 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -330,42 +330,51 @@ export default mergeConfig(
330
330
331
331
If you need to test the interaction of Wrangler with a real Cloudflare account, you can add an E2E test within the `packages/wrangler/e2e` folder. This lets you add a test for functionality that requires real credentials (i.e. testing whether a worker deployed from Wrangler can be accessed over the internet).
332
332
333
-
When you open a PR to the `workers-sdk` repo, you should expect several checks to run in CI. For most PRs (except for those which trigger the **C3 E2E (Quarantine)** Action), every check should pass (although some will be skipped).
333
+
A summary of this repositories actions can be found [in the `.github/workflows` folder](.github/workflows/README.md)
334
334
335
-
A summary of this repositories actions can be found [here](.github/workflows/README.md)
335
+
## Running E2E tests locally
336
336
337
-
## Running e2e tests locally
337
+
A large number of Wrangler & Vite's E2E tests don't require any authentication, and can be run with no Cloudflare account credentials. These can be run as follows:
338
338
339
-
To run the e2e tests locally, you'll need a Cloudflare API Token and run:
WRANGLER="node ~/path/to/workers-sdk/packages/wrangler/wrangler-dist/cli.js" CLOUDFLARE_ACCOUNT_ID=$CLOUDFLARE_TESTING_ACCOUNT_ID CLOUDFLARE_API_TOKEN=$CLOUDFLARE_TESTING_API_TOKEN pnpm run test:e2e
343
-
```
341
+
-**Wrangler:**`pnpm test:e2e:wrangler`, optionally providing [`CLOUDFLARE_ACCOUNT_ID` and `CLOUDFLARE_API_TOKEN` environment variables.](#creating-an-api-token)
344
342
345
343
You may optionally want to append a filename pattern to limit which e2e tests are run. Also you may want to set `--bail=n` to limit the number of fails tests to show the error before the rest of the tests finish running and to limit the noise in that output:
346
344
347
345
```sh
348
-
WRANGLER="node ~/path/to/workers-sdk/packages/wrangler/wrangler-dist/cli.js" CLOUDFLARE_ACCOUNT_ID=$CLOUDFLARE_TESTING_ACCOUNT_ID CLOUDFLARE_API_TOKEN=$CLOUDFLARE_TESTING_API_TOKEN pnpm run test:e2e [file-pattern] --bail=1
If you want to run the E2E tests that access the Cloudflare API (e.g. for testing Worker deployment and interaction with bindings), you can create an API token for running the tests:
356
+
353
357
1. Go to ["My Profile" > "User API Tokens"](https://dash.cloudflare.com/profile/api-tokens)
354
358
1. Click "Create Token"
355
359
1. Use the "Edit Cloudflare Workers" template
356
360
1. Set "Account Resources" to "Include" the account you want to use for running the test
357
-
(Note for the internal wrangler team, here we use the "DevProd Testing" account)
358
-
1.Set "Zone Resources" to "All zones from an account" and the same account as above
361
+
(for internal and CI use, this needs to be the "DevProd Testing" account)
362
+
1.No "Zone Resources" are required for general use (for internal and CI use, this needs to be set to "All Zones")
359
363
1. Click "Continue to summary"
360
364
1. Verify your token works by running the curl command provided
361
-
1. Set the environment variables in your terminal or in your profile file (e.g. ~/.zshrc, ~/.bashrc, ~/.profile, etc):
365
+
366
+
Once you've created the token, you can use it when running E2E tests to test against the API:
362
367
363
368
```sh
364
-
export CLOUDFLARE_TESTING_ACCOUNT_ID="<Account ID for the token you just created>"
365
-
export CLOUDFLARE_TESTING_API_TOKEN="<Token you just created>"
369
+
# Vite
370
+
CLOUDFLARE_ACCOUNT_ID="<Account ID for the token you just created>" CLOUDFLARE_API_TOKEN="<Token you just created>" pnpm test:e2e -F @cloudflare/vite-plugin [file-pattern] --bail=1
371
+
372
+
# Wrangler
373
+
CLOUDFLARE_ACCOUNT_ID="<Account ID for the token you just created>" CLOUDFLARE_API_TOKEN="<Token you just created>" pnpm test:e2e:wrangler [file-pattern] --bail=1
366
374
```
367
375
368
-
Note: Workers created in the e2e tests that fail might not always be cleaned up (deleted). Internal users with access to the "DevProd Testing" account can rely on an automated job to clean up the Workers based on the format of the name. If you use another account, please be aware you may want to manually delete the Workers yourself.
376
+
> [!NOTE]
377
+
> Workers and other resources created in the E2E tests might not always be cleaned up. Internal users with access to the "DevProd Testing" account can rely on an automated job to clean up the Workers and other resources, but if you use another account, please be aware you may want to manually delete the Workers and other resources yourself.
0 commit comments