create-react-app-typescript icon indicating copy to clipboard operation
create-react-app-typescript copied to clipboard

Fix/improve end to end tests

Open patrick91 opened this issue 7 years ago • 5 comments

This PR will provide better e2e tests (so to actually check if TypeScript files are being loaded) and should also fix the failure with #270

patrick91 avatar May 17 '18 20:05 patrick91

@DorianGrey the e2e tests are passing, even if I emptied the webpack.config.prod.js file. It seems to me that is actually using the standard create react app to run the tests or am I missing something? :)

patrick91 avatar May 17 '18 21:05 patrick91

I already mentioned in the other PR that the kitchensink task is using a different template for some of the tests - see https://github.com/wmonk/create-react-app-typescript/blob/master/tasks/e2e-kitchensink.sh#L103

The template is located here: https://github.com/wmonk/create-react-app-typescript/tree/master/packages/react-scripts/fixtures/kitchensink

DorianGrey avatar May 18 '18 11:05 DorianGrey

Yup, it is using a different template for the application files, but it seems to be that it is still using the react-scripts package for the configuration, it seems also that it is getting that package from npm, since it is not published on verdaccio, as you can see from the logs:

 http --> 200, req: 'GET https://registry.npmjs.org/react-scripts' (streaming)
 http --> 200, req: 'GET https://registry.npmjs.org/react-scripts', bytes: 0/208787
 http <-- 200, user: undefined(127.0.0.1), req: 'GET /react-scripts', bytes: 0/16969
 http <-- 200, user: undefined(127.0.0.1), req: 'GET /babel-preset-react-app', bytes: 0/7

and here's the list of packages published on verdaccio:

screen shot 2018-05-20 at 00 26 57

if I check the package.json of the created app we can also see that it is mentioning react-scripts and not react-scripts-ts:

/v/f/g/_/T/t/test-kitchensink (py3.6) cat package.json
{
  "name": "test-kitchensink",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "react": "^16.3.2",
    "react-dom": "^16.3.2",
    "react-scripts": "1.1.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  }
}%

patrick91 avatar May 19 '18 23:05 patrick91

Yup, it is using a different template for the application files, but it seems to be that it is still using the react-scripts package for the configuration

Yes - in the other PR, you already pointed out that the kitchensink test is not using react-scripts-ts, since this script version is not used in the command used for creating the app, so that command as to adopted to do so. However, regularly, this would cause both the build configuration and project template to be used, but the --internal-testing-template flag enforces the special kitchensink template, while retaining the build config and scripts. I.e.: Both the command used for creating the project for the kitchensink test and the special template used for it have to be modified resp. adopted.

DorianGrey avatar May 21 '18 12:05 DorianGrey

So, this fix the test we should force the kitchensink to use react-scripts-ts and update the template as well, right? I might work on it this weekend

patrick91 avatar May 21 '18 13:05 patrick91