mam 1.11.794 → 1.11.796

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/node.test.js CHANGED
@@ -6,6 +6,9 @@ var $;
6
6
  })($ || ($ = {}));
7
7
  module.exports = $;
8
8
 
9
+ ;
10
+ "use strict";
11
+
9
12
  ;
10
13
  "use strict"
11
14
 
@@ -2410,45 +2413,64 @@ var $;
2410
2413
  ;
2411
2414
  "use strict";
2412
2415
 
2416
+ ;
2417
+ "use strict";
2418
+ var $;
2419
+ (function ($) {
2420
+ const mod = require('module');
2421
+ const internals = mod.builtinModules;
2422
+ function $node_internal_check(name) {
2423
+ if (name.startsWith('node:'))
2424
+ return true;
2425
+ return internals.includes(name);
2426
+ }
2427
+ $.$node_internal_check = $node_internal_check;
2428
+ })($ || ($ = {}));
2429
+
2413
2430
  ;
2414
2431
  "use strict";
2415
2432
  var $node = new Proxy({ require }, {
2416
2433
  get(target, name, wrapper) {
2417
2434
  if (target[name])
2418
2435
  return target[name];
2419
- if (name.startsWith('node:'))
2436
+ const $$ = $;
2437
+ if ($$.$node_internal_check(name, target))
2420
2438
  return target.require(name);
2421
2439
  if (name[0] === '.')
2422
2440
  return target.require(name);
2423
- const mod = target.require('module');
2424
- if (mod.builtinModules.indexOf(name) >= 0)
2425
- return target.require(name);
2426
2441
  try {
2427
2442
  target.require.resolve(name);
2428
2443
  }
2429
2444
  catch {
2430
- const $$ = $;
2431
- $$.$mol_exec('.', 'npm', 'install', '--omit=dev', name);
2445
+ try {
2446
+ $$.$mol_exec('.', 'npm', 'install', '--omit=dev', name);
2447
+ }
2448
+ catch (e) {
2449
+ if ($$.$mol_promise_like(e))
2450
+ $$.$mol_fail_hidden(e);
2451
+ }
2432
2452
  try {
2433
2453
  $$.$mol_exec('.', 'npm', 'install', '--omit=dev', '@types/' + name);
2434
2454
  }
2435
2455
  catch (e) {
2436
- if ($$.$mol_fail_catch(e)) {
2437
- $$.$mol_fail_log(e);
2438
- }
2456
+ if ($$.$mol_promise_like(e))
2457
+ $$.$mol_fail_hidden(e);
2458
+ $$.$mol_fail_log(e);
2439
2459
  }
2440
2460
  }
2441
2461
  try {
2442
2462
  return target.require(name);
2443
2463
  }
2444
2464
  catch (error) {
2445
- if ($.$mol_fail_catch(error) && error.code === 'ERR_REQUIRE_ESM') {
2465
+ if ($$.$mol_promise_like(error))
2466
+ $$.$mol_fail_hidden(error);
2467
+ if (error && typeof error === 'object' && error.code === 'ERR_REQUIRE_ESM') {
2446
2468
  const module = cache.get(name);
2447
2469
  if (module)
2448
2470
  return module;
2449
2471
  throw Object.assign(import(name).then(module => cache.set(name, module)), { cause: error });
2450
2472
  }
2451
- $.$mol_fail_log(error);
2473
+ $$.$mol_fail_log(error);
2452
2474
  return null;
2453
2475
  }
2454
2476
  },
@@ -6216,7 +6238,7 @@ var $;
6216
6238
  types.push('\t' + JSON.stringify(dep) + ' : typeof import\( ' + JSON.stringify(dep) + ' ) // ' + src);
6217
6239
  }
6218
6240
  const node_types = $mol_file.absolute(path).resolve(`-node/deps.d.ts`);
6219
- node_types.text('interface $node {\n ' + types.join('\n') + '\n}');
6241
+ node_types.text('// @ts-nocheck\ninterface $node {\n ' + types.join('\n') + '\n}');
6220
6242
  sources.push(node_types);
6221
6243
  }
6222
6244
  return sources.map(src => src.path());
@@ -6866,7 +6888,7 @@ var $;
6866
6888
  ++version[2];
6867
6889
  json.version = version.join('.');
6868
6890
  for (let dep of this.nodeDeps([path, exclude]).keys()) {
6869
- if (require('module').builtinModules.includes(dep) || dep.startsWith('node:'))
6891
+ if ($node_internal_check(dep))
6870
6892
  continue;
6871
6893
  json.dependencies[dep] ??= `*`;
6872
6894
  }
@@ -7249,6 +7271,8 @@ var $;
7249
7271
  var indent = /^([\s\t]*)/.exec(line);
7250
7272
  var priority = -indent[0].replace(/\t/g, ' ').length / 4;
7251
7273
  line.replace(/\b(?:require|import)\(\s*['"]([^"'()]*?)['"]\s*\)/ig, (str, path) => {
7274
+ if ($node_internal_check(path))
7275
+ return str;
7252
7276
  path = path.replace(/(\/[^\/.]+)$/, '$1.js').replace(/\/$/, '/index.js');
7253
7277
  if (path[0] === '.')
7254
7278
  path = '../' + path;
@@ -7277,7 +7301,7 @@ var $;
7277
7301
  return str;
7278
7302
  });
7279
7303
  line.replace(/\b(?:require|import)\(\s*['"]([^"'()]*?)['"]\s*\)/ig, (str, path) => {
7280
- if (path.startsWith('node:'))
7304
+ if ($node_internal_check(path))
7281
7305
  return str;
7282
7306
  $mol_build_depsMerge(depends, { [path]: priority });
7283
7307
  return str;
@@ -7975,215 +7999,6 @@ var $;
7975
7999
  $mol_test_mocks.push($ => $.$mol_fail_log = () => false);
7976
8000
  })($ || ($ = {}));
7977
8001
 
7978
- ;
7979
- "use strict";
7980
- var $;
7981
- (function ($_1) {
7982
- $mol_test({
7983
- 'FQN of anon function'($) {
7984
- const $$ = Object.assign($, { $mol_func_name_test: (() => () => { })() });
7985
- $mol_assert_equal($$.$mol_func_name_test.name, '');
7986
- $mol_assert_equal($$.$mol_func_name($$.$mol_func_name_test), '$mol_func_name_test');
7987
- $mol_assert_equal($$.$mol_func_name_test.name, '$mol_func_name_test');
7988
- },
7989
- });
7990
- })($ || ($ = {}));
7991
-
7992
- ;
7993
- "use strict";
7994
- var $;
7995
- (function ($) {
7996
- $mol_test({
7997
- 'auto name'() {
7998
- class Invalid extends $mol_error_mix {
7999
- }
8000
- const mix = new Invalid('foo');
8001
- $mol_assert_equal(mix.name, 'Invalid_Error');
8002
- },
8003
- 'simpe mix'() {
8004
- const mix = new $mol_error_mix('foo', {}, new Error('bar'), new Error('lol'));
8005
- $mol_assert_equal(mix.message, 'foo');
8006
- $mol_assert_equal(mix.errors.map(e => e.message), ['bar', 'lol']);
8007
- },
8008
- 'provide additional info'() {
8009
- class Invalid extends $mol_error_mix {
8010
- }
8011
- const mix = new $mol_error_mix('Wrong password', {}, new Invalid('Too short', { value: 'p@ssw0rd', hint: '> 8 letters' }), new Invalid('Too simple', { value: 'p@ssw0rd', hint: 'need capital letter' }));
8012
- const hints = [];
8013
- if (mix instanceof $mol_error_mix) {
8014
- for (const er of mix.errors) {
8015
- if (er instanceof Invalid) {
8016
- hints.push(er.cause?.hint ?? '');
8017
- }
8018
- }
8019
- }
8020
- $mol_assert_equal(hints, ['> 8 letters', 'need capital letter']);
8021
- },
8022
- });
8023
- })($ || ($ = {}));
8024
-
8025
- ;
8026
- "use strict";
8027
-
8028
- ;
8029
- "use strict";
8030
-
8031
- ;
8032
- "use strict";
8033
-
8034
- ;
8035
- "use strict";
8036
-
8037
- ;
8038
- "use strict";
8039
-
8040
- ;
8041
- "use strict";
8042
- var $;
8043
- (function ($_1) {
8044
- $mol_test({
8045
- 'init with overload'() {
8046
- class X extends $mol_object {
8047
- foo() {
8048
- return 1;
8049
- }
8050
- }
8051
- var x = X.make({
8052
- foo: () => 2,
8053
- });
8054
- $mol_assert_equal(x.foo(), 2);
8055
- },
8056
- 'Context in instance inherits from class'($) {
8057
- const custom = $.$mol_ambient({});
8058
- class X extends $.$mol_object {
8059
- static $ = custom;
8060
- }
8061
- $mol_assert_equal(new X().$, custom);
8062
- },
8063
- });
8064
- })($ || ($ = {}));
8065
-
8066
- ;
8067
- "use strict";
8068
- var $;
8069
- (function ($_1) {
8070
- $mol_test({
8071
- 'test types'($) {
8072
- class A {
8073
- static a() {
8074
- return Promise.resolve('');
8075
- }
8076
- static b() {
8077
- return $mol_wire_sync(this).a();
8078
- }
8079
- }
8080
- },
8081
- async 'test method from host'($) {
8082
- let count = 0;
8083
- class A {
8084
- static a() {
8085
- return $mol_wire_sync(this).b();
8086
- }
8087
- static b() { return Promise.resolve(++count); }
8088
- }
8089
- $mol_assert_equal(await $mol_wire_async(A).a(), 1, count);
8090
- },
8091
- async 'test function'($) {
8092
- let count = 0;
8093
- class A {
8094
- static a() {
8095
- return $mol_wire_sync(this.b)();
8096
- }
8097
- static b() { return Promise.resolve(++count); }
8098
- }
8099
- $mol_assert_equal(await $mol_wire_async(A).a(), 1, count);
8100
- },
8101
- async 'test construct itself'($) {
8102
- class A {
8103
- static instances = [];
8104
- static a() {
8105
- const a = new ($mol_wire_sync(A))();
8106
- this.instances.push(a);
8107
- $mol_wire_sync(this).b();
8108
- }
8109
- static b() { return Promise.resolve(); }
8110
- }
8111
- await $mol_wire_async(A).a();
8112
- $mol_assert_equal(A.instances.length, 2);
8113
- $mol_assert_equal(A.instances[0] instanceof A, true);
8114
- $mol_assert_equal(A.instances[0], A.instances[1]);
8115
- }
8116
- });
8117
- })($ || ($ = {}));
8118
-
8119
- ;
8120
- "use strict";
8121
- var $;
8122
- (function ($_1) {
8123
- $mol_test_mocks.push($ => {
8124
- $.$mol_log3_come = () => { };
8125
- $.$mol_log3_done = () => { };
8126
- $.$mol_log3_fail = () => { };
8127
- $.$mol_log3_warn = () => { };
8128
- $.$mol_log3_rise = () => { };
8129
- $.$mol_log3_area = () => () => { };
8130
- });
8131
- })($ || ($ = {}));
8132
-
8133
- ;
8134
- "use strict";
8135
- var $;
8136
- (function ($_1) {
8137
- $mol_test({
8138
- async 'exec timeout auto kill child process'($) {
8139
- let close_mock = () => { };
8140
- const error_message = 'Run error, timeout';
8141
- function mol_run_spawn_sync_mock() {
8142
- return {
8143
- output: [],
8144
- stdout: error_message,
8145
- stderr: '',
8146
- status: 0,
8147
- signal: null,
8148
- pid: 123,
8149
- };
8150
- }
8151
- function mol_run_spawn_mock() {
8152
- return {
8153
- on(name, cb) {
8154
- if (name === 'exit')
8155
- close_mock = cb;
8156
- },
8157
- kill() { close_mock(); }
8158
- };
8159
- }
8160
- const context_mock = $.$mol_ambient({
8161
- $mol_run_spawn_sync: mol_run_spawn_sync_mock,
8162
- $mol_run_spawn: mol_run_spawn_mock
8163
- });
8164
- class $mol_run_mock extends $mol_run {
8165
- static get $() { return context_mock; }
8166
- static async_enabled() {
8167
- return true;
8168
- }
8169
- }
8170
- let message = '';
8171
- try {
8172
- const res = await $mol_wire_async($mol_run_mock).spawn({
8173
- command: 'sleep 10',
8174
- dir: '.',
8175
- timeout: 10,
8176
- env: { 'MOL_RUN_ASYNC': '1' }
8177
- });
8178
- }
8179
- catch (e) {
8180
- message = e.message;
8181
- }
8182
- $mol_assert_equal(message, error_message);
8183
- }
8184
- });
8185
- })($ || ($ = {}));
8186
-
8187
8002
  ;
8188
8003
  "use strict";
8189
8004
  var $;
@@ -8245,6 +8060,15 @@ var $;
8245
8060
  ;
8246
8061
  "use strict";
8247
8062
 
8063
+ ;
8064
+ "use strict";
8065
+
8066
+ ;
8067
+ "use strict";
8068
+
8069
+ ;
8070
+ "use strict";
8071
+
8248
8072
  ;
8249
8073
  "use strict";
8250
8074
  var $;
@@ -9003,24 +8827,58 @@ var $;
9003
8827
  ;
9004
8828
  "use strict";
9005
8829
  var $;
9006
- (function ($) {
9007
- $mol_test({
9008
- 'get'() {
9009
- const proxy = $mol_delegate({}, () => ({ foo: 777 }));
9010
- $mol_assert_equal(proxy.foo, 777);
9011
- },
9012
- 'has'() {
9013
- const proxy = $mol_delegate({}, () => ({ foo: 777 }));
9014
- $mol_assert_equal('foo' in proxy, true);
9015
- },
9016
- 'set'() {
9017
- const target = { foo: 777 };
9018
- const proxy = $mol_delegate({}, () => target);
9019
- proxy.foo = 123;
9020
- $mol_assert_equal(target.foo, 123);
9021
- },
9022
- 'getOwnPropertyDescriptor'() {
9023
- const proxy = $mol_delegate({}, () => ({ foo: 777 }));
8830
+ (function ($_1) {
8831
+ $mol_test_mocks.push($ => {
8832
+ $.$mol_log3_come = () => { };
8833
+ $.$mol_log3_done = () => { };
8834
+ $.$mol_log3_fail = () => { };
8835
+ $.$mol_log3_warn = () => { };
8836
+ $.$mol_log3_rise = () => { };
8837
+ $.$mol_log3_area = () => () => { };
8838
+ });
8839
+ })($ || ($ = {}));
8840
+
8841
+ ;
8842
+ "use strict";
8843
+
8844
+ ;
8845
+ "use strict";
8846
+
8847
+ ;
8848
+ "use strict";
8849
+ var $;
8850
+ (function ($_1) {
8851
+ $mol_test({
8852
+ 'FQN of anon function'($) {
8853
+ const $$ = Object.assign($, { $mol_func_name_test: (() => () => { })() });
8854
+ $mol_assert_equal($$.$mol_func_name_test.name, '');
8855
+ $mol_assert_equal($$.$mol_func_name($$.$mol_func_name_test), '$mol_func_name_test');
8856
+ $mol_assert_equal($$.$mol_func_name_test.name, '$mol_func_name_test');
8857
+ },
8858
+ });
8859
+ })($ || ($ = {}));
8860
+
8861
+ ;
8862
+ "use strict";
8863
+ var $;
8864
+ (function ($) {
8865
+ $mol_test({
8866
+ 'get'() {
8867
+ const proxy = $mol_delegate({}, () => ({ foo: 777 }));
8868
+ $mol_assert_equal(proxy.foo, 777);
8869
+ },
8870
+ 'has'() {
8871
+ const proxy = $mol_delegate({}, () => ({ foo: 777 }));
8872
+ $mol_assert_equal('foo' in proxy, true);
8873
+ },
8874
+ 'set'() {
8875
+ const target = { foo: 777 };
8876
+ const proxy = $mol_delegate({}, () => target);
8877
+ proxy.foo = 123;
8878
+ $mol_assert_equal(target.foo, 123);
8879
+ },
8880
+ 'getOwnPropertyDescriptor'() {
8881
+ const proxy = $mol_delegate({}, () => ({ foo: 777 }));
9024
8882
  $mol_assert_like(Object.getOwnPropertyDescriptor(proxy, 'foo'), {
9025
8883
  value: 777,
9026
8884
  writable: true,
@@ -9495,6 +9353,88 @@ var $;
9495
9353
  });
9496
9354
  })($ || ($ = {}));
9497
9355
 
9356
+ ;
9357
+ "use strict";
9358
+ var $;
9359
+ (function ($_1) {
9360
+ $mol_test({
9361
+ 'test types'($) {
9362
+ class A {
9363
+ static a() {
9364
+ return '';
9365
+ }
9366
+ static b() {
9367
+ return $mol_wire_async(this).a();
9368
+ }
9369
+ }
9370
+ },
9371
+ async 'Latest method calls wins'($) {
9372
+ class NameLogger extends $mol_object2 {
9373
+ static $ = $;
9374
+ static first = [];
9375
+ static last = [];
9376
+ static send(next) {
9377
+ $mol_wire_sync(this.first).push(next);
9378
+ $$.$mol_wait_timeout(0);
9379
+ this.last.push(next);
9380
+ }
9381
+ }
9382
+ const name = $mol_wire_async(NameLogger).send;
9383
+ name('john');
9384
+ const promise = name('jin');
9385
+ $.$mol_after_mock_warp();
9386
+ await promise;
9387
+ $mol_assert_equal(NameLogger.first, ['john', 'jin']);
9388
+ $mol_assert_equal(NameLogger.last, ['jin']);
9389
+ },
9390
+ async 'Latest function calls wins'($) {
9391
+ const first = [];
9392
+ const last = [];
9393
+ function send_name(next) {
9394
+ $mol_wire_sync(first).push(next);
9395
+ $$.$mol_wait_timeout(0);
9396
+ last.push(next);
9397
+ }
9398
+ const name = $mol_wire_async(send_name);
9399
+ name('john');
9400
+ const promise = name('jin');
9401
+ $.$mol_after_mock_warp();
9402
+ await promise;
9403
+ $mol_assert_equal(first, ['john', 'jin']);
9404
+ $mol_assert_equal(last, ['jin']);
9405
+ },
9406
+ });
9407
+ })($ || ($ = {}));
9408
+
9409
+ ;
9410
+ "use strict";
9411
+ var $;
9412
+ (function ($_1) {
9413
+ $mol_test({
9414
+ 'init with overload'() {
9415
+ class X extends $mol_object {
9416
+ foo() {
9417
+ return 1;
9418
+ }
9419
+ }
9420
+ var x = X.make({
9421
+ foo: () => 2,
9422
+ });
9423
+ $mol_assert_equal(x.foo(), 2);
9424
+ },
9425
+ 'Context in instance inherits from class'($) {
9426
+ const custom = $.$mol_ambient({});
9427
+ class X extends $.$mol_object {
9428
+ static $ = custom;
9429
+ }
9430
+ $mol_assert_equal(new X().$, custom);
9431
+ },
9432
+ });
9433
+ })($ || ($ = {}));
9434
+
9435
+ ;
9436
+ "use strict";
9437
+
9498
9438
  ;
9499
9439
  "use strict";
9500
9440
  var $;
@@ -9526,6 +9466,59 @@ var $;
9526
9466
  });
9527
9467
  })($ || ($ = {}));
9528
9468
 
9469
+ ;
9470
+ "use strict";
9471
+ var $;
9472
+ (function ($_1) {
9473
+ $mol_test({
9474
+ 'test types'($) {
9475
+ class A {
9476
+ static a() {
9477
+ return Promise.resolve('');
9478
+ }
9479
+ static b() {
9480
+ return $mol_wire_sync(this).a();
9481
+ }
9482
+ }
9483
+ },
9484
+ async 'test method from host'($) {
9485
+ let count = 0;
9486
+ class A {
9487
+ static a() {
9488
+ return $mol_wire_sync(this).b();
9489
+ }
9490
+ static b() { return Promise.resolve(++count); }
9491
+ }
9492
+ $mol_assert_equal(await $mol_wire_async(A).a(), 1, count);
9493
+ },
9494
+ async 'test function'($) {
9495
+ let count = 0;
9496
+ class A {
9497
+ static a() {
9498
+ return $mol_wire_sync(this.b)();
9499
+ }
9500
+ static b() { return Promise.resolve(++count); }
9501
+ }
9502
+ $mol_assert_equal(await $mol_wire_async(A).a(), 1, count);
9503
+ },
9504
+ async 'test construct itself'($) {
9505
+ class A {
9506
+ static instances = [];
9507
+ static a() {
9508
+ const a = new ($mol_wire_sync(A))();
9509
+ this.instances.push(a);
9510
+ $mol_wire_sync(this).b();
9511
+ }
9512
+ static b() { return Promise.resolve(); }
9513
+ }
9514
+ await $mol_wire_async(A).a();
9515
+ $mol_assert_equal(A.instances.length, 2);
9516
+ $mol_assert_equal(A.instances[0] instanceof A, true);
9517
+ $mol_assert_equal(A.instances[0], A.instances[1]);
9518
+ }
9519
+ });
9520
+ })($ || ($ = {}));
9521
+
9529
9522
  ;
9530
9523
  "use strict";
9531
9524
  var $;
@@ -9619,62 +9612,6 @@ var $;
9619
9612
  })($$ = $_1.$$ || ($_1.$$ = {}));
9620
9613
  })($ || ($ = {}));
9621
9614
 
9622
- ;
9623
- "use strict";
9624
- var $;
9625
- (function ($_1) {
9626
- $mol_test({
9627
- 'test types'($) {
9628
- class A {
9629
- static a() {
9630
- return '';
9631
- }
9632
- static b() {
9633
- return $mol_wire_async(this).a();
9634
- }
9635
- }
9636
- },
9637
- async 'Latest method calls wins'($) {
9638
- class NameLogger extends $mol_object2 {
9639
- static $ = $;
9640
- static first = [];
9641
- static last = [];
9642
- static send(next) {
9643
- $mol_wire_sync(this.first).push(next);
9644
- $$.$mol_wait_timeout(0);
9645
- this.last.push(next);
9646
- }
9647
- }
9648
- const name = $mol_wire_async(NameLogger).send;
9649
- name('john');
9650
- const promise = name('jin');
9651
- $.$mol_after_mock_warp();
9652
- await promise;
9653
- $mol_assert_equal(NameLogger.first, ['john', 'jin']);
9654
- $mol_assert_equal(NameLogger.last, ['jin']);
9655
- },
9656
- async 'Latest function calls wins'($) {
9657
- const first = [];
9658
- const last = [];
9659
- function send_name(next) {
9660
- $mol_wire_sync(first).push(next);
9661
- $$.$mol_wait_timeout(0);
9662
- last.push(next);
9663
- }
9664
- const name = $mol_wire_async(send_name);
9665
- name('john');
9666
- const promise = name('jin');
9667
- $.$mol_after_mock_warp();
9668
- await promise;
9669
- $mol_assert_equal(first, ['john', 'jin']);
9670
- $mol_assert_equal(last, ['jin']);
9671
- },
9672
- });
9673
- })($ || ($ = {}));
9674
-
9675
- ;
9676
- "use strict";
9677
-
9678
9615
  ;
9679
9616
  "use strict";
9680
9617
  var $;
@@ -10359,6 +10296,93 @@ var $;
10359
10296
  });
10360
10297
  })($ || ($ = {}));
10361
10298
 
10299
+ ;
10300
+ "use strict";
10301
+ var $;
10302
+ (function ($) {
10303
+ $mol_test({
10304
+ 'auto name'() {
10305
+ class Invalid extends $mol_error_mix {
10306
+ }
10307
+ const mix = new Invalid('foo');
10308
+ $mol_assert_equal(mix.name, 'Invalid_Error');
10309
+ },
10310
+ 'simpe mix'() {
10311
+ const mix = new $mol_error_mix('foo', {}, new Error('bar'), new Error('lol'));
10312
+ $mol_assert_equal(mix.message, 'foo');
10313
+ $mol_assert_equal(mix.errors.map(e => e.message), ['bar', 'lol']);
10314
+ },
10315
+ 'provide additional info'() {
10316
+ class Invalid extends $mol_error_mix {
10317
+ }
10318
+ const mix = new $mol_error_mix('Wrong password', {}, new Invalid('Too short', { value: 'p@ssw0rd', hint: '> 8 letters' }), new Invalid('Too simple', { value: 'p@ssw0rd', hint: 'need capital letter' }));
10319
+ const hints = [];
10320
+ if (mix instanceof $mol_error_mix) {
10321
+ for (const er of mix.errors) {
10322
+ if (er instanceof Invalid) {
10323
+ hints.push(er.cause?.hint ?? '');
10324
+ }
10325
+ }
10326
+ }
10327
+ $mol_assert_equal(hints, ['> 8 letters', 'need capital letter']);
10328
+ },
10329
+ });
10330
+ })($ || ($ = {}));
10331
+
10332
+ ;
10333
+ "use strict";
10334
+ var $;
10335
+ (function ($_1) {
10336
+ $mol_test({
10337
+ async 'exec timeout auto kill child process'($) {
10338
+ let close_mock = () => { };
10339
+ const error_message = 'Run error, timeout';
10340
+ function mol_run_spawn_sync_mock() {
10341
+ return {
10342
+ output: [],
10343
+ stdout: error_message,
10344
+ stderr: '',
10345
+ status: 0,
10346
+ signal: null,
10347
+ pid: 123,
10348
+ };
10349
+ }
10350
+ function mol_run_spawn_mock() {
10351
+ return {
10352
+ on(name, cb) {
10353
+ if (name === 'exit')
10354
+ close_mock = cb;
10355
+ },
10356
+ kill() { close_mock(); }
10357
+ };
10358
+ }
10359
+ const context_mock = $.$mol_ambient({
10360
+ $mol_run_spawn_sync: mol_run_spawn_sync_mock,
10361
+ $mol_run_spawn: mol_run_spawn_mock
10362
+ });
10363
+ class $mol_run_mock extends $mol_run {
10364
+ static get $() { return context_mock; }
10365
+ static async_enabled() {
10366
+ return true;
10367
+ }
10368
+ }
10369
+ let message = '';
10370
+ try {
10371
+ const res = await $mol_wire_async($mol_run_mock).spawn({
10372
+ command: 'sleep 10',
10373
+ dir: '.',
10374
+ timeout: 10,
10375
+ env: { 'MOL_RUN_ASYNC': '1' }
10376
+ });
10377
+ }
10378
+ catch (e) {
10379
+ message = e.message;
10380
+ }
10381
+ $mol_assert_equal(message, error_message);
10382
+ }
10383
+ });
10384
+ })($ || ($ = {}));
10385
+
10362
10386
  ;
10363
10387
  "use strict";
10364
10388