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

Set up some smoke tests for packaging #703

Merged
merged 2 commits into from
Aug 16, 2024

Conversation

KittyGiraudel
Copy link
Owner

@drwpow-figma I started with the approach you recommended in #702. It works perfectly fine for the CJS tests, but the ESM ones fail like this:

node:internal/process/esm_loader:34
      internalBinding('errors').triggerUncaughtException(
                                ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'a11y-dialog' imported from /Users/kitty/Sites/a11y-dialog/cypress/fixtures/esm/test.js
Did you mean to import a11y-dialog/cypress/fixtures/dist/a11y-dialog.esm.js?
    at packageResolve (node:internal/modules/esm/resolve:853:9)
    at moduleResolve (node:internal/modules/esm/resolve:910:20)
    at defaultResolve (node:internal/modules/esm/resolve:1130:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:396:12)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:365:25)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:240:38)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:85:39)
    at link (node:internal/modules/esm/module_job:84:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Do you have an idea why?

@KittyGiraudel KittyGiraudel force-pushed the package-exports-field-tests branch 3 times, most recently from 1af663a to 51c2899 Compare August 15, 2024 19:01
@drwpow-figma
Copy link
Contributor

Yes see comment above—we want to make sure we’re using the dist/ in the root, and not copying it anywhere else.

Or, if Cypress needs a special setup to make it happy, that’s fine. But the vanilla Node.js tests should be using the root dist folder, that way you’re sure you’re testing the package exactly as it ships to npm.

@KittyGiraudel KittyGiraudel force-pushed the package-exports-field-tests branch from c99001d to 9ed1708 Compare August 15, 2024 19:28
Copy link
Contributor

@drwpow-figma drwpow-figma left a comment

Choose a reason for hiding this comment

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

Looks great!

@KittyGiraudel KittyGiraudel force-pushed the package-exports-field-tests branch from 8ce1c51 to 4b30675 Compare August 16, 2024 05:06
Base automatically changed from package-exports-field to main August 16, 2024 05:07
KittyGiraudel and others added 2 commits August 16, 2024 07:07
Co-authored-by: Drew Powers <apowers@figma.com>
Co-authored-by: Drew Powers <apowers@figma.com>
@KittyGiraudel KittyGiraudel force-pushed the package-exports-field-tests branch from 4b30675 to 9f3b7ca Compare August 16, 2024 05:08
@KittyGiraudel KittyGiraudel merged commit 85a825e into main Aug 16, 2024
3 checks passed
@KittyGiraudel KittyGiraudel deleted the package-exports-field-tests branch August 16, 2024 05:10
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.

2 participants