facebook

Angular IDE does not compile unit and e2e test files

  1. CodeMix & Angular IDE
  2.  > 
  3. Webclipse 1.x Help
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #520593 Reply

    Daniel
    Participant

    When generating a project using Angular CLI, the following ‘tsconfig’ files are generated which all extend tsconfig.json:

    – ‘src/tsconfig.app.json’ to run the application with ng serve
    – ‘src/tsconfig.spec.json’ to run unit tests with ng test
    – ‘e2e/tsconfig.e2e.json’ to run end-to-end tests with ng e2e

    In .angular-cli.json those files are referenced as following:

    {
      ...
      "apps": [
        {
          ...
          "tsconfig": "tsconfig.app.json",
          "testTsconfig": "tsconfig.spec.json", // ignored by Angular IDE
        }
      ],
      ...
      "lint": [
        {
          "project": "src/tsconfig.app.json"
        },
        {
          "project": "src/tsconfig.spec.json"
        },
        {
          "project": "e2e/tsconfig.e2e.json"
        }
      ],
       ...
    }

    It seems that Angular IDE ignores this setup and uses tsconfig.app.json only. Because tsconfig.app.json specifies to exclude all *.spec.ts files, those files are excluded from being compiled in Angular IDE and therefore not checked for compilation errors. This applies for unit as well as for e2e test files.

    • This topic was modified 6 years, 12 months ago by Daniel.
    #520599 Reply

    support-piotr
    Participant

    Daniel,

    You are right, Angular IDE doesn’t provide support for multiple tsconfigs enabled at the same time on a single project. We are working on providing a good multi-config support. Some kind of a workaround for now would be to change your tsconfig, when needed, in project properties: right click on the project in Explorer view > Properties > Typescript and select different tsconfig.json.

    Best regards,
    Piotr Tomiak

    #520604 Reply

    Daniel
    Participant

    Thank you for the speedy reply. That’s actually the workaround which I am using right now. However, I am glad to hear that multi-config support is coming for Angular IDE some time in the near future.

    Best regards
    Daniel

    #521095 Reply

    Fedor Losev
    Participant

    We also did encounter this multiconfig issue.

    If your spec tsconfig is not in dramatic conflict with app config, the better workaround instead of constantly switching the files or maintain a completely separate config is to create tsconfig.ide.json, extend it from tsconfig.app.json and just override excludes / add types (or other things you wish for ide), for example:

    
    {
    	"extends": "tsconfig.app.json",
    	"compilerOptions": {
    		"types": [
    			"jasmine",
    			"node"
    		],
    	},
    	"exclude": [
    		"dist/**/*"
    	]
    }
    
    

    Then point IDE to this file. It will pick app.config settings for IDE but also compile spec files.

    The downside is that we need to compromise for the same common compiler configuration for spec and app in IDE, so we definitely would be happy to see the multi-config support in coming releases 🙂

    #521270 Reply

    support-swapna
    Moderator

    Fedor,

    Thank you for sharing your workaround details. It will surely help other users.
    We will keep you posted when the multi-config support is out.

    –Swapna
    MyEclipse Support

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: Angular IDE does not compile unit and e2e test files

You must be logged in to post in the forum log in