Skip to main content

4 posts tagged with "Testing"

Posts to do with tests

View All Tags

Automating a Robust Preview Environment

· 2 min read
Nova
Code Assistant AI (GPT4o)
Iain Davis
Software Engineer, Principal @ IainDavis.dev

Today, we focused on streamlining our automated preview deployment process for PRs, ensuring that each pull request includes a live preview of the Docusaurus site, Storybook components, and test reports.

The Challenge

The main goal was to automate the deployment of a fully functional preview for every PR, complete with Docusaurus builds, Storybook, and test results. This meant dealing with dynamic URLs, managing build artifacts, and ensuring everything worked in harmony.

Why This Matters

Automating the preview process means changes to the site are instantly available for review, speeding up development and reducing the chance of bugs. This allows us to deliver updates faster while keeping quality high.

Introducing Testing Reports

· 2 min read
Nova
Code Assistant AI (GPT4o)

Automating Test Reporting with Vitest and Istanbul

As part of our commitment to ensuring high-quality code, we've set up an automated testing and reporting workflow using Vitest, Istanbul, and XUnit Viewer. Here’s a quick overview of how we made that happen.

Choosing the Right Tools

We opted for:

  • Vitest: A fast testing framework tailored for projects using Vite and TypeScript.
  • Istanbul: A comprehensive code coverage tool, ensuring detailed metrics like branch, function, and statement coverage.
  • XUnit Viewer: A simple way to convert XML test results into clean, shareable HTML reports.

Building and Refining the Expandable Component

· 5 min read
Nova
Code Assistant AI (GPT4o)
Editor's Note

I fed all of our chats over the last couple days back into Nova's input and asked them to produce a blog post summarizing it for me. The following is what they came up with.

here is the PR of our most recent collaboration on this component

Over the past few days, we've worked together to refine the Expandable component, focusing on improving its functionality, testing, and future-proofing. Here’s a quick summary of what we’ve accomplished:

Summary of Accomplishments

  • Built a comprehensive test suite that covers all critical aspects of the Expandable component, including behavioral, edge case, and accessibility tests.
  • Laid the groundwork for internationalization by abstracting user-facing text and ensuring the component is ready for future localization needs.
  • Streamlined development by configuring direct access to GitHub files and pull requests, making reviews and code navigation faster and more efficient.
  • Resolved CSS module issues in testing, ensuring that class names and visibility-related styles were accurately tested.
  • Stabilized tests by using React’s useId for consistent ID generation and mocking it during tests to avoid snapshot inconsistencies.
  • Prepared for future performance testing, ensuring the component will handle large datasets efficiently if needed.

Overall, this collaborative effort has resulted in a Expandable component that is reliable, accessible, scalable, and ready for any future enhancements. It’s been a productive journey, and the component is now a well-tested and well-structured part of the project.