percy / cli

The Percy CLI is used to interact with, and upload snapshots to, percy.io via the command line.
https://docs.percy.io/docs/cli-overview
70 stars 43 forks source link

v.1.26.3 breaks storybook config #1414

Closed csantos1113 closed 11 months ago

csantos1113 commented 11 months ago

The problem

storybook config from .percy.js is fully ignored even though it should be possible based on the docs: https://github.com/percy/percy-storybook/tree/master#percy-config-file-options

Environment

Details

it does work in v1.26.2

Debug logs

yarn percy storybook ./build-storybook --verbose
[percy] A new version of @percy/cli is available! 1.26.3 -> 1.27.3

[percy] Invalid config: <---- NOTICE THIS ⚠️
[percy] - storybook: unknown property <---- NOTICE THIS ⚠️
[percy:storybook] Requesting Storybook: http://localhost:65468 (0ms)
[percy] Successfully downloaded Chromium 929475
[percy] Percy has started!
[percy] Snapshot taken: src/accordion/AccordionItem: Default
[percy] Snapshot taken: src/accordion/Accordion: Default
[percy] Failed to create build
[percy] Processing 381 snapshots...

Code to reproduce issue

yarn percy storybook ./build-storybook --verbose with .percy.js file:

module.exports = {
  version: 2,
  discovery: {
    concurrency: 2,
    // https://docs.percy.io/docs/debugging-sdks#assets-never-requested-by-asset-discovery
    networkIdleTimeout: 450
  },
  snapshot: {
    enableJavascript: true,
    minHeight: 900,
    percyCSS: 'iframe {display: none}',
    widths: [1024]
  },
  storybook: {
    additionalSnapshots: [
      {
        prefix: '[Dark mode] ',
        globals: { theme: 'dark' }
      }
    ],
    globals: { theme: 'light' },
    include: ['src/accordion/Accordion: Default', 'src/announcement: Percy', 'src/button: Percy']
  }
};

output using v1.26.2

yarn percy storybook ./build-storybook --verbose

[percy] A new version of @percy/cli is available! 1.26.2 -> 1.27.3

[percy:config] Found config file: .percy.js (304ms)
[percy:config] Using config:
{
  version: 2,
  discovery: {
    concurrency: 2,
    networkIdleTimeout: 450
  },
  snapshot: {
    enableJavaScript: true,
    minHeight: 900,
    percyCSS: 'iframe {display: none}',
    widths: [
      1024
    ]
  },
  storybook: {
    additionalSnapshots: [
      {
        prefix: '[Dark mode] ',
        globals: {
          theme: 'dark'
        }
      }
    ],
    globals: {
      theme: 'light'
    },
    include: [
      'src/accordion/Accordion: Default',
      'src/announcement: Percy',
      'src/button: Percy'
    ]
  }
} (18ms)
[percy:storybook] Requesting Storybook: http://localhost:64593 (15ms)
[percy:core:install] Successfully downloaded Chromium 929475 (44870ms)
[percy:core:browser] Launching browser (0ms)
[percy:core:browser] Browser connected [87314]: HeadlessChrome/96.0.4664.0 (1563ms)
[percy:core:browser] Closing browser (0ms)
[percy:core:browser] Browser closed (5ms)
csantos1113 commented 11 months ago

I'm using yarn as my package manager; and it ended up being an issue with internal percy dependencies not upgrading correctly.