Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
59naga committed Aug 19, 2018
1 parent 5f62358 commit 3b284e6
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 12 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"globby": "^8.0.1"
},
"peerDependencies": {
"eastern": "^1.0.1"
"eastern": "^1.0.3"
},
"scripts": {
"start": "abby format, test --watch \"{./,src,test}/**/*.mjs\"",
Expand All @@ -25,7 +25,7 @@
"abigail": "^1.9.5",
"assert-diff": "^2.0.3",
"delay": "^3.0.0",
"eastern": "^1.0.1",
"eastern": "^1.0.3",
"prettier": "^1.14.2"
},
"repository": {
Expand Down
26 changes: 21 additions & 5 deletions src/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import chopsticks from "chopsticks";
import globby from "globby";
import { resolve } from "url";

import Reporter from "eastern/src/reporter";
import Describe from "eastern/src/describe";
import usage from "./usage";

process.on("unhandledRejection", function(error, promise) {
Expand All @@ -29,13 +31,27 @@ process.on("unhandledRejection", function(error, promise) {

const globs = args._.length ? args._ : ["test.mjs", "test/**/*.mjs"];
const paths = await globby(globs);
const { default: it, describe } = await import("eastern");

global.spec = it;
global.it = it;
global.describe = describe;
const reporter = new Reporter();
const root = new Describe(null, { reporter, immediate: false });

Promise.each(paths, path => {
global.spec = root.block;
global.it = root.block;
global.describe = root.block.describe;

await Promise.each(paths, path => {
return import(new URL(path, new URL(`file://${process.cwd()}/`)));
});

console.log("");
root.evaluateBlock();

await root.finish;
if (!reporter.isComplete(root.count())) {
reporter.outputResult();
reporter.outputFailures();
process.exit(1);
}
reporter.outputResult();
console.log("");
})();
4 changes: 2 additions & 2 deletions test/mixin/expected.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export const code = 1;
export const stdout = `
1
1-before
- 1-1
- 1-2
1-before
- 1-notonly-1
1-beforeEach
✓ 1-only-1 (ELAPSED ms)
Expand All @@ -13,9 +13,9 @@ export const stdout = `
1-afterEach
2
3
3-before
- 3-1
- 3-2
3-before
- 3-notonly-1
3-beforeEach
✓ 3-only-1 (ELAPSED ms)
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -334,9 +334,9 @@ dreamopt@~0.6.0:
dependencies:
wordwrap ">=0.0.2"

eastern@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/eastern/-/eastern-1.0.1.tgz#27e9c7446e7e09deda8ac31cb64e90fc863f3d10"
eastern@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/eastern/-/eastern-1.0.3.tgz#67ac679c90616d6a1280399d1e889b6d24a41134"
dependencies:
bluebird "^3.5.1"
chalk "^2.4.1"
Expand Down

0 comments on commit 3b284e6

Please sign in to comment.