Skip to content

Commit

Permalink
chore: update 'acorn-eventual-send' package to use AVA for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
warner committed Aug 21, 2020
1 parent f87f907 commit c976ebb
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 48 deletions.
16 changes: 11 additions & 5 deletions packages/acorn-eventual-send/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@
"main": "index.js",
"scripts": {
"build": "exit 0",
"test": "tape -r esm 'test/**/*.js'",
"test": "ava",
"lint-fix": "eslint --fix '**/*.js'",
"lint-check": "eslint '**/*.js'"
},
"devDependencies": {
"acorn": "^7.1.0",
"ava": "^3.11.1",
"esm": "^3.2.25",
"rollup": "^1.16.7",
"tap-spec": "^5.0.0",
"tape": "^4.9.2",
"tape-promise": "^4.0.0"
"rollup": "^1.16.7"
},
"keywords": [],
"files": [
Expand All @@ -33,5 +31,13 @@
"homepage": "https://github.com/acorn-eventual-send#readme",
"publishConfig": {
"access": "public"
},
"ava": {
"files": [
"test/**/test-*.js"
],
"require": [
"esm"
]
}
}
23 changes: 23 additions & 0 deletions packages/acorn-eventual-send/test/test-parser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import test from 'ava';
import * as acorn from 'acorn';
import eventualSend from '..';

test('parser', async t => {
const MyParser = acorn.Parser.extend(eventualSend(acorn));
const parser = src => MyParser.parse(src);

// FIXME: Compare parse trees.
t.truthy(parser('x ~. p(y, z, q)'), 'post');
t.truthy(parser('x ~. [i](y, z)'), 'computed post');
t.truthy(parser('x ~. (y, z)'), 'apply');
t.truthy(parser('x ~. ()'), 'apply nothing');
t.truthy(parser('x ~. p'), 'get');
t.truthy(parser('x ~. [i]'), 'computed get');
t.truthy(parser('x ~. p = v'), 'put');
t.truthy(parser('x ~. [i] = v'), 'computed put');
t.truthy(parser('delete x ~. p'), 'delete');
t.truthy(parser('delete x ~.[p]'), 'computed delete');
t.truthy(parser('x~.\n p'), 'no asi');
t.truthy(parser('x\n /* foo */ ~.p'), 'no asi2');
t.truthy(parser('x~.p~.()'), 'chained get/post');
});
22 changes: 8 additions & 14 deletions packages/acorn-eventual-send/test/test-rollup.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
import { test } from 'tape-promise/tape';
import test from 'ava';
import { rollup } from 'rollup/dist/rollup.es';
import * as acorn from 'acorn';
import eventualSend from '..';

test('SwingSet bug', async t => {
try {
const bundle = await rollup({
input: require.resolve('../encouragementBotCommsWavyDot/bootstrap.js'),
treeshake: false,
external: [],
acornInjectPlugins: [eventualSend(acorn)],
});
t.ok(bundle);
} catch (e) {
t.isNot(e, e, 'unexpected exception');
} finally {
t.end();
}
const bundle = await rollup({
input: require.resolve('../encouragementBotCommsWavyDot/bootstrap.js'),
treeshake: false,
external: [],
acornInjectPlugins: [eventualSend(acorn)],
});
t.truthy(bundle);
});
29 changes: 0 additions & 29 deletions packages/acorn-eventual-send/test/test.js

This file was deleted.

0 comments on commit c976ebb

Please sign in to comment.