-
Notifications
You must be signed in to change notification settings - Fork 11.9k
chore(test): simplify test file #2839
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
Conversation
@@ -14,21 +19,15 @@ declare var require: any; | |||
// Prevent Karma from running prematurely. | |||
__karma__.loaded = function () {}; | |||
|
|||
// First, initialize the Angular testing environment. |
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.
Please surround this by try { ... } catch(err) { karma.error(err); }
to catch potential framework errors and break the test.
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.
Done
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.
@hansl I tried throwing an error in a spec file (throw new Error('error here');
) with and without the catch, and it's much better without it:
# with try/catch
kamik@T460p MINGW64 /D/sandbox/master-proj (master)
$ ng test --no-watch
09 11 2016 00:07:29.194:INFO [karma]: Karma v1.2.0 server started at http://localhost:9876/
09 11 2016 00:07:29.198:INFO [launcher]: Launching browser Chrome with unlimited concurrency
09 11 2016 00:07:29.280:INFO [launcher]: Starting browser Chrome
09 11 2016 00:07:30.590:INFO [Chrome 54.0.2840 (Windows 10 0.0.0)]: Connected on socket /#guzx9l6foj0Tw_5KAAAA with id 24284547
Chrome 54.0.2840 (Windows 10 0.0.0) ERROR
Chrome 54.0.2840 (Windows 10 0.0.0) ERROR
# without try/catch
kamik@T460p MINGW64 /D/sandbox/master-proj (master)
$ ng test --no-watch
09 11 2016 00:06:41.269:INFO [karma]: Karma v1.2.0 server started at http://localhost:9876/
09 11 2016 00:06:41.271:INFO [launcher]: Launching browser Chrome with unlimited concurrency
09 11 2016 00:06:41.279:INFO [launcher]: Starting browser Chrome
09 11 2016 00:06:42.600:INFO [Chrome 54.0.2840 (Windows 10 0.0.0)]: Connected on socket /#5bLXOqjWdAOdm5VyAAAA with id 53864020
Chrome 54.0.2840 (Windows 10 0.0.0) ERROR
Uncaught Error: error here
at webpack:///D:/sandbox/master-proj/src/app/app.component.spec.ts:35:0 <- src/test.ts:50522
Chrome 54.0.2840 (Windows 10 0.0.0) ERROR
Uncaught Error: error here
at webpack:///D:/sandbox/master-proj/src/app/app.component.spec.ts:35:0 <- src/test.ts:50522
376c6c7
to
6025e99
Compare
Okay, as long as you say that the error was not inside a test but in the file itself. LGTM. |
I'll let you merge this. |
There is no need to have System typings or asynchronously load the testing modules.
f135767
to
2328128
Compare
There is no need to have System typings or asynchronously load the testing modules.
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. |
There is no need to have System typings or asynchronously load
the testing modules.