Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: standardizes the plugin interface #10

Merged
merged 14 commits into from
Jun 7, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: dynamically loads tests from root directory
  • Loading branch information
jmgilman committed Jun 7, 2022
commit 52ac1ce9c476c5bd48177ad498269c1eb35ce6dc
24 changes: 17 additions & 7 deletions tests/default.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
{ pkgs, runTest }:
{
conform = pkgs.callPackage ./conform { inherit runTest; };
just = pkgs.callPackage ./just { inherit runTest; };
lefthook = pkgs.callPackage ./lefthook { inherit runTest; };
pre-commit = pkgs.callPackage ./pre-commit { inherit runTest; };
prettier = pkgs.callPackage ./prettier { inherit runTest; };
}
with pkgs.lib;
let
# Build a list of all local directory names (test names)
tests = builtins.attrNames
(filterAttrs (n: v: v == "directory") (builtins.readDir ./.));

# Create a list of testName => import for each test
testsList = builtins.map
(p: {
"${p}" = import (builtins.toPath ./. + "/${p}") { inherit runTest; };
})
tests;

# Fold the list back into a single set
testsAttrs = fold (x: y: recursiveUpdate x y) { } testsList;
in
testsAttrs