Skip to content
This repository has been archived by the owner on Jan 26, 2019. It is now read-only.

Missing tsconfig.test.json when upgrading to v2.5.0 #141

Closed
JReinhold opened this issue Aug 15, 2017 · 6 comments
Closed

Missing tsconfig.test.json when upgrading to v2.5.0 #141

JReinhold opened this issue Aug 15, 2017 · 6 comments

Comments

@JReinhold
Copy link
Contributor

NB: MAYBE ONLY A ONE TIME THING. SEE 'REPRODUCIBLE DEMO' SECTION!

Bug report

When ugrading react-scripts-ts from version 2.4.0 to 2.5.0+ the app wont start, because the file tsconfig.test.json is missing from the project. This is probably related to #115 that adds support for this file. However when upgrading react-scripts-ts by bumping the version number in package.json and running yarn install this file of course doesn't get created, and thus is missing.

Environment

  1. npm ls react-scripts-ts: 2.6.0
  2. node -v: 8.3.0
  3. npm -v: 5.3.0
  4. yarn --version: 0.27.5

Then, specify:

  1. Operating system: macOS Sierra 10.12.5

Steps to Reproduce

  1. Have version 2.4.0 or below of react-scripts-ts installed and working in a project
  2. Change react-scripts-ts to version 2.5.0 or above in package.json
  3. run yarn installor npm install
  4. try to start app with yarn start

Expected Behavior

It should work

Actual Behavior

It crashes with an error saying that tsconfig.test.jsonis missing.

Reproducible Demo

Honestly I can't reproduce this. I fixed the problem, and when I tried to delete the file to reproduce the problem, the error wouldn't happen, and everything worked. yet I'm still reporting this, to see if others are having similar issues, or can reproduce it.

How To Fix This

For reference to others, this is how I fixed this issue:

  1. Create a new file in the project root (next to the tsconfig.json file) called tsconfig.test.json
  2. Copy and paste the content of this file into the new file: https://github.com/nicolaserny/create-react-app-typescript/blob/master/packages/react-scripts/template/tsconfig.test.json
  3. start the app, should work now.

If this indeed is a bug that many are experiencing I would suggest one of these steps:

a. Write a migration guide in the README.md that explains how to fix this error when upgrading.
b. Output a useful error message, explaining how to fix the issue, possibly with a link to this issue.
c. Automatically create the file if it doesn't exist when the app is started. (not sure this is even possible)

@wmonk
Copy link
Owner

wmonk commented Aug 16, 2017

Thanks for this detailed report! I will leave this open incase other users have the same issue, but as nobody else has come to report it I'm not sure they are.

I will accept a PR to add to the README if this is indeed an issue experience by others.

@ChristopherHoffman
Copy link

I just tried to upgrade a project from 2.3.2 to 2.6.0, and experienced the same issue, the tsconfig.test.json was not created during the upgrade:
(using yarn v0.27.5)
yarn upgrade react-scripts-ts
yarn test

Every test failed with:
`Test suite failed to run

{
    "messageText": "Cannot read file 'C:\\[project]\\tsconfig.test.json': ENOENT: no such file or directory, open 'C:\\[project]\\tsconfig.test.json'.",
    "category": 1,
    "code": 5012
}`

@mikebridge
Copy link

I have this problem after upgrading from typescript 2.4.2 to 2.5.0 on windows, with yarn 0.27.

@bnwan
Copy link

bnwan commented Aug 23, 2017

I've also had this same problem

@JReinhold
Copy link
Contributor Author

It seems that indeed this is not an issue isolated to me. I'll work on a PR soon.

@rezik007
Copy link

rezik007 commented Oct 5, 2017

In my case helped changing path to test config file, I found that line in my package.json file:

"jest: {
...
"globals": {
      "ts-jest": {
        "tsConfigFile": "/var/www/frontend/tsconfig.test.json"
      }
    }
...

I just removed "/var/www/frontend/" line (on the other hand the path was correct when I was using docker to lunch my app via NPM). Probably this line is visible only after eject oryginal 'react-scripts-ts' (btw. procedure is described in readme). You've got to check it by your own, I hope it helps ;)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants