How to test a Angular 6 CLI generated Library

angular

#1

I try to figure out how to test my External Angular Library with CircleCI. I got 2 package.jsons there. One in the root for the playground, and another one for the external library. ( projects/mark6 )

The Default sample.yml ofc will only install the node_modules for the playground. Then the terminal throw errors because the used components from the mark6-lib can not found. ( yeah because they are not builded on the Circle CI server )

Local i do this with build mark6-lib --prod but how can i can add this to the config.yml? and is this really all i need to do? im sure that this isnt so simple as i wish. :wink: I cant find any tutorials / guides about this special case.

best regards!


#2

You can run any commands you like in CircleCI 2.0 - just add another run step.


#3

Thanks for this! I added yarn build mark6-lib --prod This looks like it works perfekt. But the test still tells me that the elements from the lib are unknown elements.

Here is the Log: https://paste.ee/p/EFva3
CircleCI Config: https://github.com/DevMonkeysDE/ngx-mark6/blob/master/.circleci/config.yml#L31


#4

Alright, well you’ll need to debug it. This error looks like a JS error that you’ll need to look into:

‘router-outlet’ is not a known element:

It’s worth noting that CircleCI (and most CI generally) is just a Linux VPS or container. Therefore, when it does not work, in most cases it is an environmental/OS/language problem and not a CI problem.

I would suggest:

  • You use the SSH feature to debug it inside a running container (just remember that this feature eats your build minutes, so don’t spend too long here)
  • Try to recreate it locally as well
  • Examine if your browser (Chrome) is starting up OK
  • Examine if your app is starting up OK
  • Get the HTML for pages to see why elements are not found

#5

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.