From c8faa3e7d27831821c969f95cbcee4f494303f7d Mon Sep 17 00:00:00 2001 From: Martin Toman Date: Thu, 11 Aug 2022 13:02:52 -0700 Subject: [PATCH] test: add integration test for #221 --- .../flake.nix | 32 +++++++++++++++++++ .../package.json | 11 +++++++ 2 files changed, 43 insertions(+) create mode 100644 tests/integration/tests/nodejs_direct-priority-over-transitive/flake.nix create mode 100644 tests/integration/tests/nodejs_direct-priority-over-transitive/package.json diff --git a/tests/integration/tests/nodejs_direct-priority-over-transitive/flake.nix b/tests/integration/tests/nodejs_direct-priority-over-transitive/flake.nix new file mode 100644 index 00000000..568ac497 --- /dev/null +++ b/tests/integration/tests/nodejs_direct-priority-over-transitive/flake.nix @@ -0,0 +1,32 @@ +{ + inputs = { + dream2nix.url = "github:nix-community/dream2nix"; + }; + + outputs = { + self, + dream2nix, + }: (dream2nix.lib.makeFlakeOutputs { + systems = ["x86_64-linux"]; + config.projectRoot = ./.; + source = ./.; + packageOverrides = { + test = { + "check-linked-bin-version" = { + postInstall = '' + npm run get-version + VERSION=$(cat VERSION) + echo "$VERSION" + + if [ "$VERSION" = "2.8.0" ]; then + echo "correct version installed - direct dependency" + else + echo "wrong version installed - transitive dependency" + exit 1 + fi + ''; + }; + }; + }; + }); +} diff --git a/tests/integration/tests/nodejs_direct-priority-over-transitive/package.json b/tests/integration/tests/nodejs_direct-priority-over-transitive/package.json new file mode 100644 index 00000000..c06d8fdc --- /dev/null +++ b/tests/integration/tests/nodejs_direct-priority-over-transitive/package.json @@ -0,0 +1,11 @@ +{ + "name": "test", + "version": "1.0.0", + "scripts": { + "get-version": "svgo --version > VERSION" + }, + "devDependencies": { + "svgo": "2.8.0", + "cssnano": "4.1.10" + } +}