This repository was archived by the owner on Dec 10, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +58
-3
lines changed Expand file tree Collapse file tree 3 files changed +58
-3
lines changed Original file line number Diff line number Diff line change 35
35
- uses : actions/checkout@v2
36
36
- run : npm install
37
37
- run : npm run test:browser
38
+ test-cli :
39
+ runs-on : ubuntu-latest
40
+ steps :
41
+ - uses : actions/setup-node@v1
42
+ with :
43
+ node-version : 12.x
44
+ - uses : actions/checkout@v2
45
+ - run : npm install
46
+ - run : npm run test:cli
Original file line number Diff line number Diff line change 17
17
"build:node" : " tsc -p ./tsconfig.prod.json" ,
18
18
"build:browser" : " tsc -p ./tsconfig.browser.json && npm run bundle && rm -rf dist.browser" ,
19
19
"bundle" : " webpack" ,
20
- "client:start" : " tsc -p tsconfig.prod.json && node dist/ bin/cli.js " ,
20
+ "client:start" : " ts- node bin/cli.ts " ,
21
21
"coverage" : " nyc npm run coverage:test && nyc report --reporter=lcov" ,
22
- "coverage:test" : " tape -r ts-node/register 'test/!(integration)/**/*.ts' 'test/integration/**/*.ts'" ,
22
+ "coverage:test" : " npm run tape -- 'test/!(integration|cli )/**/*.ts' 'test/integration/**/*.ts'" ,
23
23
"docs:build" : " typedoc --tsconfig tsconfig.prod.json" ,
24
24
"lint" : " ethereumjs-config-lint" ,
25
25
"lint:fix" : " ethereumjs-config-lint-fix" ,
26
26
"tape" : " tape -r ts-node/register" ,
27
27
"test" : " npm run test:unit && npm run test:integration" ,
28
- "test:unit" : " npm run tape -- 'test/!(integration)/**/*.ts'" ,
28
+ "test:unit" : " npm run tape -- 'test/!(integration|cli )/**/*.ts'" ,
29
29
"test:integration" : " npm run tape -- 'test/integration/**/*.ts'" ,
30
+ "test:cli" : " npm run build:node && npm run tape -- 'test/cli/*.ts'" ,
30
31
"test:browser" : " karma start karma.conf.js"
31
32
},
32
33
"husky" : {
Original file line number Diff line number Diff line change
1
+ import tape from 'tape'
2
+ import { spawn } from 'child_process'
3
+
4
+ tape ( '[CLI]' , ( t ) => {
5
+ t . test ( 'should start and begin downloading blocks' , ( t ) => {
6
+ const file = require . resolve ( '../../dist/bin/cli.js' )
7
+ const child = spawn ( process . execPath , [ file ] )
8
+
9
+ const timeout = setTimeout ( ( ) => {
10
+ child . kill ( 'SIGINT' )
11
+ } , 120000 )
12
+
13
+ const end = ( ) => {
14
+ clearTimeout ( timeout )
15
+ child . kill ( 'SIGINT' )
16
+ t . end ( )
17
+ }
18
+
19
+ child . stdout . on ( 'data' , ( data ) => {
20
+ const message = data . toString ( )
21
+ if ( message . toLowerCase ( ) . includes ( 'error' ) ) {
22
+ t . fail ( message )
23
+ end ( )
24
+ }
25
+ if ( message . includes ( 'Imported blocks' ) ) {
26
+ t . pass ( )
27
+ end ( )
28
+ }
29
+ console . log ( message ) // eslint-disable-line no-console
30
+ } )
31
+
32
+ child . stderr . on ( 'data' , ( data ) => {
33
+ const message = data . toString ( )
34
+ t . fail ( message )
35
+ end ( )
36
+ } )
37
+
38
+ child . on ( 'close' , ( code ) => {
39
+ if ( code !== 0 ) {
40
+ t . fail ( `child process exited with code ${ code } ` )
41
+ end ( )
42
+ }
43
+ } )
44
+ } )
45
+ } )
You can’t perform that action at this time.
0 commit comments