Ava: Compatibility with pnpm

Created on 4 Oct 2016  Â·  12Comments  Â·  Source: avajs/ava

pnpm is a fast implementation of npm install with the following features:

  • much faster dependencies installation
  • important disk usage reduction
  • installation progress is displayed very nicely

Unfortunately, ava is not compatible with it as pnpm use symlinks to install the deps which makes ava complain:

$ npm test
> @ test issue-ava-pnpm
> ava

WARNING: `npm link ava` and the `--preserve-symlink` flag are incompatible. We have detected that AVA is linked via `npm link`, and that you are using either an early version of Node 6, or the `--preserve-symlink` flag. This breaks AVA. You should upgrade to Node 6.2.0+, avoid the `--preserve-symlink` flag, or avoid using `npm link ava`.

   1 exception


   ✖ No tests found in test.js, make sure to import "ava" at the top of your test file
npm ERR! Test failed.  See above for more details.

Example repository: https://github.com/julien-f/issue-ava-pnpm

It would be very nice if it could be fixed :smile:

question

Most helpful comment

@zkochan I only want what's best for pnpm because it's much nicer to use than npm :)

Adding a property to ava's package.json looks like the best approach but it's not up to me (@sindresorhus, what's your opinion on this?).

All 12 comments

Do you run $ node with the --preserve-symlink flag? That's the only time that message should show or if you're using an old v6 version.

Indeed, it seems that pnpm is doing that for all exported binaries.

See rstacruz/pnpm#244

//cc @zkochan

Sounds like a very bad idea. It's a flag for a reason. You should only use it when you control the whole environment.

Using this flag allowed us to install packages to a shared folder. It is unbelievable what amount of disk-space it saves!

Personally I did not experience any problems while using the --preserve-symlink flag. If there is a particular reason why it can't be used with ava, maybe you could add a preserveSymlinks: false to your package.json and pnpm will not force it to preserve-symlinks. Probably ava will work anyway from a shared storage. Preserve symlinks is important mainly for packages with peer dependencies.

cc @pnpm, @iamstarkov, @rstacruz, @andreypopp

@zkochan I'm afraid that requiring users to configure pnpm for their usage will really hurt pnpm as it will no longer be a drop-in replacement for npm i :unamused:

Well the same we could say about ava, right? Other testing frameworks seem to work with pnpm and the --preserve-symlink flag.

What I suggest is to add a new property to ava's package.json. Users of ava/pnpm won't have to do anything. (I think it would work, I can check later today)

Or we could add a config to pnpm to disable --preserve-symlinks. But that would disallow the usage of a shared store. Would this work for you @julien-f?

@zkochan I only want what's best for pnpm because it's much nicer to use than npm :)

Adding a property to ava's package.json looks like the best approach but it's not up to me (@sindresorhus, what's your opinion on this?).

Well for pnpm the best would be if ava would just work with --preserve-symlinks :smile:

Is it somewhere documented why ava cannot do that?

I don't remember why. See: https://github.com/avajs/ava/issues/814. @jamestalmage would be the best person to comment on this.

We're not going to add an option, but if there's any way we could automatically support it without too much code I'm open to it.

I think https://github.com/avajs/ava/issues/643#issuecomment-248670505 should fix this.

I don't know whether this was fixed on ava's end but the latest version of pnpm does not require --preserve-symlinks. It is used by default for now, but you can set the preserve-symlinks config to false by running npm config set preserve-symlinks false and ava should work fine.

In case of questions feel free to open an issue on pnpm, or write me on gitter/twitter

Was this page helpful?
0 / 5 - 0 ratings