question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ava incorrectly ignores test files when the project itself is contained in node_modules directory

See original GitHub issue

Description

I have two projects:

Due to the nature of the projects (process.pwd() aware dependency resolution), it is not possible to link isomorphic-webpack-demo inside isomorphic-webpack. Therefore, I need to do:

git clone https://github.com/gajus/isomorphic-webpack
git clone https://github.com/gajus/isomorphic-webpack-demo
(cd ./isomorphic-webpack && npm install)
(cd ./isomorphic-webpack-demo && npm install)
rm -fr ./isomorphic-webpack-demo/node_modules/isomorphic-webpack
cp ./isomorphic-webpack ./isomorphic-webpack-demo/node_modules

The problem happens when I try to run ava inside of isomorphic-webpack, i.e.

cd ./isomorphic-webpack-demo/node_modules/isomorphic-webpack
npm run test

I am getting error:

  1 exception

  ✖ Couldn't find any files to test

My guess (without looking at the source code), is that ava detects that ./isomorphic-webpack-demo/node_modules/isomorphic-webpack/test path includes node_modules and therefore ignores this path.

Expected behaviour: ava should detect the immediate ./test directory and run the tests.

Environment

node -e "var os=require('os');console.log('Node.js ' + process.version + '\n' + os.platform() + ' ' + os.release())"
ava --version
npm --version
Node.js v7.3.0
darwin 16.3.0
0.17.0
3.10.10

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
novemberborncommented, Jan 11, 2018

@Jolo510 actually I need to review the various globbing issues. I suggest you hold off until then. I think we may need a more comprehensive approach.

0reactions
Jolo510commented, Jan 11, 2018

Hey @novemberborn, I new to open source and Ava. Would this be a good first bug to tackle?

Read more comments on GitHub >

github_iconTop Results From Across the Web

ava - npm
Directories are recursed, with all *.js files being treated as test files. Directories named fixtures , helpers and node_modules are always ...
Read more >
Ava js not executing tests - Stack Overflow
0 all my tests are executing fine, I have a ts project a compile to js and execute all js test files. When...
Read more >
Debug Node.js Apps using Visual Studio Code
Mocha Tests: Debug mocha tests in a test folder of your project. Make sure that your project has 'mocha' installed in its node_modules...
Read more >
The compiler for next generation JavaScript - Babel.js
While you can install Babel CLI globally on your machine, it's much better to install it locally project by project. There are two...
Read more >
Documentation - Module Resolution - TypeScript
The behavior Node.js takes will differ depending on if require is given a relative ... A node_modules folder can be on the same...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found