cgross / generator-cg-angular15

Yeoman Generator for Enterprise Angular 1.5 Projects with Typescript, Webpack, and Sass.
MIT License
33 stars 3 forks source link

Karma on watch #4

Open rbosneag opened 7 years ago

rbosneag commented 7 years ago

Hey Chris,

Glad to see you back after almost 2 years 👍

Intro

I used your previous cg-angular generator for almost 2 years and got very used to it, even forked it to fit new workflows and used it for most of my projects (sadly I haven't published it recently).

For quite a while now I am in the process of switching my projects to TS, components, webpack (went through requirejs and systemjs as well) and somehow got to a structure/workflow that resembles your new generator very well (luckily I got to check your github for changes and stumbled upon the new generator).

Question

In cg-angular we used to have grunt.watch looking for changes in .js files and the karma task was starting if a -spec.js was changed or a .js file that had a -spec attached.

In my webpack flow I took a shot with a new npm task "watch:test" : "npm test -- --auto-watch --no-single-run" and had karma configured to look for spec files and this setup works fine except that it won't run the test if the source component file is changed instead of the spec file.

How can we accomplish this in the new generator?

rbosneag commented 7 years ago

If I add a new npm task to package.jsonlike:

"test:watch" : "npm test -- --auto-watch --no-single-run",

karma will fire on every change but for all the app tests and not selectively for the modified -spec.ts or for the associated spec of the modified .ts file.

Looking further into this.