1
resposta

" No tests found, exiting with code 1" ao executar "npm run test:unit"

 npm run test:unit

> testing@0.1.0 test:unit C:\Users\goliveira\Desktop\TESTE UNITARIO\vue-test
> vue-cli-service test:unit

No tests found, exiting with code 1
Run with `--passWithNoTests` to exit with code 0
In C:\Users\goliveira\Desktop\TESTE UNITARIO\vue-test
  18 files checked.
  testMatch: **/tests/unit/**/*.spec.[jt]s?(x), **/__tests__/*.[jt]s?(x) - 0 matches
  testPathIgnorePatterns: \\node_modules\\ - 18 matches
  testRegex:  - 0 matches
Pattern:  - 0 matches
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! testing@0.1.0 test:unit: `vue-cli-service test:unit`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the testing@0.1.0 test:unit script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\goliveira\AppData\Roaming\npm-cache\_logs\2021-05-20T23_30_45_612Z-debug.log
1 resposta

Fala ai Carlos, tudo bem? Esse erro é porque você rodou o comando de testes do Jest, porém, nenhum arquivo de teste foi encontrado no projeto.

Por padrão quando a Jest não acha nenhum teste ela vai dar erro, tu pode adicionar o parâmetro --passWithNoTests para que o resultado do comando seja sucesso ao invés de erro em tais situações.

Espero ter ajudado.

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software