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

C3: Improve e2e testing reliability #3686

Merged
merged 19 commits into from
Aug 15, 2023
Merged

C3: Improve e2e testing reliability #3686

merged 19 commits into from
Aug 15, 2023

Conversation

jculvey
Copy link
Contributor

@jculvey jculvey commented Jul 28, 2023

What this PR solves / how to test:

Improves the reliability of c3 e2e tests by putting a more stable cleanup script in place that runs before each test run. Also does some refactoring to have a re-usable composite action for checkout and install. Lays some additional ground work for pnpm tests which still need some work

Reviewer is to perform the following, as applicable:

  • Checked for inclusion of relevant tests
  • Checked for inclusion of a relevant changeset
  • Checked for creation of associated docs updates
  • Manually pulled down the changes and spot-tested

@jculvey jculvey requested review from a team as code owners July 28, 2023 22:21
@changeset-bot
Copy link

changeset-bot bot commented Jul 28, 2023

⚠️ No Changeset found

Latest commit: a3957bf

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Jul 28, 2023

A wrangler prerelease is available for testing. You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/5869937533/npm-package-wrangler-3686

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/5869937533/npm-package-wrangler-3686

Or you can use npx with this latest build directly:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/5869937533/npm-package-wrangler-3686 dev path/to/script.js
Additional artifacts:
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/5869937533/npm-package-cloudflare-pages-shared-3686

Note that these links will no longer work once the GitHub Actions artifact expires.

@codecov
Copy link

codecov bot commented Jul 28, 2023

Codecov Report

Merging #3686 (0ec691b) into main (2ee9815) will not change coverage.
Report is 1 commits behind head on main.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3686   +/-   ##
=======================================
  Coverage   75.17%   75.17%           
=======================================
  Files         194      194           
  Lines       11410    11410           
  Branches     3013     3013           
=======================================
  Hits         8577     8577           
  Misses       2833     2833           

@jculvey jculvey force-pushed the c3-e2e-package-managers branch 3 times, most recently from a28ae4f to fdfacd0 Compare July 28, 2023 22:56
@jculvey jculvey force-pushed the c3-e2e-package-managers branch 5 times, most recently from 29b5529 to c6e2d01 Compare August 11, 2023 21:19
@jculvey jculvey changed the title WIP: C3: Add e2e coverage for pnpm and yarn C3: Improve e2e testing reliability Aug 15, 2023
@jculvey jculvey force-pushed the c3-e2e-package-managers branch 2 times, most recently from 22fcc2d to fb66ef6 Compare August 15, 2023 03:14
@penalosa penalosa merged commit d885fbe into main Aug 15, 2023
15 checks passed
@penalosa penalosa deleted the c3-e2e-package-managers branch August 15, 2023 18:33
Copy link
Member

@dario-piotrowicz dario-piotrowicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just noticed that the PR got merged as I was reviewing it 😭

(I figured I'd at least publish the comment I had....)

Comment on lines +12 to +19
- name: ESlint and Typescript caching
uses: actions/cache@v3
id: eslint-cache
with:
path: |
.eslintcache
tsconfig.tsbuildinfo
key: ${{ matrix.os }}-eslint-tsbuildinfo-${{ hashFiles('**/*.ts','**/*.js', 'package.json', 'tsconfig.json') }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this supposed to be in the install-dependencies actions?

@@ -6,7 +6,7 @@
"hono": "0.2.6",
"next": "13.4.2",
"nuxt": "3.4.2",
"qwik": "1.1.x",
"qwik": "1.2.7",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

out of curiosity, since before it was 1.1.x why not going to 1.2.x?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't have a ton of time to test multiple 1.2.x versions so I just bumped to latest. I also didn't like that it was sort of a one off, I'd like to re-evaluate our version pinning and use .x for everything or pin to specific consistently.

const { name, version } = whichPmRuns() ?? { name: "npm", version: "0.0.0" };
let { name, version } = whichPmRuns() ?? { name: "npm", version: "0.0.0" };

if (process.env.TEST_PM) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just to understand things better, I don't see you setting this anywhere, so I assume that it isn't currently used right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In package.json:
"test:e2e:npm": "npm run build && TEST_PM=npm vitest run --config ./vitest-e2e.config.ts",

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah ok, sorry, somehow I missed that 🤦


const nodeModulesPath = path.join(ctx.project.path, "node_modules");
rmSync(nodeModulesPath, { recursive: true });
const lockfilePath = path.join(ctx.project.path, "package-lock.json");
Copy link
Member

@dario-piotrowicz dario-piotrowicz Aug 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this correct? this code runs for pnpm and yarn but those two don't produce a package-lock.json, I think that they produce respectively a pnpm-lock.yaml and a yarn.lock

(maybe all possible lock files should get deleted? 🤷)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, the idea here is that if you're using yarn or pnpm, it will delete the lockfile and node_modules, then install with the appropriate package manager, thus creating fresh (and hopefully working) dependencies, and a new lockfile to describe them.

The issue is that some create scripts use npm regardless of which PM you choose, and these need to be reset before we try to install wrangler with pnpm or yarn. Otherwise, it fails

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see thanks 🙂👍

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

Successfully merging this pull request may close these issues.

4 participants