title: How to test an `npm publish` result, without actually publishing to NPM?
body: <p>One common problem I have, is that sometimes my .npmignore file is too aggressive, and I ignore files that I actually will to include in the NPM tarball.</p>
  
  <p>My question is - is there a way to test the results of NPM publish, without actually publishing to NPM?</p>
  
  <p>I am thinking something like this. Assuming I have a local NPM package with package name "foo"</p>
  
  <pre><code>set -e;
  local proj="bar";
  local path_to_foo="."
  mkdir -p "$HOME/.local.npm"
  npm --tarball -o "$HOME/.local.npm"  # made up command, but you get the idea
  (
    cd "$HOME/.temp_projects"
    rm -rf "$proj"
    mkdir "$proj"
    cd "$proj"
    npm init -f
    npm install "$path_to_foo"
  )
  copy_test_stuff -o "$HOME/.temp_projects/bar"
  
  cd "$HOME/.temp_projects/bar"
  npm test
  </code></pre>
  
  <p>I don't think this will work. Because whatever we include in the NPM publish tarball, might not have enough to do the full test. But maybe if we copy all the test files (including fixtures, etc) when we do <code>copy_test_stuff</code>, it might work?</p>