Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

494
Views
comando no encontrado: broma

Tengo un archivo de prueba así: (estoy usando create-react-app)

 import React from 'react'; import ReactDOM from 'react-dom'; import App from './components/Calculator'; import { getAction, getResult } from './actions/' import {shallow} from 'enzyme'; import toJson from 'enzyme-to-json'; import Enzyme from 'enzyme'; import Adapter from 'enzyme-adapter-react-16'; Enzyme.configure({ adapter: new Adapter() }); it('renders without crashing', () => { const wrapper = shallow(<App />) expect(toJson(wrapper)).toMatchSnapshot(); }); it('displays the choosen operator', () => { const action = { type: 'GET_ACTION', operator: '+' }; expect(getAction("+")).toEqual(action) }) it('displays the typed digit', () => { const action = { type: 'GET_RESULT', n: 3 }; expect(getResult(3)).toEqual(action); }) it('checks that the clickevent for getNumber is called',() => { const clickEvent = jest.fn(); const p = shallow(<p data-n="1" onClick={clickEvent}>1</p>) p.simulate('click') expect(clickEvent).toBeCalled(); })

y un paquete.json:

 { "name": "my-app", "version": "0.1.0", "private": true, "dependencies": { "react": "^16.2.0", "react-dom": "^16.2.0", "react-scripts": "1.1.1" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", // "test": "react-scripts test --env=jsdom", "test": "jest", "eject": "react-scripts eject" }, "devDependencies": { "enzyme": "^3.3.0", "enzyme-adapter-react-16": "^1.1.1", "enzyme-to-json": "^3.3.3", "jest": "^22.4.3" } }

cuando ejecuto "jest --updateSnapshot" obtengo:

 command not found: jest

pero la broma está instalada.

ingrese la descripción de la imagen aquí

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Jest está instalado, pero es probable que esté en su directorio ./node_modules/.bin . Puede agregar eso a su comando ./node_modules/.bin/jest --updateSnapshot . Como ya tiene jest como un comando de secuencias de scripts en su package.json , también puede ejecutarlo con npm test -- --updateSnapshot . npm agrega automáticamente ./node_modules/.bin a su ruta.

actualización : las versiones más nuevas de yarn resolverán los scripts bin del módulo de nodo, por lo que también puede ejecutar yarn jest {cmd} y debería funcionar.

over 4 years ago · Santiago Trujillo Report

0

Me encontré con un problema similar. Lo arreglé instalando jest globalmente.

 npm install -g jest
over 4 years ago · Santiago Trujillo Report

0

Necesitas ejecutarlo de esta manera:

 ./node_modules/.bin/jest

o ejecutar npm test

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!