Skip to content

Commit

Permalink
fix: some attempted repairs
Browse files Browse the repository at this point in the history
  • Loading branch information
erights committed Jan 12, 2021
1 parent 55c9096 commit 2885eed
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 5 deletions.
4 changes: 4 additions & 0 deletions packages/ses-ava/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"trailingComma": "all",
"singleQuote": true
}
11 changes: 11 additions & 0 deletions packages/ses-ava/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"compilerOptions": {
"target": "es2020",
"module": "esnext",
"noEmit": true,
"downlevelIteration": true,
"strictNullChecks": true,
"moduleResolution": "node"
},
"include": ["src/**/*.js"]
}
29 changes: 24 additions & 5 deletions packages/ses-ava/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@agoric/ses-ava",
"version": "0.0.0+1-dev",
"description": "Description forthcoming.",
"description": "Virtualize Ava's test to work better under SES.",
"author": "Agoric",
"license": "Apache-2.0",
"type": "module",
Expand All @@ -22,12 +22,31 @@
"prepublish": "yarn clean && yarn build",
"test": "yarn build && tap --no-esm --no-coverage --reporter spec test/**/*.test.js"
},
"dependencies": {},
"dependencies": {
"ses": "^0.11.0",
"ava": "^3.12.1"
},
"devDependencies": {
"@agoric/eslint-config": "^0.1.0",
"@rollup/plugin-commonjs": "^13.0.0",
"@rollup/plugin-node-resolve": "^6.1.0",
"rollup-plugin-terser": "^5.1.3",
"tap": "14.10.5",
"tape": "5.0.1"
"prettier": "^1.19.1",
"rollup-plugin-terser": "^5.1.3"
},
"ava": {
"files": [
"*test*/**/*.test.js"
],
"require": []
},
"eslintConfig": {
"extends": [
"@agoric"
]
},
"prettier": {
"trailingComma": "all",
"singleQuote": true
},
"files": [
"LICENSE*",
Expand Down
3 changes: 3 additions & 0 deletions packages/ses-ava/src/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { test } from './ses-ava-test';

export default test;
30 changes: 30 additions & 0 deletions packages/ses-ava/src/ses-ava-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import test from 'ava';

const avaTest = test;

const testWrapper = (title, testFunc) => {
const testFuncWrapper = t => {
harden(t);
let result;
try {
result = testFunc(t);
} catch (err) {
console.log('THROWN from ava test:', err);
throw err;
}
if (Promise.resolve(result) === result) {
return result.then(
v => v,
reason => {
console.log('REJECTED from ava test:', reason);
return result;
},
);
} else {
return result;
}
};
return avaTest(title, testFuncWrapper);
};
harden(testWrapper);
export { testWrapper as test };

0 comments on commit 2885eed

Please sign in to comment.