mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-29 07:05:13 -07:00
feature: get nyc, babel and coveralls working
This commit is contained in:
@@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"presets": ["env"],
|
|
||||||
"plugins": [
|
|
||||||
["transform-runtime", {
|
|
||||||
"helpers": false,
|
|
||||||
"polyfill": false,
|
|
||||||
"regenerator": true,
|
|
||||||
"moduleName": "babel-runtime"
|
|
||||||
}]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -2,7 +2,6 @@ language: node_js
|
|||||||
node_js:
|
node_js:
|
||||||
- "8"
|
- "8"
|
||||||
- "6"
|
- "6"
|
||||||
- "4"
|
|
||||||
before_script:
|
before_script:
|
||||||
- npm install -g mocha
|
- npm install -g mocha
|
||||||
after_script:
|
after_script:
|
||||||
|
|||||||
Vendored
+51
-132
@@ -45,36 +45,6 @@ var asyncToGenerator = function (fn) {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
var classCallCheck = function (instance, Constructor) {
|
|
||||||
if (!(instance instanceof Constructor)) {
|
|
||||||
throw new TypeError("Cannot call a class as a function");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var inherits = function (subClass, superClass) {
|
|
||||||
if (typeof superClass !== "function" && superClass !== null) {
|
|
||||||
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
||||||
}
|
|
||||||
|
|
||||||
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
||||||
constructor: {
|
|
||||||
value: subClass,
|
|
||||||
enumerable: false,
|
|
||||||
writable: true,
|
|
||||||
configurable: true
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
||||||
};
|
|
||||||
|
|
||||||
var possibleConstructorReturn = function (self, call) {
|
|
||||||
if (!self) {
|
|
||||||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
||||||
}
|
|
||||||
|
|
||||||
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2014-present, Facebook, Inc.
|
* Copyright (c) 2014-present, Facebook, Inc.
|
||||||
*
|
*
|
||||||
@@ -877,7 +847,7 @@ function uniq(arr) {
|
|||||||
*/
|
*/
|
||||||
function isObject(value) {
|
function isObject(value) {
|
||||||
var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);
|
var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);
|
||||||
return value != null && (type === 'object' || type === 'function');
|
return value !== null && (type === 'object' || type === 'function');
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -981,117 +951,66 @@ function parseLiteral(str) {
|
|||||||
throw new TypeError('cannot parse \'' + str + '\' as literal');
|
throw new TypeError('cannot parse \'' + str + '\' as literal');
|
||||||
}
|
}
|
||||||
|
|
||||||
var LiquidError = function (_Error) {
|
function initError() {
|
||||||
inherits(LiquidError, _Error);
|
this.name = this.constructor.name;
|
||||||
|
if (Error.captureStackTrace) {
|
||||||
function LiquidError(message) {
|
Error.captureStackTrace(this, this.constructor);
|
||||||
classCallCheck(this, LiquidError);
|
|
||||||
|
|
||||||
var _this = possibleConstructorReturn(this, (LiquidError.__proto__ || Object.getPrototypeOf(LiquidError)).call(this, message));
|
|
||||||
|
|
||||||
_this.name = _this.constructor.name;
|
|
||||||
if (typeof Error.captureStackTrace === 'function') {
|
|
||||||
Error.captureStackTrace(_this, _this.constructor);
|
|
||||||
} else {
|
|
||||||
_this.stack = new Error(message).stack;
|
|
||||||
}
|
|
||||||
return _this;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return LiquidError;
|
function initLiquidError(err, token) {
|
||||||
}(Error);
|
initError.call(this);
|
||||||
|
|
||||||
var TemplateError = function (_LiquidError) {
|
this.input = token.input;
|
||||||
inherits(TemplateError, _LiquidError);
|
this.line = token.line;
|
||||||
|
this.file = token.file;
|
||||||
|
|
||||||
function TemplateError(err, token) {
|
var context = mkContext(token.input, token.line);
|
||||||
classCallCheck(this, TemplateError);
|
this.message = mkMessage(err.message, token);
|
||||||
|
this.stack = context + '\n' + (this.stack || this.message) + (err.stack ? '\nFrom ' + err.stack : '');
|
||||||
|
}
|
||||||
|
|
||||||
var _this2 = possibleConstructorReturn(this, (TemplateError.__proto__ || Object.getPrototypeOf(TemplateError)).call(this));
|
function TokenizationError(message, token) {
|
||||||
|
initLiquidError.call(this, { message: message }, token);
|
||||||
|
}
|
||||||
|
TokenizationError.prototype = create(Error.prototype);
|
||||||
|
TokenizationError.prototype.constructor = TokenizationError;
|
||||||
|
|
||||||
_this2.input = token.input;
|
function ParseError(e, token) {
|
||||||
_this2.line = token.line;
|
assign(this, e);
|
||||||
_this2.file = token.file;
|
this.originalError = e;
|
||||||
_this2.message = mkMessage(err.message, token);
|
|
||||||
var context = mkContext(token.input, token.line);
|
initLiquidError.call(this, e, token);
|
||||||
_this2.stack = context + '\n' + (_this2.stack || _this2.message) + (err.stack ? '\nFrom ' + err.stack : '');
|
}
|
||||||
return _this2;
|
ParseError.prototype = create(Error.prototype);
|
||||||
|
ParseError.prototype.constructor = ParseError;
|
||||||
|
|
||||||
|
function RenderError(e, tpl) {
|
||||||
|
// return the original render error
|
||||||
|
if (e instanceof RenderError) {
|
||||||
|
return e;
|
||||||
}
|
}
|
||||||
|
assign(this, e);
|
||||||
|
this.originalError = e;
|
||||||
|
|
||||||
return TemplateError;
|
initLiquidError.call(this, e, tpl.token);
|
||||||
}(LiquidError);
|
}
|
||||||
|
RenderError.prototype = create(Error.prototype);
|
||||||
|
RenderError.prototype.constructor = RenderError;
|
||||||
|
|
||||||
var TokenizationError = function (_TemplateError) {
|
function RenderBreakError(message) {
|
||||||
inherits(TokenizationError, _TemplateError);
|
initError.call(this);
|
||||||
|
this.message = message + '';
|
||||||
|
}
|
||||||
|
RenderBreakError.prototype = create(Error.prototype);
|
||||||
|
RenderBreakError.prototype.constructor = RenderBreakError;
|
||||||
|
|
||||||
function TokenizationError(message, token) {
|
function AssertionError(message) {
|
||||||
classCallCheck(this, TokenizationError);
|
initError.call(this);
|
||||||
return possibleConstructorReturn(this, (TokenizationError.__proto__ || Object.getPrototypeOf(TokenizationError)).call(this, { message: message }, token));
|
this.message = message + '';
|
||||||
}
|
}
|
||||||
|
AssertionError.prototype = create(Error.prototype);
|
||||||
return TokenizationError;
|
AssertionError.prototype.constructor = AssertionError;
|
||||||
}(TemplateError);
|
|
||||||
|
|
||||||
var ParseError = function (_TemplateError2) {
|
|
||||||
inherits(ParseError, _TemplateError2);
|
|
||||||
|
|
||||||
function ParseError(e, token) {
|
|
||||||
classCallCheck(this, ParseError);
|
|
||||||
|
|
||||||
var _this4 = possibleConstructorReturn(this, (ParseError.__proto__ || Object.getPrototypeOf(ParseError)).call(this, e, token));
|
|
||||||
|
|
||||||
assign(_this4, e);
|
|
||||||
_this4.originalError = e;
|
|
||||||
return _this4;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ParseError;
|
|
||||||
}(TemplateError);
|
|
||||||
|
|
||||||
var RenderError = function (_TemplateError3) {
|
|
||||||
inherits(RenderError, _TemplateError3);
|
|
||||||
|
|
||||||
function RenderError(e, tpl) {
|
|
||||||
classCallCheck(this, RenderError);
|
|
||||||
|
|
||||||
// return the original render error
|
|
||||||
if (e instanceof RenderError) {
|
|
||||||
var _ret;
|
|
||||||
|
|
||||||
return _ret = e, possibleConstructorReturn(_this5, _ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
var _this5 = possibleConstructorReturn(this, (RenderError.__proto__ || Object.getPrototypeOf(RenderError)).call(this, e, tpl.token));
|
|
||||||
|
|
||||||
assign(_this5, e);
|
|
||||||
_this5.originalError = e;
|
|
||||||
return _this5;
|
|
||||||
}
|
|
||||||
|
|
||||||
return RenderError;
|
|
||||||
}(TemplateError);
|
|
||||||
|
|
||||||
var RenderBreakError = function (_LiquidError2) {
|
|
||||||
inherits(RenderBreakError, _LiquidError2);
|
|
||||||
|
|
||||||
function RenderBreakError(message) {
|
|
||||||
classCallCheck(this, RenderBreakError);
|
|
||||||
return possibleConstructorReturn(this, (RenderBreakError.__proto__ || Object.getPrototypeOf(RenderBreakError)).call(this, message + ''));
|
|
||||||
}
|
|
||||||
|
|
||||||
return RenderBreakError;
|
|
||||||
}(LiquidError);
|
|
||||||
|
|
||||||
var AssertionError = function (_LiquidError3) {
|
|
||||||
inherits(AssertionError, _LiquidError3);
|
|
||||||
|
|
||||||
function AssertionError(message) {
|
|
||||||
classCallCheck(this, AssertionError);
|
|
||||||
return possibleConstructorReturn(this, (AssertionError.__proto__ || Object.getPrototypeOf(AssertionError)).call(this, message + ''));
|
|
||||||
}
|
|
||||||
|
|
||||||
return AssertionError;
|
|
||||||
}(LiquidError);
|
|
||||||
|
|
||||||
function mkContext(input, line) {
|
function mkContext(input, line) {
|
||||||
var lines = input.split('\n');
|
var lines = input.split('\n');
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+51
-132
@@ -44,36 +44,6 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
var classCallCheck = function (instance, Constructor) {
|
|
||||||
if (!(instance instanceof Constructor)) {
|
|
||||||
throw new TypeError("Cannot call a class as a function");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var inherits = function (subClass, superClass) {
|
|
||||||
if (typeof superClass !== "function" && superClass !== null) {
|
|
||||||
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
||||||
}
|
|
||||||
|
|
||||||
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
||||||
constructor: {
|
|
||||||
value: subClass,
|
|
||||||
enumerable: false,
|
|
||||||
writable: true,
|
|
||||||
configurable: true
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
||||||
};
|
|
||||||
|
|
||||||
var possibleConstructorReturn = function (self, call) {
|
|
||||||
if (!self) {
|
|
||||||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
||||||
}
|
|
||||||
|
|
||||||
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2014-present, Facebook, Inc.
|
* Copyright (c) 2014-present, Facebook, Inc.
|
||||||
*
|
*
|
||||||
@@ -876,7 +846,7 @@
|
|||||||
*/
|
*/
|
||||||
function isObject(value) {
|
function isObject(value) {
|
||||||
var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);
|
var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);
|
||||||
return value != null && (type === 'object' || type === 'function');
|
return value !== null && (type === 'object' || type === 'function');
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -980,117 +950,66 @@
|
|||||||
throw new TypeError('cannot parse \'' + str + '\' as literal');
|
throw new TypeError('cannot parse \'' + str + '\' as literal');
|
||||||
}
|
}
|
||||||
|
|
||||||
var LiquidError = function (_Error) {
|
function initError() {
|
||||||
inherits(LiquidError, _Error);
|
this.name = this.constructor.name;
|
||||||
|
if (Error.captureStackTrace) {
|
||||||
function LiquidError(message) {
|
Error.captureStackTrace(this, this.constructor);
|
||||||
classCallCheck(this, LiquidError);
|
|
||||||
|
|
||||||
var _this = possibleConstructorReturn(this, (LiquidError.__proto__ || Object.getPrototypeOf(LiquidError)).call(this, message));
|
|
||||||
|
|
||||||
_this.name = _this.constructor.name;
|
|
||||||
if (typeof Error.captureStackTrace === 'function') {
|
|
||||||
Error.captureStackTrace(_this, _this.constructor);
|
|
||||||
} else {
|
|
||||||
_this.stack = new Error(message).stack;
|
|
||||||
}
|
|
||||||
return _this;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return LiquidError;
|
function initLiquidError(err, token) {
|
||||||
}(Error);
|
initError.call(this);
|
||||||
|
|
||||||
var TemplateError = function (_LiquidError) {
|
this.input = token.input;
|
||||||
inherits(TemplateError, _LiquidError);
|
this.line = token.line;
|
||||||
|
this.file = token.file;
|
||||||
|
|
||||||
function TemplateError(err, token) {
|
var context = mkContext(token.input, token.line);
|
||||||
classCallCheck(this, TemplateError);
|
this.message = mkMessage(err.message, token);
|
||||||
|
this.stack = context + '\n' + (this.stack || this.message) + (err.stack ? '\nFrom ' + err.stack : '');
|
||||||
|
}
|
||||||
|
|
||||||
var _this2 = possibleConstructorReturn(this, (TemplateError.__proto__ || Object.getPrototypeOf(TemplateError)).call(this));
|
function TokenizationError(message, token) {
|
||||||
|
initLiquidError.call(this, { message: message }, token);
|
||||||
|
}
|
||||||
|
TokenizationError.prototype = create(Error.prototype);
|
||||||
|
TokenizationError.prototype.constructor = TokenizationError;
|
||||||
|
|
||||||
_this2.input = token.input;
|
function ParseError(e, token) {
|
||||||
_this2.line = token.line;
|
assign(this, e);
|
||||||
_this2.file = token.file;
|
this.originalError = e;
|
||||||
_this2.message = mkMessage(err.message, token);
|
|
||||||
var context = mkContext(token.input, token.line);
|
initLiquidError.call(this, e, token);
|
||||||
_this2.stack = context + '\n' + (_this2.stack || _this2.message) + (err.stack ? '\nFrom ' + err.stack : '');
|
}
|
||||||
return _this2;
|
ParseError.prototype = create(Error.prototype);
|
||||||
|
ParseError.prototype.constructor = ParseError;
|
||||||
|
|
||||||
|
function RenderError(e, tpl) {
|
||||||
|
// return the original render error
|
||||||
|
if (e instanceof RenderError) {
|
||||||
|
return e;
|
||||||
}
|
}
|
||||||
|
assign(this, e);
|
||||||
|
this.originalError = e;
|
||||||
|
|
||||||
return TemplateError;
|
initLiquidError.call(this, e, tpl.token);
|
||||||
}(LiquidError);
|
}
|
||||||
|
RenderError.prototype = create(Error.prototype);
|
||||||
|
RenderError.prototype.constructor = RenderError;
|
||||||
|
|
||||||
var TokenizationError = function (_TemplateError) {
|
function RenderBreakError(message) {
|
||||||
inherits(TokenizationError, _TemplateError);
|
initError.call(this);
|
||||||
|
this.message = message + '';
|
||||||
|
}
|
||||||
|
RenderBreakError.prototype = create(Error.prototype);
|
||||||
|
RenderBreakError.prototype.constructor = RenderBreakError;
|
||||||
|
|
||||||
function TokenizationError(message, token) {
|
function AssertionError(message) {
|
||||||
classCallCheck(this, TokenizationError);
|
initError.call(this);
|
||||||
return possibleConstructorReturn(this, (TokenizationError.__proto__ || Object.getPrototypeOf(TokenizationError)).call(this, { message: message }, token));
|
this.message = message + '';
|
||||||
}
|
}
|
||||||
|
AssertionError.prototype = create(Error.prototype);
|
||||||
return TokenizationError;
|
AssertionError.prototype.constructor = AssertionError;
|
||||||
}(TemplateError);
|
|
||||||
|
|
||||||
var ParseError = function (_TemplateError2) {
|
|
||||||
inherits(ParseError, _TemplateError2);
|
|
||||||
|
|
||||||
function ParseError(e, token) {
|
|
||||||
classCallCheck(this, ParseError);
|
|
||||||
|
|
||||||
var _this4 = possibleConstructorReturn(this, (ParseError.__proto__ || Object.getPrototypeOf(ParseError)).call(this, e, token));
|
|
||||||
|
|
||||||
assign(_this4, e);
|
|
||||||
_this4.originalError = e;
|
|
||||||
return _this4;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ParseError;
|
|
||||||
}(TemplateError);
|
|
||||||
|
|
||||||
var RenderError = function (_TemplateError3) {
|
|
||||||
inherits(RenderError, _TemplateError3);
|
|
||||||
|
|
||||||
function RenderError(e, tpl) {
|
|
||||||
classCallCheck(this, RenderError);
|
|
||||||
|
|
||||||
// return the original render error
|
|
||||||
if (e instanceof RenderError) {
|
|
||||||
var _ret;
|
|
||||||
|
|
||||||
return _ret = e, possibleConstructorReturn(_this5, _ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
var _this5 = possibleConstructorReturn(this, (RenderError.__proto__ || Object.getPrototypeOf(RenderError)).call(this, e, tpl.token));
|
|
||||||
|
|
||||||
assign(_this5, e);
|
|
||||||
_this5.originalError = e;
|
|
||||||
return _this5;
|
|
||||||
}
|
|
||||||
|
|
||||||
return RenderError;
|
|
||||||
}(TemplateError);
|
|
||||||
|
|
||||||
var RenderBreakError = function (_LiquidError2) {
|
|
||||||
inherits(RenderBreakError, _LiquidError2);
|
|
||||||
|
|
||||||
function RenderBreakError(message) {
|
|
||||||
classCallCheck(this, RenderBreakError);
|
|
||||||
return possibleConstructorReturn(this, (RenderBreakError.__proto__ || Object.getPrototypeOf(RenderBreakError)).call(this, message + ''));
|
|
||||||
}
|
|
||||||
|
|
||||||
return RenderBreakError;
|
|
||||||
}(LiquidError);
|
|
||||||
|
|
||||||
var AssertionError = function (_LiquidError3) {
|
|
||||||
inherits(AssertionError, _LiquidError3);
|
|
||||||
|
|
||||||
function AssertionError(message) {
|
|
||||||
classCallCheck(this, AssertionError);
|
|
||||||
return possibleConstructorReturn(this, (AssertionError.__proto__ || Object.getPrototypeOf(AssertionError)).call(this, message + ''));
|
|
||||||
}
|
|
||||||
|
|
||||||
return AssertionError;
|
|
||||||
}(LiquidError);
|
|
||||||
|
|
||||||
function mkContext(input, line) {
|
function mkContext(input, line) {
|
||||||
var lines = input.split('\n');
|
var lines = input.split('\n');
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+34
-3
@@ -7,9 +7,11 @@
|
|||||||
"browser": "dist/liquid.js",
|
"browser": "dist/liquid.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "eslint src/ test/ *.js",
|
"lint": "eslint src/ test/ *.js",
|
||||||
"test": "mocha --require babel-core/register --recursive",
|
"test": "npm run test:unit && npm run test:e2e",
|
||||||
"coverage": "nyc report --require babel-core/register mocha test/ --recursive ",
|
"test:unit": "mocha test/unit",
|
||||||
"coveralls": "nyc report --reporter=text-lcov --require babel-core/register mocha test/ --recursive | coveralls",
|
"test:e2e": "mocha test/e2e",
|
||||||
|
"coverage": "cross-env NODE_ENV=test nyc report --reporter=html mocha test/unit",
|
||||||
|
"coveralls": "cross-env NODE_ENV=test nyc report --reporter=text-lcov mocha | coveralls",
|
||||||
"dist": "rollup -c && ls -lh dist",
|
"dist": "rollup -c && ls -lh dist",
|
||||||
"demo:browser": "echo open http://localhost:8080/demo/browser && http-server -c-1",
|
"demo:browser": "echo open http://localhost:8080/demo/browser && http-server -c-1",
|
||||||
"demo:nodejs": "node ./demo/nodejs/index.js",
|
"demo:nodejs": "node ./demo/nodejs/index.js",
|
||||||
@@ -41,11 +43,14 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-core": "^6.26.3",
|
"babel-core": "^6.26.3",
|
||||||
"babel-plugin-external-helpers": "^6.22.0",
|
"babel-plugin-external-helpers": "^6.22.0",
|
||||||
|
"babel-plugin-istanbul": "^4.1.6",
|
||||||
"babel-plugin-transform-runtime": "^6.23.0",
|
"babel-plugin-transform-runtime": "^6.23.0",
|
||||||
"babel-preset-env": "^1.7.0",
|
"babel-preset-env": "^1.7.0",
|
||||||
|
"babel-runtime": "^6.26.0",
|
||||||
"chai": "^4.1.2",
|
"chai": "^4.1.2",
|
||||||
"chai-as-promised": "^7.1.1",
|
"chai-as-promised": "^7.1.1",
|
||||||
"coveralls": "^3.0.0",
|
"coveralls": "^3.0.0",
|
||||||
|
"cross-env": "^5.2.0",
|
||||||
"eslint": "^5.2.0",
|
"eslint": "^5.2.0",
|
||||||
"eslint-config-standard": "^11.0.0",
|
"eslint-config-standard": "^11.0.0",
|
||||||
"eslint-plugin-import": "^2.7.0",
|
"eslint-plugin-import": "^2.7.0",
|
||||||
@@ -68,5 +73,31 @@
|
|||||||
"sinon": "^6.1.4",
|
"sinon": "^6.1.4",
|
||||||
"sinon-chai": "^3.2.0",
|
"sinon-chai": "^3.2.0",
|
||||||
"supertest": "^3.0.0"
|
"supertest": "^3.0.0"
|
||||||
|
},
|
||||||
|
"nyc": {
|
||||||
|
"require": [
|
||||||
|
"babel-core/register"
|
||||||
|
],
|
||||||
|
"sourceMap": false,
|
||||||
|
"instrument": false
|
||||||
|
},
|
||||||
|
"babel": {
|
||||||
|
"presets": ["env"],
|
||||||
|
"plugins": [
|
||||||
|
[
|
||||||
|
"transform-runtime",
|
||||||
|
{
|
||||||
|
"helpers": false,
|
||||||
|
"polyfill": false,
|
||||||
|
"regenerator": true,
|
||||||
|
"moduleName": "babel-runtime"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"env": {
|
||||||
|
"test": {
|
||||||
|
"plugins": ["istanbul"]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ export function uniq (arr) {
|
|||||||
*/
|
*/
|
||||||
export function isObject (value) {
|
export function isObject (value) {
|
||||||
const type = typeof value
|
const type = typeof value
|
||||||
return value != null && (type === 'object' || type === 'function')
|
return value !== null && (type === 'object' || type === 'function')
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"rules": {
|
||||||
|
"no-var": 0,
|
||||||
|
"prefer-const": 0
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
import chai from 'chai'
|
const chai = require('chai')
|
||||||
import request from 'supertest'
|
const request = require('supertest')
|
||||||
import express from 'express'
|
const express = require('express')
|
||||||
import mock from 'mock-fs'
|
const mock = require('mock-fs')
|
||||||
import Liquid from '../src'
|
const Liquid = require('../..')
|
||||||
import chaiAsPromised from 'chai-as-promised'
|
const chaiAsPromised = require('chai-as-promised')
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
chai.use(chaiAsPromised)
|
chai.use(chaiAsPromised)
|
||||||
|
|
||||||
describe('engine#express()', function () {
|
describe('engine#express()', function () {
|
||||||
let app, engine
|
var app, engine
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
app = express()
|
app = express()
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
var chai = require('chai')
|
||||||
|
var Liquid = require('../..')
|
||||||
|
var expect = chai.expect
|
||||||
|
|
||||||
|
chai.use(require('chai-as-promised'))
|
||||||
|
|
||||||
|
describe('.parseAndRender()', function () {
|
||||||
|
var engine, strictEngine
|
||||||
|
beforeEach(function () {
|
||||||
|
engine = Liquid()
|
||||||
|
strictEngine = Liquid({
|
||||||
|
strict_filters: true
|
||||||
|
})
|
||||||
|
})
|
||||||
|
it('should value object', function () {
|
||||||
|
var ctx = { obj: {foo: 'bar'} }
|
||||||
|
return expect(engine.parseAndRender('{{obj}}', ctx)).to.eventually.equal('{"foo":"bar"}')
|
||||||
|
})
|
||||||
|
it('should value array', function () {
|
||||||
|
var ctx = { arr: [-2, 'a'] }
|
||||||
|
return expect(engine.parseAndRender('{{arr}}', ctx)).to.eventually.equal('[-2,"a"]')
|
||||||
|
})
|
||||||
|
it('should value undefined to empty', function () {
|
||||||
|
return expect(engine.parseAndRender('foo{{zzz}}bar', {})).to.eventually.equal('foobar')
|
||||||
|
})
|
||||||
|
it('should render as null when filter undefined', function () {
|
||||||
|
return expect(engine.parseAndRender('{{"foo" | filter1}}', {})).to.eventually.equal('foo')
|
||||||
|
})
|
||||||
|
it('should throw upon undefined filter when strict_filters set', function () {
|
||||||
|
return expect(strictEngine.parseAndRender('{{"foo" | filter1}}', {})).to
|
||||||
|
.be.rejectedWith(/undefined filter: filter1/)
|
||||||
|
})
|
||||||
|
it('should parse html', function () {
|
||||||
|
expect(function () {
|
||||||
|
engine.parse('{{obj}}')
|
||||||
|
}).to.not.throw()
|
||||||
|
expect(function () {
|
||||||
|
engine.parse('<html><head>{{obj}}</head></html>')
|
||||||
|
}).to.not.throw()
|
||||||
|
})
|
||||||
|
it('should render template multiple times', function () {
|
||||||
|
var ctx = {obj: {foo: 'bar'}}
|
||||||
|
var template = engine.parse('{{obj}}')
|
||||||
|
return engine.render(template, ctx)
|
||||||
|
.then(result => expect(result).to.equal('{"foo":"bar"}'))
|
||||||
|
.then(() => engine.render(template, ctx))
|
||||||
|
.then((result) => expect(result).to.equal('{"foo":"bar"}'))
|
||||||
|
})
|
||||||
|
it('should render filters', function () {
|
||||||
|
var ctx = {names: ['alice', 'bob']}
|
||||||
|
var template = engine.parse('<p>{{names | join: ","}}</p>')
|
||||||
|
return expect(engine.render(template, ctx)).to.eventually.equal('<p>alice,bob</p>')
|
||||||
|
})
|
||||||
|
it('should render accessive filters', function () {
|
||||||
|
var src = '{% assign my_array = "apples, oranges, peaches, plums" | split: ", " %}' +
|
||||||
|
'{{ my_array | first }}'
|
||||||
|
return expect(engine.parseAndRender(src)).to.eventually.equal('apples')
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
var chai = require('chai')
|
||||||
|
var mock = require('mock-fs')
|
||||||
|
var Liquid = require('../..')
|
||||||
|
var expect = chai.expect
|
||||||
|
|
||||||
|
chai.use(require('chai-as-promised'))
|
||||||
|
|
||||||
|
describe('#renderFile()', function () {
|
||||||
|
var engine
|
||||||
|
beforeEach(function () {
|
||||||
|
engine = Liquid({
|
||||||
|
root: '/root/',
|
||||||
|
extname: '.html'
|
||||||
|
})
|
||||||
|
mock({
|
||||||
|
'/root/files/bar': 'bar',
|
||||||
|
'/root/files/foo.html': 'foo',
|
||||||
|
'/root/files/name.html': 'My name is {{name}}.',
|
||||||
|
'/un-readable.html': mock.file({
|
||||||
|
mode: '0000'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
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')
|
||||||
|
})
|
||||||
|
it('should find files without extname', function () {
|
||||||
|
var engine = Liquid({root: '/root'})
|
||||||
|
return expect(engine.renderFile('/root/files/bar', {}))
|
||||||
|
.to.eventually.equal('bar')
|
||||||
|
})
|
||||||
|
it('should accept relative path', function () {
|
||||||
|
return expect(engine.renderFile('files/foo.html'))
|
||||||
|
.to.eventually.equal('foo')
|
||||||
|
})
|
||||||
|
it('should resolve array as root', function () {
|
||||||
|
engine = Liquid({
|
||||||
|
root: ['/boo', '/root/'],
|
||||||
|
extname: '.html'
|
||||||
|
})
|
||||||
|
return expect(engine.renderFile('files/foo.html'))
|
||||||
|
.to.eventually.equal('foo')
|
||||||
|
})
|
||||||
|
it('should default root to cwd', function () {
|
||||||
|
var files = {}
|
||||||
|
files[process.cwd() + '/foo.html'] = 'FOO'
|
||||||
|
mock(files)
|
||||||
|
|
||||||
|
engine = Liquid({
|
||||||
|
extname: '.html'
|
||||||
|
})
|
||||||
|
return expect(engine.renderFile('foo.html'))
|
||||||
|
.to.eventually.equal('FOO')
|
||||||
|
})
|
||||||
|
it('should render file with context', function () {
|
||||||
|
return expect(engine.renderFile('/root/files/name.html', {name: 'harttle'}))
|
||||||
|
.to.eventually.equal('My name is harttle.')
|
||||||
|
})
|
||||||
|
it('should use default extname', function () {
|
||||||
|
return expect(engine.renderFile('files/name', {name: 'harttle'})).to.eventually.equal('My name is harttle.')
|
||||||
|
})
|
||||||
|
it('should throw with lookup list when file not exist', function () {
|
||||||
|
engine = Liquid({
|
||||||
|
root: ['/boo', '/root/'],
|
||||||
|
extname: '.html'
|
||||||
|
})
|
||||||
|
return expect(engine.renderFile('/not/exist.html')).to
|
||||||
|
.be.rejectedWith(/failed to lookup \/not\/exist.html in: \/boo,\/root\//i)
|
||||||
|
})
|
||||||
|
it('should throw when file not readable', function () {
|
||||||
|
return expect(engine.renderFile('/un-readable.html')).to
|
||||||
|
.be.rejectedWith(/EACCES/)
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
import chai from 'chai'
|
const chai = require('chai')
|
||||||
import Liquid from '../src'
|
const Liquid = require('../..')
|
||||||
|
|
||||||
const liquid = new Liquid()
|
const liquid = new Liquid()
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
chai.use(require('chai-as-promised'))
|
chai.use(require('chai-as-promised'))
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
import Liquid from '../src'
|
var Liquid = require('../..')
|
||||||
import sinon from 'sinon'
|
var sinon = require('sinon')
|
||||||
import chai from 'chai'
|
var chai = require('chai')
|
||||||
const expect = chai.expect
|
var expect = chai.expect
|
||||||
chai.use(require('chai-as-promised'))
|
chai.use(require('chai-as-promised'))
|
||||||
|
|
||||||
describe('xhr', () => {
|
describe('xhr', () => {
|
||||||
if (process.version.match(/^v(\d+)/)[1] < 8) {
|
if (process.version.match(/^v(\d+)/)[1] < 8) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const JSDOM = require('jsdom').JSDOM
|
var JSDOM = require('jsdom').JSDOM
|
||||||
let server, engine, dom
|
var server, engine, dom
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
server = sinon.createFakeServer()
|
server = sinon.createFakeServer()
|
||||||
server.autoRespond = true
|
server.autoRespond = true
|
||||||
-140
@@ -1,140 +0,0 @@
|
|||||||
import chai from 'chai'
|
|
||||||
import mock from 'mock-fs'
|
|
||||||
import Liquid from '../src'
|
|
||||||
import chaiAsPromised from 'chai-as-promised'
|
|
||||||
|
|
||||||
const expect = chai.expect
|
|
||||||
chai.use(chaiAsPromised)
|
|
||||||
|
|
||||||
describe('liquid', function () {
|
|
||||||
let engine, strictEngine, ctx
|
|
||||||
beforeEach(function () {
|
|
||||||
ctx = {
|
|
||||||
name: 'harttle',
|
|
||||||
arr: [-2, 'a'],
|
|
||||||
obj: {
|
|
||||||
foo: 'bar'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
engine = Liquid({
|
|
||||||
root: '/root/',
|
|
||||||
extname: '.html'
|
|
||||||
})
|
|
||||||
strictEngine = Liquid({
|
|
||||||
root: '/root',
|
|
||||||
extname: '.html',
|
|
||||||
strict_filters: true
|
|
||||||
})
|
|
||||||
mock({
|
|
||||||
'/root/files/bar': 'bar',
|
|
||||||
'/root/files/foo.html': 'foo',
|
|
||||||
'/root/files/name.html': 'My name is {{name}}.',
|
|
||||||
'/un-readable.html': mock.file({
|
|
||||||
mode: '0000'
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
afterEach(function () {
|
|
||||||
mock.restore()
|
|
||||||
})
|
|
||||||
describe('Liquid', function () {
|
|
||||||
it('should ignore invalid root option', function () {
|
|
||||||
const liquid = Liquid({ root: /regex/ })
|
|
||||||
expect(liquid.options.root).to.deep.equal([])
|
|
||||||
})
|
|
||||||
})
|
|
||||||
describe('{{value}}', function () {
|
|
||||||
it('should value object', function () {
|
|
||||||
return expect(engine.parseAndRender('{{obj}}', ctx)).to.eventually.equal('{"foo":"bar"}')
|
|
||||||
})
|
|
||||||
it('should value array', function () {
|
|
||||||
return expect(engine.parseAndRender('{{arr}}', ctx)).to.eventually.equal('[-2,"a"]')
|
|
||||||
})
|
|
||||||
it('should value undefined to empty', function () {
|
|
||||||
return expect(engine.parseAndRender('foo{{zzz}}bar', ctx)).to.eventually.equal('foobar')
|
|
||||||
})
|
|
||||||
it('should render as null when filter undefined', function () {
|
|
||||||
return expect(engine.parseAndRender('{{"foo" | filter1}}', ctx)).to.eventually.equal('foo')
|
|
||||||
})
|
|
||||||
it('should throw upon undefined filter when strict_filters set', function () {
|
|
||||||
return expect(strictEngine.parseAndRender('{{arr | filter1}}', ctx)).to
|
|
||||||
.be.rejectedWith(/undefined filter: filter1/)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
it('should parse html', function () {
|
|
||||||
expect(function () {
|
|
||||||
engine.parse('{{obj}}')
|
|
||||||
}).to.not.throw()
|
|
||||||
expect(function () {
|
|
||||||
engine.parse('<html><head>{{obj}}</head></html>')
|
|
||||||
}).to.not.throw()
|
|
||||||
})
|
|
||||||
it('should render template multiple times', function () {
|
|
||||||
const template = engine.parse('{{obj}}')
|
|
||||||
return engine.render(template, ctx)
|
|
||||||
.then(result => expect(result).to.equal('{"foo":"bar"}'))
|
|
||||||
.then(() => engine.render(template, ctx))
|
|
||||||
.then((result) => expect(result).to.equal('{"foo":"bar"}'))
|
|
||||||
})
|
|
||||||
it('should render filters', function () {
|
|
||||||
const template = engine.parse('<p>{{arr | join: "_"}}</p>')
|
|
||||||
return expect(engine.render(template, ctx)).to.eventually.equal('<p>-2_a</p>')
|
|
||||||
})
|
|
||||||
it('should render accessive filters', function () {
|
|
||||||
const src = '{% assign my_array = "apples, oranges, peaches, plums" | split: ", " %}' +
|
|
||||||
'{{ my_array | first }}'
|
|
||||||
return expect(engine.parseAndRender(src)).to.eventually.equal('apples')
|
|
||||||
})
|
|
||||||
describe('#renderFile()', function () {
|
|
||||||
it('should render file', function () {
|
|
||||||
return expect(engine.renderFile('/root/files/foo.html', ctx))
|
|
||||||
.to.eventually.equal('foo')
|
|
||||||
})
|
|
||||||
it('should find files without extname', function () {
|
|
||||||
const engine = Liquid({root: '/root'})
|
|
||||||
return expect(engine.renderFile('/root/files/bar', ctx))
|
|
||||||
.to.eventually.equal('bar')
|
|
||||||
})
|
|
||||||
it('should accept relative path', function () {
|
|
||||||
return expect(engine.renderFile('files/foo.html'))
|
|
||||||
.to.eventually.equal('foo')
|
|
||||||
})
|
|
||||||
it('should resolve array as root', function () {
|
|
||||||
engine = Liquid({
|
|
||||||
root: ['/boo', '/root/'],
|
|
||||||
extname: '.html'
|
|
||||||
})
|
|
||||||
return expect(engine.renderFile('files/foo.html'))
|
|
||||||
.to.eventually.equal('foo')
|
|
||||||
})
|
|
||||||
it('should default root to cwd', function () {
|
|
||||||
const files = {}
|
|
||||||
files[process.cwd() + '/foo.html'] = 'FOO'
|
|
||||||
mock(files)
|
|
||||||
|
|
||||||
engine = Liquid({
|
|
||||||
extname: '.html'
|
|
||||||
})
|
|
||||||
return expect(engine.renderFile('foo.html'))
|
|
||||||
.to.eventually.equal('FOO')
|
|
||||||
})
|
|
||||||
it('should render file with context', function () {
|
|
||||||
return expect(engine.renderFile('/root/files/name.html', ctx)).to.eventually.equal('My name is harttle.')
|
|
||||||
})
|
|
||||||
it('should use default extname', function () {
|
|
||||||
return expect(engine.renderFile('files/name', ctx)).to.eventually.equal('My name is harttle.')
|
|
||||||
})
|
|
||||||
it('should throw with lookup list when file not exist', function () {
|
|
||||||
engine = Liquid({
|
|
||||||
root: ['/boo', '/root/'],
|
|
||||||
extname: '.html'
|
|
||||||
})
|
|
||||||
return expect(engine.renderFile('/not/exist.html')).to
|
|
||||||
.be.rejectedWith(/failed to lookup \/not\/exist.html in: \/boo,\/root\//i)
|
|
||||||
})
|
|
||||||
it('should throw when file not readable', function () {
|
|
||||||
return expect(engine.renderFile('/un-readable.html')).to
|
|
||||||
.be.rejectedWith(/EACCES/)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
--require babel-core/register
|
||||||
|
--recursive
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import sinon from 'sinon'
|
import sinon from 'sinon'
|
||||||
import sinonChai from 'sinon-chai'
|
import sinonChai from 'sinon-chai'
|
||||||
import Filter from '../src/filter.js'
|
import Filter from '../../src/filter.js'
|
||||||
import {factory as scopeFactory} from '../src/scope.js'
|
import {factory as scopeFactory} from '../../src/scope.js'
|
||||||
|
|
||||||
chai.use(sinonChai)
|
chai.use(sinonChai)
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import chaiAsPromised from 'chai-as-promised'
|
import chaiAsPromised from 'chai-as-promised'
|
||||||
import Liquid from '../src/index'
|
import Liquid from '../../src/index'
|
||||||
|
|
||||||
chai.use(chaiAsPromised)
|
chai.use(chaiAsPromised)
|
||||||
const liquid = new Liquid()
|
const liquid = new Liquid()
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
const chai = require('chai')
|
const chai = require('chai')
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
const lexical = require('../src/lexical.js')
|
const lexical = require('../../src/lexical.js')
|
||||||
|
|
||||||
describe('lexical', function () {
|
describe('lexical', function () {
|
||||||
it('should test filter syntax', function () {
|
it('should test filter syntax', function () {
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import mock from 'mock-fs'
|
import mock from 'mock-fs'
|
||||||
import Liquid from '../../src'
|
import Liquid from '../../../src'
|
||||||
import chaiAsPromised from 'chai-as-promised'
|
import chaiAsPromised from 'chai-as-promised'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import Liquid from '../../src'
|
import Liquid from '../../../src'
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import Liquid from '../../src'
|
import Liquid from '../../../src'
|
||||||
import chaiAsPromised from 'chai-as-promised'
|
import chaiAsPromised from 'chai-as-promised'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import sinonChai from 'sinon-chai'
|
import sinonChai from 'sinon-chai'
|
||||||
import Filter from '../src/filter.js'
|
import Filter from '../../src/filter.js'
|
||||||
import Tag from '../src/tag.js'
|
import Tag from '../../src/tag.js'
|
||||||
import Template from '../src/parser.js'
|
import Template from '../../src/parser.js'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
const filter = Filter()
|
const filter = Filter()
|
||||||
@@ -2,11 +2,11 @@ import chai from 'chai'
|
|||||||
import chaiAsPromised from 'chai-as-promised'
|
import chaiAsPromised from 'chai-as-promised'
|
||||||
import sinonChai from 'sinon-chai'
|
import sinonChai from 'sinon-chai'
|
||||||
import sinon from 'sinon'
|
import sinon from 'sinon'
|
||||||
import Tag from '../src/tag.js'
|
import Tag from '../../src/tag.js'
|
||||||
import {factory as scopeFactory} from '../src/scope.js'
|
import {factory as scopeFactory} from '../../src/scope.js'
|
||||||
import Filter from '../src/filter'
|
import Filter from '../../src/filter'
|
||||||
import Render from '../src/render.js'
|
import Render from '../../src/render.js'
|
||||||
import parser from '../src/parser.js'
|
import parser from '../../src/parser.js'
|
||||||
|
|
||||||
chai.use(sinonChai)
|
chai.use(sinonChai)
|
||||||
chai.use(chaiAsPromised)
|
chai.use(chaiAsPromised)
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import {factory as scopeFactory} from '../src/scope.js'
|
import {factory as scopeFactory} from '../../src/scope.js'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
const chai = require('chai')
|
const chai = require('chai')
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
const syntax = require('../src/syntax.js')
|
const syntax = require('../../src/syntax.js')
|
||||||
const Scope = require('../src/scope.js')
|
const Scope = require('../../src/scope.js')
|
||||||
|
|
||||||
const evalExp = syntax.evalExp
|
const evalExp = syntax.evalExp
|
||||||
const evalValue = syntax.evalValue
|
const evalValue = syntax.evalValue
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import Tag from '../src/tag.js'
|
import Tag from '../../src/tag.js'
|
||||||
import {factory as scopeFactory} from '../src/scope.js'
|
import {factory as scopeFactory} from '../../src/scope.js'
|
||||||
import sinon from 'sinon'
|
import sinon from 'sinon'
|
||||||
import sinonChai from 'sinon-chai'
|
import sinonChai from 'sinon-chai'
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import Liquid from '../../src'
|
import Liquid from '../../../src'
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import sinonChai from 'chai-as-promised'
|
import sinonChai from 'chai-as-promised'
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import Liquid from '../../src/index'
|
import Liquid from '../../../src/index'
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import Liquid from '../../src'
|
import Liquid from '../../../src'
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import Liquid from '../../src'
|
import Liquid from '../../../src'
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import Liquid from '../../src'
|
import Liquid from '../../../src'
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import Liquid from '../../src'
|
import Liquid from '../../../src'
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import Liquid from '../../src'
|
import Liquid from '../../../src'
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import Liquid from '../../src/index'
|
import Liquid from '../../../src/index'
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import Liquid from '../../src'
|
import Liquid from '../../../src'
|
||||||
import mock from 'mock-fs'
|
import mock from 'mock-fs'
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import Liquid from '../../src'
|
import Liquid from '../../../src'
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import Liquid from '../../src'
|
import Liquid from '../../../src'
|
||||||
import mock from 'mock-fs'
|
import mock from 'mock-fs'
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import Liquid from '../../src'
|
import Liquid from '../../../src'
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import Liquid from '../../src'
|
import Liquid from '../../../src'
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import Liquid from '../../src'
|
import Liquid from '../../../src'
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
const chai = require('chai')
|
const chai = require('chai')
|
||||||
const parse = require('../src/tokenizer.js').parse
|
const parse = require('../../src/tokenizer.js').parse
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
describe('tokenizer', function () {
|
describe('tokenizer', function () {
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import assert from '../../src/util/assert.js'
|
import assert from '../../../src/util/assert.js'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import Liquid from '../../src'
|
import Liquid from '../../../src'
|
||||||
import mock from 'mock-fs'
|
import mock from 'mock-fs'
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
@@ -4,7 +4,7 @@ const expect = chai.expect
|
|||||||
chai.use(require('chai-as-promised'))
|
chai.use(require('chai-as-promised'))
|
||||||
chai.use(require('sinon-chai'))
|
chai.use(require('sinon-chai'))
|
||||||
|
|
||||||
const P = require('../../src/util/promise.js')
|
const P = require('../../../src/util/promise.js')
|
||||||
|
|
||||||
describe('util/promise', function () {
|
describe('util/promise', function () {
|
||||||
describe('.anySeries()', function () {
|
describe('.anySeries()', function () {
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import t from '../../src/util/strftime.js'
|
import t from '../../../src/util/strftime.js'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import sinonChai from 'sinon-chai'
|
import sinonChai from 'sinon-chai'
|
||||||
import sinon from 'sinon'
|
import sinon from 'sinon'
|
||||||
import {RenderError, RenderBreakError} from '../../src/util/error.js'
|
import {RenderError, RenderBreakError} from '../../../src/util/error.js'
|
||||||
import * as _ from '../../src/util/underscore.js'
|
import * as _ from '../../../src/util/underscore.js'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
chai.use(sinonChai)
|
chai.use(sinonChai)
|
||||||
@@ -93,6 +93,20 @@ describe('util/underscore', function () {
|
|||||||
expect(_.range(3)).to.deep.equal([0, 1, 2])
|
expect(_.range(3)).to.deep.equal([0, 1, 2])
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
describe('.isObject()', function () {
|
||||||
|
it('should return true for function', function () {
|
||||||
|
expect(_.isObject(x => x)).to.be.true
|
||||||
|
})
|
||||||
|
it('should return true for plain object', function () {
|
||||||
|
expect(_.isObject({})).to.be.true
|
||||||
|
})
|
||||||
|
it('should return false for null', function () {
|
||||||
|
expect(_.isObject(null)).to.be.false
|
||||||
|
})
|
||||||
|
it('should return false for number', function () {
|
||||||
|
expect(_.isObject(2)).to.be.false
|
||||||
|
})
|
||||||
|
})
|
||||||
describe('.assign()', function () {
|
describe('.assign()', function () {
|
||||||
it('should handle null dst', function () {
|
it('should handle null dst', function () {
|
||||||
expect(_.assign(null, {
|
expect(_.assign(null, {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import {extname, resolve} from '../../src/util/url.js'
|
import {extname, resolve} from '../../../src/util/url.js'
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
Reference in New Issue
Block a user