Comments (11)
Ok. My workaround for the moment is to exclude node module dirs called test
from flow config.
from config-chain.
that is a bug in flow, you should post an issue on flow, not here.
from config-chain.
I was following the discussion here: facebook/flow#1420
The gist of it:
- flow is correct in bailing out when it encounters invalid JSON – otherwise it wouldn't be doing its job properly
- it is generally considered a good idea to exclude tests from a published npm package
There are a couple of PRs (#27, #25) that would accomplish this.
What do you reckon?
from config-chain.
Yes but it's "checking" code that isn't even in the call graph.
Why is it even looking it the test directory?
This bug should be fixed correctly in flow, merging it here would only encourage flow not to fix it correct.
from config-chain.
You are right that flow should be more intelligent about which files to parse, but independent of flow it is probably considered a good practice to only include stuff in the npm package that is really needed. And in the case of config-chain this is only the index.js. All the test are not used (hopefully) during runtime.
from config-chain.
I wonder if adding a main
section to package.json
would solve the issue?
eg here: https://docs.npmjs.com/getting-started/using-a-package.json#the---yes-init-flag
Perhaps it would indicate to flow (and any other module) where the entry point is.
from config-chain.
if main
is not included, then it defaults to ./index.js
it shouldn't be necessary to include that, flow needs to understand that to resolve node modules correctly.
from config-chain.
Also, let me explain why I have my tests included. It wasn't by lazyness, but it's because one day, there will exist a thing that tests all the npm modules, and that thing will be much simpler if the tests are already there, otherwise, it will have to link up to where what commit is that version of the code in github, (that won't be straightforward). I have over 400 modules, and I'm not gonna change my policy about including tests for those modules, except for a really good reason.
from config-chain.
Thanks for taking the time to explain.
What is the new thing that will execute tests in npm modules? (genuine question)
from config-chain.
@mcalthrop it doesn't exist yet. I wanted to build it, but currently I'm busy creating technology for cryptographically secure decentralized social networks (front end: https://github.com/ssbc/patchwork )
but I want a thing where, say, you can, before you publish a module, resolve it into all the modules that might depend on that module, and see if it breaks any their tests, so that you know if you have a breaking change or not. There is other work that would need to happen to enable that, like making npm install way faster.
from config-chain.
this is not a bug in flow, please don't publish tests, no major package does that
from config-chain.
Related Issues (14)
- The filename 'LICENCE' is mispelled. HOT 5
- Object object has no method 'hasOwnProperty' HOT 7
- Support deep extension HOT 9
- support loading config from javascript files. HOT 4
- Trouble with Node 0.11 HOT 3
- Version mismatch HOT 1
- Can I load nested options from environment variables HOT 3
- transfer HOT 2
- Broken.json breaks flow typechecking HOT 1
- INI version used (1.3.0) has a vulnerability HOT 1
- CVE-2020-7788 HOT 2
- README update HOT 3
- Nested config objects HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from config-chain.