Code Monkey home page Code Monkey logo

Comments (11)

mcalthrop avatar mcalthrop commented on August 21, 2024 1

Ok. My workaround for the moment is to exclude node module dirs called test from flow config.

from config-chain.

dominictarr avatar dominictarr commented on August 21, 2024

that is a bug in flow, you should post an issue on flow, not here.

from config-chain.

mcalthrop avatar mcalthrop commented on August 21, 2024

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.

dominictarr avatar dominictarr commented on August 21, 2024

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.

danez avatar danez commented on August 21, 2024

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.

mcalthrop avatar mcalthrop commented on August 21, 2024

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.

dominictarr avatar dominictarr commented on August 21, 2024

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.

dominictarr avatar dominictarr commented on August 21, 2024

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.

mcalthrop avatar mcalthrop commented on August 21, 2024

Thanks for taking the time to explain.

What is the new thing that will execute tests in npm modules? (genuine question)

from config-chain.

dominictarr avatar dominictarr commented on August 21, 2024

@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.

bogdansoare avatar bogdansoare commented on August 21, 2024

this is not a bug in flow, please don't publish tests, no major package does that

from config-chain.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.