Cohorts, Testing, and Failed Checks, Oh My!

Saturday, April 20, 2024

Being enrolled in two cohorts has proven to be a lot. Being enrolled in two cohorts with MVPs due within a week of each other has proven to be even more. Here are a few things I learned regarding a ticket that took much longer than anticipated.

screenshot of a pull request on GitHub that has passed all checks.

What is a cohort?

A cohort places learners on teams with others that have a similar skill level to build a project. You can think of it as one big group project.

What is an MVP?

MVP stands for "minimum viable product; a version of a product or project that is just complete enough to satisfy users while you can continue building out the full rest of the features.

An MVP is also a great way to get early user feedback so you can decide whether you are on the right path or not.

Playwright Test Failures

The playwright config file was not configured properly, so it was running any and all tests on deployment, not just playwright tests. Naturally, playwright tests are going to fail when it's running tests not made for it.

This was fixed with a change to the playwright.config.ts file:

/* Playwright will only run tests with .spec.ts at the end of naming */
testMatch: '**/*.spec.ts',

File Structure

I previously had this suspicion, but it was confirmed in my failed Storybook build output that files in the /stories/ directory cannot access components outside of itself. I am unsure if this can be fixed with a change to our Storybook config file, however, I was directed to restructure the project follows:

- app (folder)

  - components (folder)

    - component-name (folder)

      - component-name.stories (storybook file)

      - component-name.test.tsx (RTL test file)

      - Component.tsx (actual component file)

Now all relevant files surrounding a specific component can be found in the same folder.

Local Build Commands

I was unaware I had to run different commands to build the site and storybook separately. I figured pnpm build would build both; I was wrong. I had to run pnpm build-storybook so I could see the issues locally. Lo and behold, that's how I learned of the scope issue with stories being unable to access components outside it's directory.

Summary

I've learned a lot more than this, and more details are to come. But damn have these cohorts been wildly valuable.