mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-11-23 09:04:37 +03:00
test: add integration test for #235
This commit is contained in:
parent
98e0a1a0ad
commit
4dca0944ab
10
flake.nix
10
flake.nix
@ -174,6 +174,13 @@
|
||||
inherit self;
|
||||
});
|
||||
|
||||
tests-integration.type = "app";
|
||||
tests-integration.program =
|
||||
b.toString
|
||||
(dream2nixFor."${system}".callPackageDream ./tests/integration {
|
||||
inherit self;
|
||||
});
|
||||
|
||||
tests-examples.type = "app";
|
||||
tests-examples.program =
|
||||
b.toString
|
||||
@ -201,6 +208,9 @@
|
||||
echo "running unit tests"
|
||||
${self.apps.${system}.tests-unit.program}
|
||||
|
||||
echo "running integration tests"
|
||||
${self.apps.${system}.tests-integration.program}
|
||||
|
||||
echo "checking flakes under ./examples"
|
||||
${self.apps.${system}.tests-examples.program}
|
||||
|
||||
|
52
tests/integration/default.nix
Normal file
52
tests/integration/default.nix
Normal file
@ -0,0 +1,52 @@
|
||||
{
|
||||
self,
|
||||
lib,
|
||||
async,
|
||||
bash,
|
||||
coreutils,
|
||||
git,
|
||||
parallel,
|
||||
nix,
|
||||
utils,
|
||||
dream2nixWithExternals,
|
||||
...
|
||||
}: let
|
||||
l = lib // builtins;
|
||||
tests = ./tests;
|
||||
testScript =
|
||||
utils.writePureShellScript
|
||||
[
|
||||
async
|
||||
bash
|
||||
coreutils
|
||||
git
|
||||
nix
|
||||
]
|
||||
''
|
||||
dir=$1
|
||||
shift
|
||||
echo -e "\nrunning test $dir"
|
||||
cp -r ${tests}/$dir/* .
|
||||
chmod -R +w .
|
||||
nix flake lock --override-input dream2nix ${../../.}
|
||||
nix run .#resolveImpure || echo "no resolveImpure probably?"
|
||||
nix eval --read-only --no-allow-import-from-derivation .#default.name
|
||||
nix build
|
||||
nix flake check "$@"
|
||||
'';
|
||||
in
|
||||
utils.writePureShellScript
|
||||
[
|
||||
coreutils
|
||||
parallel
|
||||
]
|
||||
''
|
||||
if [ -z ''${1+x} ]; then
|
||||
parallel --halt now,fail=1 -j$(nproc) -a <(ls ${tests}) ${testScript}
|
||||
else
|
||||
arg1=$1
|
||||
shift
|
||||
${testScript} $arg1 "$@"
|
||||
fi
|
||||
echo "done running integration tests"
|
||||
''
|
1
tests/integration/tests/.gitignore
vendored
Normal file
1
tests/integration/tests/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
flake.lock
|
14
tests/integration/tests/nodejs_built-binary/flake.nix
Normal file
14
tests/integration/tests/nodejs_built-binary/flake.nix
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
inputs = {
|
||||
dream2nix.url = "github:nix-community/dream2nix";
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
dream2nix,
|
||||
}: (dream2nix.lib.makeFlakeOutputs {
|
||||
systems = ["x86_64-linux"];
|
||||
config.projectRoot = ./.;
|
||||
source = ./.;
|
||||
});
|
||||
}
|
10
tests/integration/tests/nodejs_built-binary/package.json
Normal file
10
tests/integration/tests/nodejs_built-binary/package.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "test-built-binary",
|
||||
"version": "1.0.0",
|
||||
"bin": {
|
||||
"main": "./main.js"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "touch main.js"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user