1 { runCommand, postcss-cli }:
4 inherit (postcss-cli) packageName version;
7 runCommand "${packageName}-tests" { meta.timeout = 60; }
9 # get version of installed program and compare with package version
10 claimed_version="$(${postcss-cli}/bin/postcss --version)"
11 if [[ "$claimed_version" != "${version}" ]]; then
12 echo "Error: program version does not match package version ($claimed_version != ${version})"
16 # run basic help command
17 ${postcss-cli}/bin/postcss --help > /dev/null
19 # basic autoprefixer test
20 config_dir="$(mktemp -d)"
28 'autoprefixer': { overrideBrowserslist: 'chrome 40' },
31 " > "$config_dir/postcss.config.js"
32 input='a{ user-select: none; }'
33 expected_output='a{ -webkit-user-select: none; user-select: none; }'
34 actual_output="$(echo $input | ${postcss-cli}/bin/postcss --no-map --config $config_dir)"
35 if [[ "$actual_output" != "$expected_output" ]]; then
36 echo "Error: autoprefixer did not output the correct CSS:"
39 echo "$expected_output"
43 # needed for Nix to register the command as successful