bats-file
                                
                                
                                
                                    bats-file copied to clipboard
                            
                            
                            
                        macOS Support
So, this appears to not work at all on OS X (due to BSDs' differences w.r.t. several command-line APIs):
After first installing and adding to my setup(), I got errors like this:
> [email protected] test /Users/ec/Dropbox/Code/jxa-async
> bats ./test/*.bats
 ✗ Browserify successfully bundles jxa-async
   (from function `setup' in file test/common.bash, line 24,
    from function `bats_test_begin' in file node_modules/bats/libexec/bats-exec-test, line 87,
    in test file test/browserify.bats, line 3)
     `@test "Browserify successfully bundles jxa-async" {' failed
   
   -- ERROR: temp_make --
   mktemp: illegal option -- -
   usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
          mktemp [-d] [-q] [-u] -t prefix 
   --
   
   
   -- ERROR: temp_del --
   rm: No such file or directory
   --
After subsequently cloning bats-file and running its own tests with bats test, I'm seeing a failure on every single test.
(I believe Travis has macOS systems you can add to your build-matrix to ensure this continues to function on Macs!)
Mind you, I have no idea why the tests for assert_file_exist etc are failing as well — let me know if you want me to change anything and re-execute.
I can confirm I'm having the same error, I'm running my tests on travis, so the output can be seen here:
https://travis-ci.org/mlopes/git-.f/jobs/242817125
this is caused only by tmp_make, the assert_file_exists and assesrt_file_no_exists work.
It looks like the OSX version of mktemp doesn't support -- I wonder if there's an alternative way to do it, or if we could just specify a different command when running on OSX
EDIT:
I now have access to an OSX, and could confirm that --directory only works as -d on OSX/BSD, this one should be easy to fix as it also works on Linux. But also --tmpdir doesn't exist on OSX/BSD, there's a -t, but I can't figure out if it does the same thing, as the description for either of them is quite ambiguous.
Also the - in the template doesn't seem to work, I get the message mktemp: illegal option -- X
I could try to fix it and make a PR, but not sure if it's worth it as I see PRs pending from a few months ago. Is this project still maintained?
@mlopes I apologise for the hiatus. I've been moving and starting a new job. As soon as things quiet down a little bit, I'm planning to get back to working on bats and the bats-* libraries. Unfortunately, I can't provide an ETA, but I promise I'll be back as soon as my schedule allows. :slightly_smiling_face:
@ztombol, if you feel like giving someone commuter status, I’d be happy to try and maintain a ‘develop’ branch, merging some work on things like this, until you return
A deeper look into this seems to indicate that one of the problems is that this:
local template="$prefix"
  template+="${BATS_TEST_FILENAME##*/}"
  template+="-${BATS_TEST_NUMBER}"
  template+='-XXXXXXXXXX'
ends up as '-XXXXXXXXXX' on OSX somehow, and then it gives me the -- X error even if I do an [ if uname -s = 'Darwin' ] and pass the correct parameters for OSX, if I try using that string as template on Linux, I get the exact same error.
Made a pull request fixing this (#4)