I am trying to make an isolated test case to experiment with PhantomJS localStorage behavior, but in my testCase, localStorage does not appear to be persistent.
It may be timing-related. If you exit phantom too quickly the changes to localStorage may not be persisted. Changing phantom.exit() to setTimeout(phantom.exit, 1500) seemed to work.