Giter VIP home page Giter VIP logo

Comments (6)

raineorshine avatar raineorshine commented on June 18, 2024

Hi, thanks for reporting.

I'd like to better understand your use case, and then see what makes sense for npm-check-updates to support.

Why does husky install hooks fail? It seems like if a project has a prepare script, it should be expected to pass. npm prepare is automatically run after npm install, so a failed prepare script would presumably crash your normal install anyway.

https://stackoverflow.com/questions/44499912/why-is-npm-running-prepare-script-after-npm-install-and-how-can-i-stop-it

from npm-check-updates.

adamhl8 avatar adamhl8 commented on June 18, 2024

Here's a repo that reproduces the issue: https://github.com/adamhl8/ncu-1362

I'm running ncu -d -u --doctorTest 'yarn test'

The prepare script works fine normally. It only fails when executed under ncu. I haven't been able to figure out why.

from npm-check-updates.

raineorshine avatar raineorshine commented on June 18, 2024

Thanks. On my machine (OSX), the test script in the repo you provided is failing rather than the prepare script. It fails on the sed command (even without running ncu).

So I'm not sure if that properly reproduces your original issue.

raine[ncu-1362]% npm test

> [email protected] test
> vitest run && sed -i 's|expect(true)|expect(true).toBeFalsy()|' ./src/__tests__/index.test.tsx


 RUN  v0.29.8 /Users/raine/projects/ncu-1362

 ✓ src/__tests__/index.test.tsx (1)

 Test Files  1 passed (1)
      Tests  1 passed (1)
   Start at  19:33:46
   Duration  688ms (transform 45ms, setup 0ms, collect 23ms, tests 3ms)

sed: 1: "./src/__tests__/index.t ...": invalid command code .
raine[ncu-1362]% echo $?
1

from npm-check-updates.

adamhl8 avatar adamhl8 commented on June 18, 2024

Sorry, I should have specified. That sed command has nothing to do with the issue itself and is not in the actual project I'm having this issue with. It's there because I need the test to pass initially so ncu --doctor continues and tries to update the dependencies. That sed command makes it so after that initial run the test fails so ncu will try to upgrade each dependency individually.

I'm on macOS as well. Are you using gnu-sed? The default, older version that ships with macOS might not support that syntax or something.

Edit: I changed the sed command in the repo to work with the default macOS sed.

from npm-check-updates.

raineorshine avatar raineorshine commented on June 18, 2024

Thanks! I was able to successfully reproduce it.

Internally, the options --depth=0 and --json are added to package manager commands such as npm list to ensure that the output can be parsed correctly. They are added to all package manager commands, which is usually harmless, however it turns out that yarn test --depth=0 --json behaves differently than npm test --depth=0 --json. yarn passes the option through to the test script, which causes sed to choke on --depth=0. Changing the order to yarn --depth=0 --json test fixes the issue.

I have published a fix to v16.14.13. Let me know if that helps.

from npm-check-updates.

adamhl8 avatar adamhl8 commented on June 18, 2024

That fixed it. Thank you!

from npm-check-updates.

Related Issues (20)

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.