emilybache / Tennis-Refactoring-Kata

This is a Refactoring Kata based on the rules of Tennis
https://youtu.be/XifUs1FhWRc
MIT License
737 stars 1.27k forks source link

Test in typescript project are not working #76

Closed ZorbaDimatteo closed 2 years ago

ZorbaDimatteo commented 3 years ago

Node Version

14.15.4

Npm version

6.14.10

After installing dependencies and running npm run test the outcome is:

> tennis-refactoring-kata@1.0.0 test C:\Users\Carlotta\workspaces\Tennis-Refactoring-Kata\typescript
> TS_NODE_FAST=true mocha --compilers ts:./node_modules/ts-node/register 'tests/**/*.test.ts'

"TS_NODE_FAST" non è riconosciuto come comando interno o esterno,
 un programma eseguibile o un file batch.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! tennis-refactoring-kata@1.0.0 test: `TS_NODE_FAST=true mocha --compilers ts:./node_modules/ts-node/register 'tests/**/*.test.ts'`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the tennis-refactoring-kata@1.0.0 test 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\Carlotta\AppData\Roaming\npm-cache\_logs\2021-08-31T10_58_41_043Z-debug.log
PS C:\Users\Carlotta\workspaces\Tennis-Refactoring-Kata\typescript> code .
PS C:\Users\Carlotta\workspaces\Tennis-Refactoring-Kata\typescript> npm run test

> tennis-refactoring-kata@1.0.0 test C:\Users\Carlotta\workspaces\Tennis-Refactoring-Kata\typescript
> mocha --compilers ts:./node_modules/ts-node/register 'tests/**/*.test.ts'

Warning: Could not find any test files matching pattern: 'tests/**/*.test.ts'
No test files found
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! tennis-refactoring-kata@1.0.0 test: `mocha --compilers ts:./node_modules/ts-node/register 'tests/**/*.test.ts'`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the tennis-refactoring-kata@1.0.0 test 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\Carlotta\AppData\Roaming\npm-cache\_logs\2021-08-31T10_59_15_620Z-debug.log
emilybache commented 3 years ago

I'm sorry to hear it's not working! Unfortunately I'm not really that good with typescript and I'm not sure what could be causing this. It's some kind of problem with the project setup. Have you tried creating a new empty project and just copying the relevant tests and code into it?

codecop commented 3 years ago

@ZorbaDimatteo which OS are you on? - sorry see it now. Windows it is.

codecop commented 3 years ago

Remove the single quotes in the test command around the files

"test": "mocha --compilers ts:./node_modules/ts-node/register tests/**/*.test.ts",
"test:watch": "mocha --reporter min --compilers ts:./node_modules/ts-node/register --watch tests/**/*.test.ts",
emilybache commented 2 years ago

I think this should fix it. Pls re-open the issue if not.