Skip to content

Commit

Permalink
Move insta to folder (#470)
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko committed Mar 28, 2024
1 parent ca2faf9 commit 4dcccca
Show file tree
Hide file tree
Showing 129 changed files with 96 additions and 232 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,10 @@ jobs:
with:
toolchain: 1.51.0
- uses: Swatinem/rust-cache@v2
- name: Use Cargo.lock.msrv
run: cp Cargo.lock.msrv Cargo.lock
- name: Remove named profile
run: |
perl -ni -e 'print unless /\[profile\.dist\]/ .. eof' Cargo.toml
- name: Check
run: cargo check --no-default-features
run: cargo check -p insta --no-default-features
151 changes: 3 additions & 148 deletions Cargo.lock.msrv

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

69 changes: 0 additions & 69 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,24 +1,3 @@
[package]
name = "insta"
version = "1.37.0"
license = "Apache-2.0"
authors = ["Armin Ronacher <armin.ronacher@active-4.com>"]
description = "A snapshot testing library for Rust"
edition = "2018"
rust-version = "1.51.0"
homepage = "https://insta.rs/"
repository = "https://github.com/mitsuhiko/insta"
keywords = ["snapshot", "testing", "jest", "approval"]
categories = ["development-tools::testing"]
readme = "README.md"
exclude = [
"assets/*"
]

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[workspace]
members = ["cargo-insta"]

Expand All @@ -31,54 +10,6 @@ pr-run-mode = "plan"
install-updater = false
precise-builds = true

[features]
default = ["colors"]

# when the redactions feature is enabled values can be redacted in serialized
# snapshots.
redactions = ["pest", "pest_derive", "serde"]

# Enables support for running filters on snapshot
filters = ["regex"]

# Glob support
glob = ["walkdir", "globset"]

# Color support
colors = ["console"]

# Serialization formats
# TODO: This could be cleaner by using "dep:csv" without renaming the dep, but
# this technique allows for a lower MSRV
csv = ["dep_csv", "serde"]
json = ["serde"]
ron = ["dep_ron", "serde"]
toml = ["dep_toml", "serde"]
yaml = ["serde"]

# internal feature exclusive to cargo-insta
_cargo_insta_internal = []

[dependencies]
dep_csv = { package = "csv", version = "=1.1.6", optional = true }
console = { version = "0.15.4", optional = true, default-features = false }
pest = { version = "2.1.3", optional = true }
pest_derive = { version = "2.1.0", optional = true }
dep_ron = { package = "ron", version = "0.7.1", optional = true }
dep_toml = { package = "toml", version = "0.5.7", optional = true }
globset = { version = "0.4.6", optional = true }
walkdir = { version = "2.3.1", optional = true }
similar = { version = "2.1.0", features = ["inline"] }
regex = { version = "1.6.0", default-features = false, optional = true, features = ["std", "unicode"] }
serde = { version = "1.0.117", optional = true }
linked-hash-map = "0.5.6"
lazy_static = "1.4.0"

[dev-dependencies]
serde = { version = "1.0.117", features = ["derive"] }
similar-asserts = "1.4.2"

# The profile that 'cargo dist' will build with
[profile.dist]
inherits = "release"
lto = "thin"
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ test: cargotest
cargotest:
@echo "CARGO TESTS"
@rustup component add rustfmt 2> /dev/null
@cargo test
@cargo test --all-features
@cargo test --no-default-features
@cargo test --features redactions -- --test-threads 1
@cargo test -p insta
@cargo test -p insta --all-features
@cargo test -p insta --no-default-features
@cargo test -p insta --features redactions -- --test-threads 1
@echo "CARGO-INSTA TESTS"
# Turn off CI flag so that cargo insta test behaves as we expect
# under normal operation
@CI=0 cargo test -p cargo-insta

check-minver:
@echo "MINVER CHECK"
@cargo minimal-versions check
@cargo minimal-versions check --all-features
@cargo minimal-versions check --no-default-features
@cargo minimal-versions check --features redactions
@cargo minimal-versions check -p insta
@cargo minimal-versions check -p insta --all-features
@cargo minimal-versions check -p insta --no-default-features
@cargo minimal-versions check -p insta --features redactions

format:
@rustup component add rustfmt 2> /dev/null
Expand Down
2 changes: 1 addition & 1 deletion cargo-insta/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ edition = "2018"
readme = "README.md"

[dependencies]
insta = { version = "=1.37.0", path = "..", features = ["json", "yaml", "redactions", "_cargo_insta_internal"] }
insta = { version = "=1.37.0", path = "../insta", features = ["json", "yaml", "redactions", "_cargo_insta_internal"] }
cargo_metadata = { version = "0.18.0", default-features = false }
console = "0.15.4"
structopt = { version = "0.3.26", default-features = false }
Expand Down
3 changes: 0 additions & 3 deletions cargo-insta/tests/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,8 @@ fn main() {
std::io::stderr().write_all(&stderr).unwrap();
assert!(status.success());
let stdout = std::str::from_utf8(stdout.as_slice()).unwrap();
let stderr = std::str::from_utf8(stderr.as_slice()).unwrap();
assert!(stdout.contains("insta review finished"));
assert!(stdout.contains("accepted"));
assert!(stderr.contains("Compiling"));
assert!(stderr.contains("cargo-insta"));

// use insta itself to assert snapshots
for entry in WalkDir::new(SRC) {
Expand Down

0 comments on commit 4dcccca

Please sign in to comment.