This repository was archived by the owner on Feb 26, 2024. It is now read-only.
File tree 5 files changed +64
-3
lines changed
5 files changed +64
-3
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ before_script:
22
22
- ./scripts/sauce/sauce_connect_block.sh
23
23
24
24
script :
25
+ - node_modules/.bin/gulp lint
25
26
- node_modules/.bin/gulp format:enforce
26
27
- node_modules/.bin/gulp build
27
28
- 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:
23
23
Run the node.js tests:
24
24
25
25
` 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 15
15
},
16
16
"scripts" : {
17
17
"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" ,
18
24
"prepublish" : " tsc && gulp build" ,
25
+ "ws-client" : " node ./test/ws-client.js" ,
19
26
"ws-server" : " node ./test/ws-server.js" ,
20
27
"tsc" : " tsc" ,
21
28
"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\" " ,
23
31
"test-dist" : " concurrently \" npm run tsc:w\" \" npm run ws-server\" \" karma start karma-dist-jasmine.conf.js\" " ,
24
32
"test-node" : " gulp test/node" ,
25
33
"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 6
6
* found in the LICENSE file at https://angular.io/license
7
7
*/
8
8
9
- var ws = require ( 'nodejs-websocket' ) ;
9
+ const ws = require ( 'nodejs-websocket' ) ;
10
10
11
11
// simple echo server
12
- ws . createServer ( function ( conn ) {
12
+ const server = ws . createServer ( function ( conn ) {
13
13
conn . on ( 'text' , function ( str ) {
14
+ if ( str === 'close' ) {
15
+ server . close ( ) ;
16
+ return ;
17
+ }
14
18
conn . sendText ( str . toString ( ) ) ;
15
19
} ) ;
16
20
} ) . listen ( 8001 ) ;
You can’t perform that action at this time.
0 commit comments