Skip to content

Commit

Permalink
use stdin stream and api test
Browse files Browse the repository at this point in the history
Update package.json
  • Loading branch information
vigneshshanmugam authored and boopathi committed Aug 11, 2017
1 parent 7d8ee55 commit 82dfd83
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
6 changes: 1 addition & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,5 @@
},
"workspaces": [
"packages/*"
],
"dependencies": {
"mkdirp": "^0.5.1",
"util.promisify": "^1.0.0"
}
]
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Babili Node API override default babili options 1`] = `"function foo(){const bar=x(1),baz=y(2);return z(bar,baz)}"`;

exports[`Babili Node API simple usage 1`] = `"function foo(){const a=x(1),b=y(2);return z(a,b)}"`;
6 changes: 1 addition & 5 deletions packages/babili/__tests__/cli-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ jest.autoMockOff();

const { spawn } = require("child_process");
const path = require("path");
const { Readable } = require("stream");
const fs = require("fs");
const promisify = require("util.promisify");
const rimraf = require("rimraf");
Expand All @@ -20,10 +19,7 @@ function runCli(args = [], stdin) {
});

if (stdin) {
const s = new Readable();
s.push(stdin);
s.push(null);
s.pipe(child.stdin);
child.stdin.end(stdin);
}

let stdout = "";
Expand Down
5 changes: 5 additions & 0 deletions packages/babili/__tests__/node-api-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,9 @@ describe("Babili Node API", () => {
it("throw on invalid options", () => {
expect(() => babili(sampleInput, { foo: false, bar: true }).code).toThrow();
});

it("override default babili options", () => {
const babiliOpts = { mangle: false };
expect(babili(sampleInput, babiliOpts).code).toMatchSnapshot();
});
});

0 comments on commit 82dfd83

Please sign in to comment.