Git Product home page Git Product logo

Comments (7)

about-code avatar about-code commented on May 22, 2024 1

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. ❤️

from ng-packagr.

dherges avatar dherges commented on May 22, 2024

Implementing testing, will arise the need for "commands" in ng-packagr. Usage should be:

$ ng-packagr -p ng-package.json           ### default build command
$ ng-packagr build -p ng-package.json  ### build command
$ ng-packagr test -p ng-package.json    ### test command (run tests once)

to be discussed: "watch mode" for local dev, "headless" runners for CI (phantom, ChromeTravisCI, or something else?)

$ ng-packagr test:dev -p ng-package.json    ### test command for local dev (watch mode)

One idea: describe different test "profiles" (profiles is not a good word ... maybe "environment" or "ambient-thing?").

  • test:dev: Chrome browser, watch mode
  • test:ci: 'ChromeTravisCi', phantom as fallback, run once
  • test: auto-detect or auto-configure best matching premise

Then, maybe allow users to set "premises" in ng-package.json:

  "test": {
    "ambient": {
       "dev": {
         "browser": "Chrome",
         "watch": true
       },
       "ci": {
         "browser": "Phantom",
         "watch": false
       },
    }
  }

from ng-packagr.

dherges avatar dherges commented on May 22, 2024

@about-code Uh, I like the idea of a separate ng-packagr-testing utility!

Maybe it's a nice idea to build a "multi-module" project e.g. w/ yarn workspaces for ng-packagr and then publish multiple npm packages as coexistent releases (same version number, et al).

from ng-packagr.

about-code avatar about-code commented on May 22, 2024

Maybe it's a nice idea to build a "multi-module" project e.g. w/ yarn workspaces for ng-packagr and then publish multiple npm packages as coexistent releases (same version number, et al).

I don't know yarn workspaces yet and would have thought of Lerna first, but if they are easier to manage, then yeah, it could be a very nice approach.

from ng-packagr.

dherges avatar dherges commented on May 22, 2024

Deprioritized this feature. Auto-generating the karma.conf.js is probably not a good idea. IntelliJ (and other IDEs) have first-class support for Karma but need to locate that karma.conf.js file in the project.

Will need to elaborate how to use testing in libs w/ minimal configuration. Using the @angular/cli/plugins/karma removes the additional webpack config but it needs the .angular-cli.json to work. A custom angular karma plugin that works w/ the above folder layout would be a good idea.

Rough draft idea: karma.conf.js + test.ts

module.exports = function (config) {
  config.set({
    basePath: '',
    frameworks: ['jasmine', 'angular'],
    plugins: [
      require('karma-jasmine'),
      require('karma-angular-testing-plugin')
    ]
  });
};

Maybe there is already an existing solution?

from ng-packagr.

dherges avatar dherges commented on May 22, 2024

Changed to "WONTFIX"

Motivation: existing tool support requires a karma.conf.js to work. For example, IntelliJ has good Karma support. See above. Goal should imho to have an Angular test runner for karma

  • a) w/ support for typescript and scss, less, and so on and on and on ....
  • b) run tests against dist javascript files

from ng-packagr.

github-actions avatar github-actions commented on May 22, 2024

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.

from ng-packagr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.