Failing test
This commit is contained in:
parent
bbd14f88c4
commit
902d04b8f1
26
packages/babel-traverse/test/evaluation.js
Normal file
26
packages/babel-traverse/test/evaluation.js
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
var traverse = require("../lib").default;
|
||||||
|
var assert = require("assert");
|
||||||
|
var parse = require("babylon").parse;
|
||||||
|
|
||||||
|
function getPath(code) {
|
||||||
|
var ast = parse(code);
|
||||||
|
var path;
|
||||||
|
traverse(ast, {
|
||||||
|
Program: function (_path) {
|
||||||
|
path = _path;
|
||||||
|
_path.stop();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
suite("evaluation", function () {
|
||||||
|
suite("evaluateTruthy", function () {
|
||||||
|
test("it should work with null", function () {
|
||||||
|
assert.strictEqual(
|
||||||
|
getPath("false || a.length === 0;").get("body")[0].evaluateTruthy(),
|
||||||
|
false
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
Loading…
x
Reference in New Issue
Block a user