11import { spawnSync } from 'child_process' ;
22import { resolve } from 'path' ;
33import { cpus } from 'os' ;
4- import { sync as globSync } from 'glob' ;
54
65if ( ! process . version . startsWith ( 'v10' ) ) {
76 process . exit ( 0 ) ;
@@ -28,17 +27,20 @@ interface TestResult {
2827 message ?: string ;
2928 } ;
3029}
30+ const excludedTests = [
31+ 'options-undefined' , // TODO
32+ 'options-proto' , // TODO
33+ 'options-toobject-prototype' , // TODO
34+ 'locales-valid' , // f7e8dba39b1143b45c37ee137e406889b56bc335 added grandfathered locale which we
35+ 'proto-from-ctor-realm' , // Bc of Realm support
36+ ] ;
3137const PATTERN = resolve (
3238 __dirname ,
33- '../../../test262/test/intl402/RelativeTimeFormat/**/*.js'
34- ) ;
35- const testsFiles = globSync ( PATTERN ) . filter (
36- // f7e8dba39b1143b45c37ee137e406889b56bc335 added grandfathered locale which we
37- // don't deal with
38- fn =>
39- ! fn . includes ( 'constructor/constructor/locales-valid' ) &&
40- ! fn . includes ( 'proto-from-ctor-realm.js' )
39+ `../../../test262/test/intl402/RelativeTimeFormat/**/!(${ excludedTests . join (
40+ '|'
41+ ) } ).js`
4142) ;
43+
4244const args = [
4345 '--reporter-keys' ,
4446 'file,attrs,result' ,
@@ -48,8 +50,7 @@ const args = [
4850 './dist/polyfill-with-locales-for-test262.js' ,
4951 '-r' ,
5052 'json' ,
51- // PATTERN,
52- ...testsFiles ,
53+ PATTERN ,
5354] ;
5455console . log ( `Running "test262-harness ${ args . join ( ' ' ) } "` ) ;
5556const result = spawnSync ( 'test262-harness' , args , {
@@ -61,6 +62,7 @@ const result = spawnSync('test262-harness', args, {
6162const json : TestResult [ ] = JSON . parse ( result . stdout ) ;
6263if ( ! json ) {
6364 console . error ( result . stderr , result . error ) ;
65+ process . exit ( 1 ) ;
6466}
6567const failedTests = json . filter ( r => ! r . result . pass ) ;
6668json . forEach ( t => {
@@ -79,6 +81,7 @@ if (failedTests.length) {
7981 `Tests: ${ failedTests . length } failed, ${ json . length -
8082 failedTests . length } passed, ${ json . length } total`
8183 ) ;
82- process . exit ( 1 ) ;
84+ process . exitCode = 1 ;
85+ } else {
86+ console . log ( `Tests: ${ json . length } passed, ${ json . length } total` ) ;
8387}
84- console . log ( `Tests: ${ json . length } passed, ${ json . length } total` ) ;
0 commit comments