@@ -4,18 +4,6 @@ const tap = require('tap')
44
55const nodeLabels = require ( '../../lib/node-labels' )
66
7- tap . test ( 'label: "test" when only ./test/ files has been changed' , ( t ) => {
8- const labels = nodeLabels . resolveLabels ( [
9- 'test/debugger/test-debugger-pid.js' ,
10- 'test/debugger/test-debugger-repl-break-in-module.js' ,
11- 'test/debugger/test-debugger-repl-term.js'
12- ] )
13-
14- t . same ( labels , [ 'test' ] )
15-
16- t . end ( )
17- } )
18-
197tap . test ( 'no labels: when ./test/ and ./doc/ files has been changed' , ( t ) => {
208 const labels = nodeLabels . resolveLabels ( [
219 'test/debugger/test-debugger-pid.js' ,
@@ -53,17 +41,6 @@ tap.test('label: "doc" when only ./doc/ files has been changed', (t) => {
5341 t . end ( )
5442} )
5543
56- tap . test ( 'label: "benchmark" when only ./benchmark/ files has been changed' , ( t ) => {
57- const labels = nodeLabels . resolveLabels ( [
58- 'benchmark/http_server_lag.js' ,
59- 'benchmark/http/check_is_http_token.js'
60- ] )
61-
62- t . same ( labels , [ 'benchmark' ] )
63-
64- t . end ( )
65- } )
66-
6744tap . test ( 'label: "c++" when ./src/* has been changed' , ( t ) => {
6845 const labels = nodeLabels . resolveLabels ( [
6946 'src/node.cc'
@@ -148,7 +125,7 @@ const srcCases = [
148125 [ 'zlib' , [ 'node_zlib.cc' ] ]
149126]
150127for ( const info of srcCases ) {
151- var labels = info [ 0 ]
128+ let labels = info [ 0 ]
152129 if ( ! Array . isArray ( labels ) ) {
153130 labels = [ labels ]
154131 }
@@ -399,22 +376,12 @@ tap.test('label: no version labels (master)', (t) => {
399376 t . end ( )
400377} )
401378
402- tap . test ( 'label: tools label' , ( t ) => {
403- const labels = nodeLabels . resolveLabels ( [
404- 'tools/doc/json.js'
405- ] )
406-
407- t . same ( labels , [ 'tools' ] )
408-
409- t . end ( )
410- } )
411-
412379tap . test ( 'label: build label (windows)' , ( t ) => {
413380 const labels = nodeLabels . resolveLabels ( [
414381 'vcbuild.bat'
415382 ] )
416383
417- t . same ( labels , [ 'build' ] )
384+ t . same ( labels , [ 'build' , 'windows' ] )
418385
419386 t . end ( )
420387} )
@@ -439,3 +406,123 @@ tap.test('label: doc label for non-subsystem API doc changes', (t) => {
439406
440407 t . end ( )
441408} )
409+
410+ const specificBenchmarks = [
411+ [ [ ] , [ 'fixtures/alice.html' , 'misc/freelist.js' ] ] ,
412+ [ 'assert' , [ 'assert/deepequal-buffer.js' ] ] ,
413+ [ 'buffer' , [ 'buffers/buffer-base64-decode.js' ] ] ,
414+ [ 'child_process' , [ 'child_process/child-process-exec-stdout.js' ] ] ,
415+ [ 'crypto' , [ 'crypto/aes-gcm-throughput.js' ] ] ,
416+ [ 'dgram' , [ 'dgram/bind-params.js' ] ] ,
417+ [ 'domain' , [ 'domain/domain-fn-args.js' ] ] ,
418+ [ 'events' , [ 'events/ee-emit.js' ] ] ,
419+ [ 'fs' , [ 'fs/readfile.js' ] ] ,
420+ [ 'http' , [ '_http-benchmarkers.js' , 'http/simple.js' ] ] ,
421+ [ 'module' , [ 'module/module-loader.js' ] ] ,
422+ [ 'net' , [ 'net/net-c2s.js' ] ] ,
423+ [ 'os' , [ 'os/loadavg.js' ] ] ,
424+ [ 'path' , [ 'path/basename-posix.js' ] ] ,
425+ [ 'process' , [ 'process/memoryUsage.js' ] ] ,
426+ [ 'querystring' , [ 'querystring/querystring-parse.js' ] ] ,
427+ [ 'stream' , [ 'streams/readable-readall.js' ] ] ,
428+ [ 'string_decoder' , [ 'string_decoder/string-decoder.js' ] ] ,
429+ [ 'timers' , [ 'timers/set-immediate-depth.js' ] ] ,
430+ [ 'tls' , [ 'tls/throughput.js' ] ] ,
431+ [ 'url' , [ 'url/url-resolve.js' ] ] ,
432+ [ 'util' , [ 'util/format.js' ] ] ,
433+ [ 'V8' , [ 'arrays/var-int.js' , 'es/defaultparams-bench.js' ] ] ,
434+ [ 'vm' , [ 'vm/run-in-context.js' ] ]
435+ ]
436+ for ( const info of specificBenchmarks ) {
437+ let labels = info [ 0 ]
438+ if ( ! Array . isArray ( labels ) ) {
439+ labels = [ 'benchmark' , labels ]
440+ } else {
441+ labels = [ 'benchmark' ] . concat ( labels )
442+ }
443+ const files = info [ 1 ]
444+ for ( const file of files ) {
445+ tap . test ( `label: "${ labels . join ( '","' ) } " when ./benchmark/${ file } has been changed` , ( t ) => {
446+ const resolved = nodeLabels . resolveLabels ( [ `benchmark/${ file } ` ] )
447+
448+ t . same ( resolved , labels )
449+
450+ t . end ( )
451+ } )
452+ }
453+ }
454+
455+ const moreTools = [
456+ '.eslintignore' , '.editorconfig' , '.eslintrc.yaml' , '.remarkrc'
457+ ]
458+ for ( const file of moreTools ) {
459+ tap . test ( `label: "tools" when ${ file } has been changed` , ( t ) => {
460+ const resolved = nodeLabels . resolveLabels ( [ `${ file } ` ] )
461+
462+ t . same ( resolved , [ 'tools' ] )
463+
464+ t . end ( )
465+ } )
466+ }
467+
468+ const specificTests = [
469+ [ 'addons' , [ 'addons/async-hello-world/binding.cc' ] ] ,
470+ [ 'debugger' , [ 'debugger/test-debugger-repl.js' ] ] ,
471+ [ [ 'doc' , 'tools' ] , [ 'doctool/test-doctool-html.js' ] ] ,
472+ [ 'timers' , [ 'timers/test-timers-reliability.js' ] ] ,
473+ [ 'tty' , [ 'pseudo-tty/stdin-setrawmode.js' ] ]
474+ ]
475+ for ( const info of specificTests ) {
476+ let labels = info [ 0 ]
477+ if ( ! Array . isArray ( labels ) ) {
478+ labels = [ 'test' , labels ]
479+ } else {
480+ labels = [ 'test' ] . concat ( labels )
481+ }
482+ const files = info [ 1 ]
483+ for ( const file of files ) {
484+ tap . test ( `label: "${ labels . join ( '","' ) } " when ./test/${ file } has been changed` , ( t ) => {
485+ const resolved = nodeLabels . resolveLabels ( [ `test/${ file } ` ] )
486+
487+ t . same ( resolved , labels )
488+
489+ t . end ( )
490+ } )
491+ }
492+ }
493+
494+ const specificTools = [
495+ [ 'build' , [ 'gyp/gyp_main.py' , 'gyp_node.py' ] ] ,
496+ [ 'doc' , [ 'doc/generate.js' ] ] ,
497+ [ 'intl' , [ 'icu/icu-generate.gyp' ] ] ,
498+ [ 'macos' ,
499+ [ 'macosx-firewall.sh' ,
500+ 'osx-codesign.sh' ] ] ,
501+ [ [ 'macos' , 'install' ] ,
502+ [ 'osx-pkg.pmdoc/index.xml.tmpl' ,
503+ 'pkgsrc/description' ] ] ,
504+ [ [ 'test' , 'npm' ] , [ 'test-npm.sh' , 'test-npm-package.js' ] ] ,
505+ [ [ 'test' ] , [ 'test.py' ] ] ,
506+ [ [ 'openssl' , 'tls' ] , [ 'certdata.txt' , 'mkssldef.py' , 'mk-ca-bundle.pl' ] ] ,
507+ [ [ 'windows' ] , [ 'sign.bat' ] ] ,
508+ [ [ 'windows' , 'install' ] , [ 'msvs/msi/product.wxs' ] ] ,
509+ [ [ 'V8' ] , [ 'make-v8.sh' ] ]
510+ ]
511+ for ( const info of specificTools ) {
512+ let labels = info [ 0 ]
513+ if ( ! Array . isArray ( labels ) ) {
514+ labels = [ 'tools' , labels ]
515+ } else {
516+ labels = [ 'tools' ] . concat ( labels )
517+ }
518+ const files = info [ 1 ]
519+ for ( const file of files ) {
520+ tap . test ( `label: "${ labels . join ( '","' ) } " when ./tools/${ file } has been changed` , ( t ) => {
521+ const resolved = nodeLabels . resolveLabels ( [ `tools/${ file } ` ] )
522+
523+ t . same ( resolved , labels )
524+
525+ t . end ( )
526+ } )
527+ }
528+ }
0 commit comments