-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added debug argument to ng test task. #1799
Conversation
…sources is not supported. If you are using the graceful-fs module, please update it to a more recent version. �[2K�[1G�[?25h�[2K�[1G�[?25hYou have to be inside an angular-cli project in order to use the test command.. This argument when passed disable instrumentation and coverage, allowing to debug the source code when running tests
…le instrumentation and coverage, allowing to debug the source code when running tests
…instrumentation and coverage, allowing to debug the source code when running tests
fda89ed
to
ad82f9a
Compare
@filipesilva I added this pull request to solve an issue related to not being able to see application code in debug karma session because of the instrumentation made to report the coverage. Basically i added a debug argument to ng test ( |
Before I review, can I ask you to test in the latest master? We had a problem with sourcemaps that is fixed I believe, and would cause you to see instrumented code. @TheLarkInn can you have a look at #1798 and tell me if this is the sourcemaps issue? |
No this is specifically related to instrumented code in testing mode. |
I reviewed and it still occurs. As @TheLarkInn said it is related to instrumented code. |
hi @TheLarkInn and @filipesilva ! |
@abner I'm sorry it's taken so long to review this PR. I've bumped the original issue as something that needs to be finished for RC1 and we should get to it soon. |
…-cli into add-debug-argument-to-test
great @filipesilva . I just updated the branch. |
CI is showing a lint error:
It's minor but I cannot merge it without a green CI. |
@@ -5,6 +5,7 @@ import {CliConfig} from '../models/config'; | |||
const NgCliTestCommand = TestCommand.extend({ | |||
availableOptions: [ | |||
{ name: 'watch', type: Boolean, default: true, aliases: ['w'] }, | |||
{ name: 'debug', type: Boolean, default: false, aliases: ['d'] }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this option being passed into the karma config? I don't think it's being passed in yet.
My suggestion is this: in karma.conf.js
add in the debug property to the angularCli
options:
angularCli: {
config: './angular-cli.json',
environment: 'dev',
debug: false
},
Then you'll need to also change packages/angular-cli/tasks/test.ts
to set this to true
in the options
variable that's being passed into karma.Server
.
Make sure it works though, this is the kind of thing I don't know we can really do CI tests without doing really weird stuff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i actually implemented debug false as default so it doesn't need to be passed. i added an argument to the test command --debug (-d). I think we would add a npm script npm run test:debug which would call ng test --debug
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was tracing back the code and realize you are right. Since we just start karma with all the options that the command receives, the debug
property will be there. My bad!
@@ -66,7 +67,7 @@ const getWebpackTestConfig = function (projectRoot, environment, appConfig) { | |||
{ test: /\.(jpg|png)$/, loader: 'url-loader?limit=128000' }, | |||
{ test: /\.html$/, loader: 'raw-loader', exclude: [path.resolve(appRoot, appConfig.index)] } | |||
], | |||
postLoaders: [ | |||
postLoaders: debug ? [] : [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the latest webpack update, the loader configs changed a bit and is now a single rules
array.
You're probably going to have to add the sourcemap-istanbul-instrumenter-loader
conditionally, but by itself, at the end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok @filipesilva . i will update this branch to the latest changes in master and fix the linting issue you mentioned.
|
||
const appRoot = path.resolve(projectRoot, appConfig.root); | ||
var debug = typeof debug !== 'undefined' ? debug : false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Linting says this variable is being shadowed.
@abner we were talking about this PR between the team, and thinking of a somewhat alternative solution. How about having a What do you think? |
Partially address angular#1980 Close angular#1799
Heavily inspired by @abner's work on angular#1799. Partially address angular#1980 Close angular#1799
Heavily inspired by @abner's work on angular#1799. Partially address angular#1980 Close angular#1799
Heavily inspired by @abner's work on angular#1799. Partially address angular#1980 Close angular#1799
Heavily inspired by @abner's work on angular#1799. Partially address angular#1980 Close angular#1799
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
added debug argument to ng test task. This argument when passed disable instrumentation and coverage, allowing to debug the source code when running tests. Fixes #1798
This change is