How to Ignore Privacy Violations in Spec Folder of GraphQL Pack in Packwerk Configuration and Patterns?

This message was imported from the Ruby/Rails Modularity Slack server. Find more info in the import thread.

Message originally sent by slack user U7213XMGS3H

A question about Packwerk config and patterns. We have a GraphQL pack that stores all of our GraphQL code, and it depends on many feature packs. We’d like to permit violations from this pack in the spec folder because we want to be able to reach into other packs’ private models to make assertions. It’s the most practical way to assert that db changes took place, and we want the tests of the GraphQL pack to be “integration-y.” Is there a way to tell packwerk to ignore privacy violations from just the spec folder of just the graphql pack?

I don’t think so… I wanted to use the same approach for my “Admin” pack. The approach took was to add that pack to the exclude config for the top-level packwerk.yml file:

exclude:
  - "{bin,node_modules,script,tmp,vendor,lib,config,perf_scripts}/**/*"
  - "lib/tasks/**/*.rake"
  - "packs/applications/admin/**/*"

Message originally sent by slack user U72OIG1FGY2

There’s this PR in discussion: https://github.com/rubyatscale/packwerk-extensions/pull/32
(stale at the moment). It was proposed with the exact same use case in mind, being able to discard violations coming from test files

Message originally sent by slack user U7213XMGS3H

I’ll watch that PR!