This repository was archived by the owner on Feb 26, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ before_script:
2222 - ./scripts/sauce/sauce_connect_block.sh
2323
2424script :
25+ - node_modules/.bin/gulp lint
2526 - node_modules/.bin/gulp format:enforce
2627 - node_modules/.bin/gulp build
2728 - node_modules/.bin/karma start karma-dist-sauce-jasmine.conf.js --single-run
Original file line number Diff line number Diff line change @@ -23,3 +23,37 @@ Run the browser tests using Karma:
2323Run the node.js tests:
2424
2525` npm run test-node `
26+
27+ Run tslint:
28+
29+ ` npm run lint `
30+
31+ Run format with clang-format:
32+
33+ ` npm run format `
34+
35+ Run all checks (lint/format/browser test/test-node):
36+
37+ ` npm run ci `
38+
39+ Before Commit
40+ ------------
41+
42+ Please make sure you pass all following checks before commit
43+
44+ - tslint
45+ - format: enforce (clang-format)
46+ - npm test (karma test)
47+ - test-node (node test)
48+
49+ You can run
50+
51+ ` npm run ci `
52+
53+ to do all those checks for you.
54+ You can also add the script into your git pre-commit hook
55+
56+ ```
57+ echo -e 'exec npm run ci' > .git/hooks/pre-commit
58+ chmod u+x .git/hooks/pre-commit
59+ ```
Original file line number Diff line number Diff line change 1515 },
1616 "scripts" : {
1717 "changelog" : " gulp changelog" ,
18+ "ci" : " npm run lint && npm run format && npm run test:single && npm run test-node" ,
19+ "format" : " gulp format:enforce" ,
20+ "karma-jasmine" : " karma start karma-build-jasmine.conf.js" ,
21+ "karma-jasmine:single" : " karma start karma-build-jasmine.conf.js --single-run" ,
22+ "karma-jasmine:autoclose" : " npm run karma-jasmine:single && npm run ws-client" ,
23+ "lint" : " gulp lint" ,
1824 "prepublish" : " tsc && gulp build" ,
25+ "ws-client" : " node ./test/ws-client.js" ,
1926 "ws-server" : " node ./test/ws-server.js" ,
2027 "tsc" : " tsc" ,
2128 "tsc:w" : " tsc -w" ,
22- "test" : " npm run tsc && concurrently \" npm run tsc:w\" \" npm run ws-server\" \" karma start karma-build-jasmine.conf.js\" " ,
29+ "test" : " npm run tsc && concurrently \" npm run tsc:w\" \" npm run ws-server\" \" npm run karma-jasmine\" " ,
30+ "test:single" : " npm run tsc && concurrently \" npm run ws-server\" \" npm run karma-jasmine:autoclose\" " ,
2331 "test-dist" : " concurrently \" npm run tsc:w\" \" npm run ws-server\" \" karma start karma-dist-jasmine.conf.js\" " ,
2432 "test-node" : " gulp test/node" ,
2533 "test-mocha" : " npm run tsc && concurrently \" npm run tsc:w\" \" npm run ws-server\" \" karma start karma-build-mocha.conf.js\" " ,
Original file line number Diff line number Diff line change 1+ /**
2+ * @license
3+ * Copyright Google Inc. All Rights Reserved.
4+ *
5+ * Use of this source code is governed by an MIT-style license that can be
6+ * found in the LICENSE file at https://angular.io/license
7+ */
8+
9+ const ws = require ( 'nodejs-websocket' ) ;
10+
11+ const conn = ws . connect ( 'ws://localhost:8001' , { } , function ( ) {
12+ conn . send ( 'close' ) ;
13+ conn . close ( ) ;
14+ } ) ;
Original file line number Diff line number Diff line change 66 * found in the LICENSE file at https://angular.io/license
77 */
88
9- var ws = require ( 'nodejs-websocket' ) ;
9+ const ws = require ( 'nodejs-websocket' ) ;
1010
1111// simple echo server
12- ws . createServer ( function ( conn ) {
12+ const server = ws . createServer ( function ( conn ) {
1313 conn . on ( 'text' , function ( str ) {
14+ if ( str === 'close' ) {
15+ server . close ( ) ;
16+ return ;
17+ }
1418 conn . sendText ( str . toString ( ) ) ;
1519 } ) ;
1620} ) . listen ( 8001 ) ;
You can’t perform that action at this time.
0 commit comments