chapter-three / next-drupal

Next.js for Drupal has everything you need to build a next-generation front-end for your Drupal site: SSG, SSR, and ISR, Multi-site, Authentication, Webforms, Search API, I18n and Preview mode (works with JSON:API and GraphQL).
https://next-drupal.org
MIT License
628 stars 175 forks source link

Add tests for esm/cjs builds #592

Open JohnAlbin opened 11 months ago

JohnAlbin commented 11 months ago

Package

next-drupal (NPM package)

Describe the feature request

We currently test the src/ code by importing it into Jest and running the tests.

Debates of whether software tests should be run against source or built software are common. For example: https://softwareengineering.stackexchange.com/questions/296757/in-ci-should-tests-be-run-against-src-or-dist

Right now we have an experimental release that is broken and the Jest tests aren't catching it.

Describe the solution you'd like

Test both the source and the builds.

Additional context

There's a blog post describing how to toggle between source and builds using Jest. https://blog.pshrmn.com/jest-test-builds/

JohnAlbin commented 11 months ago

I just swapped the src files with the build files in our Jest tests and the Jest tests still aren't catching the broken build. :\