@@ -9,13 +9,14 @@ const { parseArgs } = require('node:util');
99
1010const args = process . argv . slice ( 2 ) ;
1111
12- let config , report , suiteName , onlycase , bench , unit , stopOnFailure , id ;
12+ let config , report , suiteName , onlycase , bench , unit , stopOnFailure , id , puterjs ;
1313
1414try {
1515 const parsed = parseArgs ( {
1616 options : {
1717 config : {
1818 type : 'string' ,
19+ default : './tools/api-tester/config.yml' ,
1920 } ,
2021 report : {
2122 type : 'string' ,
2526 unit : { type : 'boolean' } ,
2627 suite : { type : 'string' } ,
2728 'stop-on-failure' : { type : 'boolean' } ,
29+ puterjs : { type : 'boolean' } ,
2830 } ,
2931 allowPositionals : true ,
3032 } ) ;
3739 unit,
3840 suite : suiteName ,
3941 'stop-on-failure' : stopOnFailure ,
42+ puterjs,
4043 } , positionals : [ id ] } = parsed ) ;
4144
4245 onlycase = onlycase !== undefined ? Number . parseInt ( onlycase ) : undefined ;
4952 '\n' +
5053 'Options:\n' +
5154 ' --config=<path> (required) Path to configuration file\n' +
55+ ' --puterjs (optional) Use puter-js puterjs\n' +
5256 ' --report=<path> (optional) Output file for full test results\n' +
5357 ' --suite=<name> (optional) Run only tests with matching suite name\n' +
5458 ' --stop-on-failure (optional) Stop execution on first test failure\n' +
@@ -61,6 +65,29 @@ const conf = YAML.parse(fs.readFileSync(config).toString());
6165
6266
6367const main = async ( ) => {
68+ if ( puterjs ) {
69+ // const run = require('./puter_js/__entry__.js');
70+
71+ const context = {
72+ mountpoint : {
73+ path : '/' ,
74+ }
75+ } ;
76+
77+ const ts = new TestSDK ( conf , context , { } ) ;
78+ const registry = new TestRegistry ( ts ) ;
79+
80+ await require ( './puter_js/__entry__.js' ) ( registry ) ;
81+
82+ await registry . run_all_tests ( ) ;
83+
84+ // await run(conf);
85+ ts . printTestResults ( ) ;
86+ ts . printBenchmarkResults ( ) ;
87+ process . exit ( 0 ) ;
88+ return ;
89+ }
90+
6491 const unit_test_results = [ ] ;
6592 const benchmark_results = [ ] ;
6693 for ( const mountpoint of conf . mountpoints ) {
0 commit comments