Move buildDirectory assertion inside `ready.then`