Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Sort order in directory globs #135

merged 1 commit into from

3 participants



The order in which Jasmine headless webkit loads files specified on jasmine.yml is file system dependent.
On MacOS X, HFS+ guarantees that directory entries are read in sorted order ( This is not the case with other Unix filesystems such as ext2/ext3/ext4 under Linux. The inconsistency in load order results in a test suite that works in one place (e.g. on a Mac) but the same suite fails due to load order problems in another (e.g. on a Linux box). In fact, the results can differ from one copy of a suite to another on the same Linux box depending on the sequence of file create, remove, etc. calls in each copy. A simple solution is to sort the results of expanding a directory glob so that the results are consistent across platforms.



@johnbintz johnbintz merged commit 724541a into johnbintz:master


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 3, 2012
  1. Most filesystems don't guarantee directory listing order, so sort glo…

    William Josephson authored
    …b results.
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 1 deletion.
  1. +2 −1  lib/jasmine/headless/files_list.rb
3  lib/jasmine/headless/files_list.rb
@@ -255,7 +255,8 @@ def config?
def expanded_dir(path)
- Dir[path].find_all { |file|
+ file_list = Dir.glob(path).sort
+ file_list.find_all { |file|
file[extension_filter] && !alert_if_bad_format?(file)
}.collect {
|file| File.expand_path(file)
Something went wrong with that request. Please try again.