question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Run unit tests from ng-packagr command

See original GitHub issue

If integrated into ng-packagr, it will be in an opinionated way. It will look like this:

The tool chain will be plain-old Angular testing: karma, webpack, jasmine, istanbul

  • myfoo.ts
  • myfoo.spec.ts (right next to the comp, service, whatever being tested)
  • **/*.spec.ts will be excluded from build task
  • an auto-generated run-tests.js will include all spec files
    • var testContext = require.context(${opt.src}, true, /\.spec\.ts/);
  • karma.conf.js will be auto-generated
  • webpack.test.js will be auto-generated
  • test runs will report: lcovonly, json, html (all written to disk). coverage report (html and json written to disk). coverage report to stdout (for the infamous gitlab stuff, still needs to be discussed, since GitLab users could simply pick up the json files and print to stdout with istanbul-combine)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
about-codecommented, Jul 9, 2017

Congratulations @dherges. I tried ng-packagr yesterday and its an excellent tool and absolutely easy to set up. It did exactly what I expected it to do. I am very happy to read (e.g. in #65) that you are focused and don’t plan to make it the next best swiss-army-knife-cli. I really appreciate and share such mindset. 👍

After having read this thread, though, and that you’d be willing to introduce support for unit testing and cli-like commands I asked myself if I would expect that from the tool. Spec files aren’t part of the distributed bundles and thus could actually be completely ignored by a packager/bundler. From that reasoning I came to conclude that I would probably consider anything which has to do with those files out of scope. I admit this might be kind of a fundamentalistic point of view and who am I to judge the plans for your project. I just thought to give you some feedback and start a discussion.

Part of why I am a little skeptic is, I am afraid that once this feature is implemented I need to pull in all these thousands of transitive dependencies of karma, webpack, jasmine etc. in order to enjoy ng-packagr. I am really interested to learn about your rationale and what your plans for ng-packagr are. Have you thought of implementing unit test support kind of like a separate ng-packagr-testing-plugin which is opt-in for anyone who has demand for a testing utility?

Thanks anyway. ❤️

0reactions
github-actions[bot]commented, Jun 19, 2020

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

unittest — Unit testing framework — Python 3.11.1 ...
The unittest module provides a rich set of tools for constructing and running tests. This section demonstrates that a small subset of the...
Read more >
How to run unit testing tests from command line?
run Visual Studio unit tests by using MSTest.exe, located at %ProgramFiles%\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe in my case.
Read more >
Test from the command line | Android Developers
Run tests with Gradle ; Instrumented unit test, Run the connectedAndroidTest task: ./gradlew connectedAndroidTest, HTML test result files:
Read more >
Chapter 1 Your first R package with unit tests | Tutorials
1.3 Create your R package. Use the following command to create the framework for a new package called demopckg . Set the argment...
Read more >
How To Run Junit Tests From The Command Line - LambdaTest
Want to run JUnit tests from the command line? Read on to learn how to compile and run JUnit tests from the command...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found