diff --git a/package-lock.json b/package-lock.json
index eb7b05bd1..6ed12f6bb 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "handlebars",
- "version": "4.5.1",
+ "version": "4.5.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -83,6 +83,50 @@
}
}
},
+ "@sinonjs/commons": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.6.0.tgz",
+ "integrity": "sha512-w4/WHG7C4WWFyE5geCieFJF6MZkbW4VAriol5KlmQXpAQdxvV0p26sqNZOW6Qyw6Y0l9K4g+cHvvczR2sEEpqg==",
+ "dev": true,
+ "requires": {
+ "type-detect": "4.0.8"
+ }
+ },
+ "@sinonjs/formatio": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-3.2.2.tgz",
+ "integrity": "sha512-B8SEsgd8gArBLMD6zpRw3juQ2FVSsmdd7qlevyDqzS9WTCtvF55/gAL+h6gue8ZvPYcdiPdvueM/qm//9XzyTQ==",
+ "dev": true,
+ "requires": {
+ "@sinonjs/commons": "^1",
+ "@sinonjs/samsam": "^3.1.0"
+ }
+ },
+ "@sinonjs/samsam": {
+ "version": "3.3.3",
+ "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-3.3.3.tgz",
+ "integrity": "sha512-bKCMKZvWIjYD0BLGnNrxVuw4dkWCYsLqFOUWw8VgKF/+5Y+mE7LfHWPIYoDXowH+3a9LsWDMo0uAP8YDosPvHQ==",
+ "dev": true,
+ "requires": {
+ "@sinonjs/commons": "^1.3.0",
+ "array-from": "^2.1.1",
+ "lodash": "^4.17.15"
+ },
+ "dependencies": {
+ "lodash": {
+ "version": "4.17.15",
+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
+ "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
+ "dev": true
+ }
+ }
+ },
+ "@sinonjs/text-encoding": {
+ "version": "0.7.1",
+ "resolved": "https://registry.npmjs.org/@sinonjs/text-encoding/-/text-encoding-0.7.1.tgz",
+ "integrity": "sha512-+iTbntw2IZPb/anVDbypzfQa+ay64MW0Zo8aJ8gZPWMMK6/OubMVb6lUPMagqjOPnmtauXnFCACVl3O7ogjeqQ==",
+ "dev": true
+ },
"@types/parsimmon": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/@types/parsimmon/-/parsimmon-1.10.0.tgz",
@@ -271,6 +315,12 @@
"integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=",
"dev": true
},
+ "array-from": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/array-from/-/array-from-2.1.1.tgz",
+ "integrity": "sha1-z+nYwmYoudxa7MYqn12PHzUsEZU=",
+ "dev": true
+ },
"array-slice": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/array-slice/-/array-slice-1.1.0.tgz",
@@ -4821,6 +4871,12 @@
"verror": "1.10.0"
}
},
+ "just-extend": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.0.2.tgz",
+ "integrity": "sha512-FrLwOgm+iXrPV+5zDU6Jqu4gCRXbWEQg2O3SKONsWE4w7AXFRkryS53bpWdaL9cNol+AmR3AEYz6kn+o0fCPnw==",
+ "dev": true
+ },
"kind-of": {
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
@@ -5255,6 +5311,12 @@
"integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=",
"dev": true
},
+ "lolex": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/lolex/-/lolex-4.2.0.tgz",
+ "integrity": "sha512-gKO5uExCXvSm6zbF562EvM+rd1kQDnB9AZBbiQVzf1ZmdDpxUSvpnAaVOP83N/31mRK8Ml8/VE8DMvsAZQ+7wg==",
+ "dev": true
+ },
"longest": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz",
@@ -5708,6 +5770,36 @@
"integrity": "sha1-ozeKdpbOfSI+iPybdkvX7xCJ42Y=",
"dev": true
},
+ "nise": {
+ "version": "1.5.2",
+ "resolved": "https://registry.npmjs.org/nise/-/nise-1.5.2.tgz",
+ "integrity": "sha512-/6RhOUlicRCbE9s+94qCUsyE+pKlVJ5AhIv+jEE7ESKwnbXqulKZ1FYU+XAtHHWE9TinYvAxDUJAb912PwPoWA==",
+ "dev": true,
+ "requires": {
+ "@sinonjs/formatio": "^3.2.1",
+ "@sinonjs/text-encoding": "^0.7.1",
+ "just-extend": "^4.0.2",
+ "lolex": "^4.1.0",
+ "path-to-regexp": "^1.7.0"
+ },
+ "dependencies": {
+ "isarray": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
+ "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=",
+ "dev": true
+ },
+ "path-to-regexp": {
+ "version": "1.8.0",
+ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz",
+ "integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==",
+ "dev": true,
+ "requires": {
+ "isarray": "0.0.1"
+ }
+ }
+ }
+ },
"node-libs-browser": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/node-libs-browser/-/node-libs-browser-0.7.0.tgz",
@@ -7384,6 +7476,32 @@
"integrity": "sha1-Krt1qt453rXMgVzhDmGRFkhQuvA=",
"dev": true
},
+ "sinon": {
+ "version": "7.5.0",
+ "resolved": "https://registry.npmjs.org/sinon/-/sinon-7.5.0.tgz",
+ "integrity": "sha512-AoD0oJWerp0/rY9czP/D6hDTTUYGpObhZjMpd7Cl/A6+j0xBE+ayL/ldfggkBXUs0IkvIiM1ljM8+WkOc5k78Q==",
+ "dev": true,
+ "requires": {
+ "@sinonjs/commons": "^1.4.0",
+ "@sinonjs/formatio": "^3.2.1",
+ "@sinonjs/samsam": "^3.3.3",
+ "diff": "^3.5.0",
+ "lolex": "^4.2.0",
+ "nise": "^1.5.2",
+ "supports-color": "^5.5.0"
+ },
+ "dependencies": {
+ "supports-color": {
+ "version": "5.5.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
+ "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^3.0.0"
+ }
+ }
+ }
+ },
"slash": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz",
diff --git a/package.json b/package.json
index fdac39237..426b40cb2 100644
--- a/package.json
+++ b/package.json
@@ -60,6 +60,7 @@
"mock-stdin": "^0.3.0",
"mustache": "^2.1.3",
"semver": "^5.0.1",
+ "sinon": "^7.5.0",
"typescript": "^3.4.3",
"underscore": "^1.5.1",
"webpack": "^1.12.6",
diff --git a/spec/.eslintrc b/spec/.eslintrc
index 34319f8c1..8d4ed7a2e 100644
--- a/spec/.eslintrc
+++ b/spec/.eslintrc
@@ -28,15 +28,18 @@
"stop": true,
"ok": true,
"strictEqual": true,
- "define": true
+ "define": true,
+ "expect": true,
+ "chai": true
},
"env": {
"mocha": true
},
"rules": {
// Disabling for tests, for now.
- "no-path-concat": 0,
+ "no-path-concat": "off",
- "no-var": 0
+ "no-var": "off",
+ "dot-notation": "off"
}
}
\ No newline at end of file
diff --git a/spec/amd-runtime.html b/spec/amd-runtime.html
index 7cc64f190..fc413bd67 100644
--- a/spec/amd-runtime.html
+++ b/spec/amd-runtime.html
@@ -18,11 +18,14 @@
document.documentElement.className = 'headless';
}
+
+
+
-
diff --git a/spec/amd.html b/spec/amd.html
index 1149dc706..9ec44e686 100644
--- a/spec/amd.html
+++ b/spec/amd.html
@@ -19,11 +19,14 @@
document.documentElement.className = 'headless';
}
+
+
+
-
diff --git a/spec/env/browser.js b/spec/env/browser.js
index 9e54a3977..d1dab0d5e 100644
--- a/spec/env/browser.js
+++ b/spec/env/browser.js
@@ -3,6 +3,15 @@ require('./common');
var fs = require('fs'),
vm = require('vm');
+var chai = require('chai');
+var dirtyChai = require('dirty-chai');
+
+
+chai.use(dirtyChai);
+global.expect = chai.expect;
+
+global.sinon = require('sinon');
+
global.Handlebars = 'no-conflict';
var filename = 'dist/handlebars.js';
diff --git a/spec/env/common.js b/spec/env/common.js
index 9523eaeb2..3903e35d4 100644
--- a/spec/env/common.js
+++ b/spec/env/common.js
@@ -63,12 +63,20 @@ global.compileWithPartials = function(string, hashOrArray, partials) {
};
+/**
+ * @deprecated Use chai's expect-style API instead (`expect(actualValue).to.equal(expectedValue)`)
+ * @see https://www.chaijs.com/api/bdd/
+ */
global.equals = global.equal = function equals(a, b, msg) {
if (a !== b) {
throw new AssertError("'" + a + "' should === '" + b + "'" + (msg ? ': ' + msg : ''), equals);
}
};
+/**
+ * @deprecated Use chai's expect-style API instead (`expect(actualValue).to.equal(expectedValue)`)
+ * @see https://www.chaijs.com/api/bdd/#method_throw
+ */
global.shouldThrow = function(callback, type, msg) {
var failed;
try {
diff --git a/spec/env/node.js b/spec/env/node.js
index 8b97c4d53..0695468ba 100644
--- a/spec/env/node.js
+++ b/spec/env/node.js
@@ -3,9 +3,12 @@ require('./common');
var chai = require('chai');
var dirtyChai = require('dirty-chai');
+
chai.use(dirtyChai);
global.expect = chai.expect;
+global.sinon = require('sinon');
+
global.Handlebars = require('../../lib');
global.CompilerContext = {
diff --git a/spec/index.html b/spec/index.html
index 3528b78d6..b768dff76 100644
--- a/spec/index.html
+++ b/spec/index.html
@@ -19,14 +19,15 @@
document.documentElement.className = 'headless';
}
-
+
+
-
+
+
+
-
diff --git a/spec/umd.html b/spec/umd.html
index 5f3863fc8..53d6b2716 100644
--- a/spec/umd.html
+++ b/spec/umd.html
@@ -18,11 +18,15 @@
document.documentElement.className = 'headless';
}
+
+
+
+
-