-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
a better error message for corrupted todo files (#176)
- Loading branch information
Showing
10 changed files
with
81 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
use assert_cmd::Command; | ||
use predicates::prelude::*; | ||
mod common; | ||
|
||
#[test] | ||
fn test_check_with_corrupt_todo() -> anyhow::Result<()> { | ||
Command::cargo_bin("packs")? | ||
.arg("--project-root") | ||
.arg("tests/fixtures/contains_corrupt_todo") | ||
.arg("--debug") | ||
.arg("check") | ||
.assert() | ||
.failure() | ||
.stderr(predicate::str::contains("Failed to deserialize the package_todo.yml")) | ||
.stderr(predicate::str::contains("Try deleting the file and running the `update` command to regenerate it")); | ||
|
||
common::teardown(); | ||
Ok(()) | ||
} |
Empty file.
2 changes: 2 additions & 0 deletions
2
tests/fixtures/contains_corrupt_todo/packs/bar/app/services/bar.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module Bar | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
enforce_privacy: true |
16 changes: 16 additions & 0 deletions
16
tests/fixtures/contains_corrupt_todo/packs/bar/package_todo.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# This file contains a list of dependencies that are not part of the long term plan for the | ||
# 'packs/foo' package. | ||
# We should generally work to reduce this list over time. | ||
# | ||
# You can regenerate this file using the following command: | ||
# | ||
# bin/packwerk update-todo | ||
--- | ||
packs/foo: | ||
"::Foo": | ||
violations: | ||
- dependency | ||
- privacy | ||
files: | ||
- packs/bar/app/services/bar.rb | ||
|
5 changes: 5 additions & 0 deletions
5
tests/fixtures/contains_corrupt_todo/packs/foo/app/services/foo.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module Foo | ||
def calls_bar_with_stated_dependency | ||
Bar | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
enforce_dependencies: true | ||
dependencies: | ||
- packs/bar |
11 changes: 11 additions & 0 deletions
11
tests/fixtures/contains_corrupt_todo/packs/foo/package_todo.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# This file contains a list of dependencies that are not part of the long term plan for the | ||
# 'packs/foo' package. | ||
# We should generally work to reduce this list over time. | ||
# | ||
# You can regenerate this file using the following command: | ||
# | ||
# bin/packwerk update-todo | ||
--- | ||
packs/bar: | ||
"::Bar" | ||
- packs/foo/app/services/foo.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# See: Setting up the configuration file | ||
# https://github.com/Shopify/packwerk/blob/main/USAGE.md#setting-up-the-configuration-file | ||
|
||
# List of patterns for folder paths to include | ||
# include: | ||
# - "**/*.{rb,rake,erb}" | ||
|
||
# List of patterns for folder paths to exclude | ||
# exclude: | ||
# - "{bin,node_modules,script,tmp,vendor}/**/*" | ||
|
||
# Patterns to find package configuration files | ||
# package_paths: "**/" | ||
|
||
# List of custom associations, if any | ||
# custom_associations: | ||
# - "cache_belongs_to" | ||
|
||
# Whether or not you want the cache enabled (disabled by default) | ||
cache: false | ||
|
||
# Where you want the cache to be stored (default below) | ||
# cache_directory: 'tmp/cache/packwerk' |