Skip to content

Commit bf407ae

Browse files
committed
fix: variation of 555 test with deep stacks
1 parent 48d4813 commit bf407ae

File tree

3 files changed

+77
-0
lines changed

3 files changed

+77
-0
lines changed

packages/eventual-send/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"devDependencies": {
2929
"@agoric/assert": "^0.2.2",
3030
"@agoric/install-ses": "^0.5.2",
31+
"@agoric/ses-ava": "^0.1.0+1-dev",
3132
"ava": "^3.12.1",
3233
"esm": "^3.2.7",
3334
"nyc": "^15.1.0",
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import { wrapTest } from '@agoric/ses-ava';
2+
import '@agoric/install-ses';
3+
import rawTest from 'ava';
4+
// import { E } from './get-hp';
5+
6+
// This file is a variation of the `test-ses-ava-reject` from the
7+
// `@agoric/ses-ava` package. The difference is that this test
8+
// uses `E.when` rather than `then` to demonstrate deep stacks.
9+
10+
const test = wrapTest(rawTest);
11+
12+
test('ses-ava reject console output', t => {
13+
t.assert(true);
14+
// Uncomment this to see something like the text in the extended comment below
15+
16+
/*
17+
return E.when(Promise.resolve(null), v1 =>
18+
E.when(v1, v2 =>
19+
E.when(v2, _ => {
20+
assert.typeof(88, 'string', assert.details`msg ${'NOTICE ME'}`);
21+
}),
22+
),
23+
);
24+
*/
25+
});
26+
27+
/*
28+
Uncommenting the test code above should produce something like the following.
29+
Some of this output still comes from ava. The stack-like display comes from
30+
the SES `console`, which shows the detailed error message including the
31+
redacted `'NOTICE ME'` that ava has no access to.
32+
```
33+
REJECTED from ava test: (TypeError#1)
34+
TypeError#1: msg NOTICE ME
35+
at packages/eventual-send/test/test-ses-ava-reject-deep-stacks.js:29:22
36+
37+
TypeError#1 ERROR_NOTE: Thrown from: (Error#2) : 3 . 0
38+
TypeError#1 ERROR_NOTE: Rejection from: (Error#3) : 2 . 1
39+
TypeError#1 ERROR_NOTE: Rejection from: (Error#4) : 1 . 1
40+
Nested 3 errors under TypeError#1
41+
Error#2: Event: 2.1
42+
at packages/eventual-send/test/test-ses-ava-reject-deep-stacks.js:28:9
43+
44+
Error#2 ERROR_NOTE: Caused by: (Error#3)
45+
Nested error under Error#2
46+
Error#3: Event: 1.1
47+
at packages/eventual-send/test/test-ses-ava-reject-deep-stacks.js:27:7
48+
49+
Error#3 ERROR_NOTE: Caused by: (Error#4)
50+
Nested error under Error#3
51+
Error#4: Event: 0.1
52+
at packages/eventual-send/test/test-ses-ava-reject-deep-stacks.js:26:12
53+
at async Promise.all (index 0)
54+
55+
ses-ava reject console output
56+
57+
Rejected promise returned by test. Reason:
58+
59+
TypeError {
60+
message: 'msg (a string)',
61+
}
62+
63+
› packages/eventual-send/test/test-ses-ava-reject-deep-stacks.js:29:22
64+
65+
66+
67+
1 test failed
68+
```
69+
*/

yarn.lock

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@
2929
resolved "https://registry.yarnpkg.com/@agoric/nat/-/nat-4.0.0.tgz#330dcde37fcf8882dbc5012a3b2c4c135eee4930"
3030
integrity sha512-zlTe14g0PGfONO0+TdhLv8k4IZH040ojvBZuNrcQSV+l8HlFTZ/IKzI5HorlCVDDBU7riykAb/6MaTgMRbYp3w==
3131

32+
"@agoric/ses-ava@^0.1.0+1-dev":
33+
version "0.1.0"
34+
resolved "https://registry.yarnpkg.com/@agoric/ses-ava/-/ses-ava-0.1.0.tgz#e6e905167379b42ed6926b7f5bb9f64713c3a436"
35+
integrity sha512-uQcXariKortUFD6AOb2LD5riJW2J1KLFuoIOtXgQcI4aVv33Q33WajNWr5HsY0stGvaqoDvfQ5heGjc3lovIbw==
36+
dependencies:
37+
ses "^0.12.3"
38+
3239
"@agoric/transform-module@^0.4.1":
3340
version "0.4.1"
3441
resolved "https://registry.yarnpkg.com/@agoric/transform-module/-/transform-module-0.4.1.tgz#9fb152364faf372e1bda535cb4ef89717724f57c"

0 commit comments

Comments
 (0)