percy / percy-puppeteer

Visual testing with Puppeteer and Percy
https://percy.io
MIT License
49 stars 16 forks source link

`@percy/core` development dependency issue #471

Closed igorpupkinable closed 2 years ago

igorpupkinable commented 2 years ago

The problem

I am working on a common library for our 12 projects setup. There is an error compiling TypeScript due to missing @percy/core dependency.

Environment

Details

@percy/puppeteer has @percy/core listed as a development dependency, but should be also an optional peer dependency for TS users.

Debug logs

$ tsc --build
node_modules/@percy/puppeteer/types/index.d.ts:2:33 - error TS2307: Cannot find module '@percy/core' or its corresponding type declarations.

import { SnapshotOptions } from '@percy/core';

Code to reproduce issue

Package manifest:

{
  "name": "@xxx/e2e-test-utils",
  "description": "XXX generic end-to-end test utilities.",
  ...
  "dependencies": {
    "@percy/puppeteer": "^2.0.2"
  },
  "devDependencies": {},
  "peerDependencies": {
    "puppeteer": "^14.4.1"
  },
  ...
}

Helper function:

import percySnapshot from '@percy/puppeteer';

export const takeSnapshot = (name: string) => percySnapshot(page, name);
igorpupkinable commented 2 years ago

The fix is to add peer dependency to @percy/puppeteer package.json

"peerDependencies": {
    "@percy/core": "^1.1.2",
    "puppeteer": ">=1"
  },
  "peerDependenciesMeta": {
    "@percy/core": {
      "optional": true
    }
  },
github-actions[bot] commented 2 years ago

This issue is stale because it has been open for more than 14 days with no activity. Remove stale label or comment or this will be closed in 14 days.

github-actions[bot] commented 2 years ago

This issue was closed because it has been stalled for 28 days with no activity.