@agoric/internal 0.3.3-dev-07cb543.0 → 0.3.3-dev-c605745.0
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/internal",
|
|
3
|
-
"version": "0.3.3-dev-
|
|
3
|
+
"version": "0.3.3-dev-c605745.0+c605745",
|
|
4
4
|
"description": "Externally unsupported utilities internal to agoric-sdk",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"lint:types": "tsc"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@agoric/base-zone": "0.1.1-dev-
|
|
23
|
+
"@agoric/base-zone": "0.1.1-dev-c605745.0+c605745",
|
|
24
24
|
"@endo/common": "^1.2.9",
|
|
25
25
|
"@endo/errors": "^1.2.9",
|
|
26
26
|
"@endo/far": "^1.1.10",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"jessie.js": "^0.3.4"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@agoric/cosmic-proto": "0.4.1-dev-
|
|
37
|
+
"@agoric/cosmic-proto": "0.4.1-dev-c605745.0+c605745",
|
|
38
38
|
"@endo/exo": "^1.5.8",
|
|
39
39
|
"@endo/init": "^1.1.8",
|
|
40
40
|
"ava": "^5.3.0",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"typeCoverage": {
|
|
61
61
|
"atLeast": 93.04
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "c605745ee6619292b51cec5fc0db0a25ff1b203c"
|
|
64
64
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {ExecutionContext, Macro, TestFn} from 'ava';
|
|
3
|
+
*/
|
|
4
|
+
export const AVA_EXPECT_UNHANDLED_REJECTIONS: "AGORIC_AVA_EXPECT_UNHANDLED_REJECTIONS";
|
|
5
|
+
export const SUBTEST_PREFIX: "(unhandled rejection subprocess): ";
|
|
6
|
+
export function makeExpectUnhandledRejection<C>({ test, importMetaUrl }: {
|
|
7
|
+
test: TestFn<C>;
|
|
8
|
+
importMetaUrl: string;
|
|
9
|
+
}): (expectedUnhandled: number) => Macro<[name: string, impl: (t: ExecutionContext<C>) => any], C>;
|
|
10
|
+
import type { TestFn } from 'ava';
|
|
11
|
+
import type { ExecutionContext } from 'ava';
|
|
12
|
+
import type { Macro } from 'ava';
|
|
13
|
+
//# sourceMappingURL=ava-unhandled-rejection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ava-unhandled-rejection.d.ts","sourceRoot":"","sources":["ava-unhandled-rejection.js"],"names":[],"mappings":"AAOA;;GAEG;AAEH,8CACE,wCAAwC,CAAC;AAE3C,6BAA8B,oCAAoC,CAAC;AAW5D,6CARM,CAAC,2BAEX;IAA0B,IAAI,EAAtB,OAAO,CAAC,CAAC;IACM,aAAa,EAA5B,MAAM;CACd,GAAU,CACR,iBAAiB,EAAE,MAAM,KACtB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC,CA0CtE;4BAzDiD,KAAK;sCAAL,KAAK;2BAAL,KAAK"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
import { spawn } from 'child_process';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
|
|
5
|
+
import engineGC from './engine-gc.js';
|
|
6
|
+
import { makeGcAndFinalize } from './gc-and-finalize.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @import {ExecutionContext, Macro, TestFn} from 'ava';
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export const AVA_EXPECT_UNHANDLED_REJECTIONS =
|
|
13
|
+
'AGORIC_AVA_EXPECT_UNHANDLED_REJECTIONS';
|
|
14
|
+
|
|
15
|
+
export const SUBTEST_PREFIX = '(unhandled rejection subprocess): ';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @template C
|
|
19
|
+
* @param {object} powers
|
|
20
|
+
* @param {TestFn<C>} powers.test
|
|
21
|
+
* @param {string} powers.importMetaUrl
|
|
22
|
+
* @returns {(
|
|
23
|
+
* expectedUnhandled: number,
|
|
24
|
+
* ) => Macro<[name: string, impl: (t: ExecutionContext<C>) => any], C>}
|
|
25
|
+
*/
|
|
26
|
+
export const makeExpectUnhandledRejection = ({ test, importMetaUrl }) => {
|
|
27
|
+
const self = fileURLToPath(importMetaUrl);
|
|
28
|
+
const gcAndFinalize = makeGcAndFinalize(engineGC);
|
|
29
|
+
|
|
30
|
+
if (process.env[AVA_EXPECT_UNHANDLED_REJECTIONS]) {
|
|
31
|
+
return _expectedUnhandled =>
|
|
32
|
+
test.macro({
|
|
33
|
+
title: (_, name, _impl) => SUBTEST_PREFIX + name,
|
|
34
|
+
exec: async (t, _name, impl) => {
|
|
35
|
+
await null;
|
|
36
|
+
try {
|
|
37
|
+
const result = await impl(t);
|
|
38
|
+
return result;
|
|
39
|
+
} finally {
|
|
40
|
+
await gcAndFinalize();
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return expectedUnhandled =>
|
|
47
|
+
test.macro({
|
|
48
|
+
title: (_, name, _impl) => name,
|
|
49
|
+
exec: async (t, name, _impl) =>
|
|
50
|
+
new Promise((resolve, reject) => {
|
|
51
|
+
const ps = spawn('ava', [self, '-m', SUBTEST_PREFIX + name], {
|
|
52
|
+
env: {
|
|
53
|
+
...process.env,
|
|
54
|
+
[AVA_EXPECT_UNHANDLED_REJECTIONS]: `${expectedUnhandled}`,
|
|
55
|
+
},
|
|
56
|
+
stdio: ['ignore', 'inherit', 'inherit', 'ignore'],
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
ps.on('close', code => {
|
|
60
|
+
t.is(code, 0, `got exit code ${code}, expected 0 for ${name}`);
|
|
61
|
+
resolve();
|
|
62
|
+
});
|
|
63
|
+
ps.on('error', reject);
|
|
64
|
+
}),
|
|
65
|
+
});
|
|
66
|
+
};
|