fix: travis

This commit is contained in:
harttle
2018-08-27 23:49:11 +08:00
parent 5378f2709b
commit c3c57a560b
9 changed files with 55 additions and 60 deletions
+4 -2
View File
@@ -2,10 +2,12 @@ language: node_js
node_js:
- "8"
- "6"
- "4"
- "0.12"
before_script:
- npm install -g mocha
after_script:
- npm run test
- if [[ $(echo "$TRAVIS_NODE_VERSION >= 6" | bc -l) ]]; then npm run test; fi
- npm run e2e
after_success:
- npm run coveralls
- if [[ $(echo "$TRAVIS_NODE_VERSION >= 6" | bc -l) ]]; then npm run coveralls; fi
+45 -48
View File
@@ -1282,50 +1282,11 @@ function statFileAsync(path$$1) {
});
}
function lookup(filepath, root, options) {
var _this = this;
root = options.root.concat(root || []);
root = uniq(root);
var paths = root.map(function (root) {
return path.resolve(root || location.href, filepath);
});
return anySeries(paths, function () {
var _ref = asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(path$$1) {
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.prev = 0;
_context.next = 3;
return statFileAsync(path$$1);
case 3:
return _context.abrupt('return', path$$1);
case 6:
_context.prev = 6;
_context.t0 = _context['catch'](0);
_context.t0.message = _context.t0.code + ': Failed to lookup ' + filepath + ' in: ' + root;
throw _context.t0;
case 10:
case 'end':
return _context.stop();
}
}
}, _callee, _this, [[0, 6]]);
}));
return function (_x) {
return _ref.apply(this, arguments);
};
}());
}
var resolve = function () {
var _ref2 = asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(filepath, root, options) {
var _ref = asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(filepath, root, options) {
var _this = this;
var paths;
return regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
@@ -1333,9 +1294,45 @@ var resolve = function () {
if (!path.extname(filepath)) {
filepath += options.extname;
}
return _context2.abrupt('return', lookup(filepath, root, options));
root = options.root.concat(root || []);
root = uniq(root);
paths = root.map(function (root) {
return path.resolve(root, filepath);
});
return _context2.abrupt('return', anySeries(paths, function () {
var _ref2 = asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(path$$1) {
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.prev = 0;
_context.next = 3;
return statFileAsync(path$$1);
case 2:
case 3:
return _context.abrupt('return', path$$1);
case 6:
_context.prev = 6;
_context.t0 = _context['catch'](0);
_context.t0.message = _context.t0.code + ': Failed to lookup ' + filepath + ' in: ' + root;
throw _context.t0;
case 10:
case 'end':
return _context.stop();
}
}
}, _callee, _this, [[0, 6]]);
}));
return function (_x4) {
return _ref2.apply(this, arguments);
};
}()));
case 5:
case 'end':
return _context2.stop();
}
@@ -1343,8 +1340,8 @@ var resolve = function () {
}, _callee2, this);
}));
return function resolve(_x2, _x3, _x4) {
return _ref2.apply(this, arguments);
return function resolve(_x, _x2, _x3) {
return _ref.apply(this, arguments);
};
}();
@@ -3583,7 +3580,7 @@ var _engine = {
function normalizeStringArray(value) {
if (isArray(value)) return value;
if (isString(value)) return [value];
return [];
throw new TypeError('illegal root: ' + value);
}
function Liquid(options) {
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -3526,7 +3526,7 @@
function normalizeStringArray(value) {
if (isArray(value)) return value;
if (isString(value)) return [value];
return [];
throw new TypeError('illegal root: ' + value);
}
function Liquid(options) {
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -9,7 +9,7 @@
"lint": "eslint src/ test/ *.js",
"dev": "mocha test/unit",
"test": "cross-env NODE_ENV=test nyc --reporter=html mocha test/unit",
"e2e": "npm run dist && mocha test/e2e",
"e2e": "mocha test/e2e",
"coveralls": "nyc report --reporter=text-lcov | coveralls",
"dist": "rollup -c && ls -lh dist",
"demo:browser": "echo open http://localhost:8080/demo/browser && http-server -c-1",
-4
View File
@@ -24,10 +24,6 @@ describe('#renderFile()', function () {
afterEach(function () {
mock.restore()
})
it('should ignore invalid root option', function () {
var liquid = Liquid({ root: /regex/ })
expect(liquid.options.root).to.deep.equal([])
})
it('should render file', function () {
return expect(engine.renderFile('/root/files/foo.html', {}))
.to.eventually.equal('foo')