feat: add setup_file and teardown_file

note: most of this was merged under https://github.com/bats-core/bats-core/pull/246

- Avoid messing with internal variable BATS_ROOT
- Don't let teardown errors stop exit output
- add helpers in lib/bats-core and add to install
- Move parallelization into exec-file but parallelize across files
- allow for preserving environment when running in parallel
- Unify output into bats run specific tmp dir
- Validate the test count in bin/bats:
    This tests what is actually written and not what we wanted to run.
    The latter is even more problematic in the parallel test cases,
    as we can't easily retrieve the count from the subshells.
- add devcontainer for simplified development in VS Code containers
- Cleanup for shellcheck
- Cleanup BATS_RUN_TMPDIR after run:
    this should avoid colissions between successive runs
    Error when the run dir is reused
diff --git a/libexec/bats-core/bats b/libexec/bats-core/bats
index 1716f46..8817591 100755
--- a/libexec/bats-core/bats
+++ b/libexec/bats-core/bats
@@ -224,6 +224,14 @@
   abort 'Must specify at least one <test>'
 fi
 
+
+if [[ -n "$output" ]]; then
+  if [[ ! -w "${output}" ]]; then
+    abort "Output path ${output} is not writeable"
+  fi
+  export BATS_REPORT_OUTPUT_PATH="$output"
+fi
+
 filenames=()
 for filename in "${arguments[@]}"; do
   expand_path "$filename" 'filename'
@@ -248,13 +256,5 @@
 # shellcheck source=lib/bats-core/validator.bash
 source "$BATS_ROOT/lib/bats-core/validator.bash"
 
-if [[ -n "$output" ]]; then
-  if [[ ! -w "${output}" ]]; then
-    printf "Error: output path %s is not writeable\n" "${output}" >&2
-    exit 1
-  fi
- export BATS_REPORT_OUTPUT_PATH="$output"
-fi
-
 set -o pipefail execfail
 exec bats-exec-suite "${flags[@]}" "${filenames[@]}" | bats_test_count_validator | "bats-format-${formatter}" "${formatter_flags[@]}"