Convert tests to vitest (#2127)

* Convert tests to vitest
* fix git tests
* Cleanup
* Convert ignore comments
* address code review comments
This commit is contained in:
Igor Savin
2026-03-02 22:33:52 +02:00
committed by GitHub
parent 1245255892
commit d65683434d
38 changed files with 3453 additions and 3138 deletions
+3 -3
View File
@@ -4,7 +4,7 @@ import { isArray } from '../utils';
let SourceNode;
try {
/* istanbul ignore next */
/* v8 ignore next */
if (typeof define !== 'function' || !define.amd) {
// We don't support this in AMD environments. For these environments, we assume that
// they are running on the browser and thus have no need for the source-map library.
@@ -15,7 +15,7 @@ try {
/* NOP */
}
/* istanbul ignore if: tested but not covered in istanbul due to dist build */
/* v8 ignore next -- tested but not covered due to dist build */
if (!SourceNode) {
SourceNode = function (line, column, srcFile, chunks) {
this.src = '';
@@ -23,7 +23,7 @@ if (!SourceNode) {
this.add(chunks);
}
};
/* istanbul ignore next */
/* v8 ignore next */
SourceNode.prototype = {
add: function (chunks) {
if (isArray(chunks)) {
+1 -1
View File
@@ -87,7 +87,7 @@ Compiler.prototype = {
},
accept: function (node) {
/* istanbul ignore next: Sanity code */
/* v8 ignore next -- Sanity code */
if (!this[node.type]) {
throw new Exception('Unknown type: ' + node.type, node);
}
@@ -112,7 +112,7 @@ JavaScriptCompiler.prototype = {
this.source.currentLocation = firstLoc;
this.pushSource('');
/* istanbul ignore next */
/* v8 ignore next */
if (this.stackSlot || this.inlineStack.length || this.compileStack.length) {
throw new Exception('Compile completed with content left on stack');
}
@@ -924,7 +924,7 @@ JavaScriptCompiler.prototype = {
createdStack,
usedLiteral;
/* istanbul ignore next */
/* v8 ignore next */
if (!this.isInline()) {
throw new Exception('replaceStack on non-inline');
}
@@ -972,7 +972,7 @@ JavaScriptCompiler.prototype = {
this.inlineStack = [];
for (let i = 0, len = inlineStack.length; i < len; i++) {
let entry = inlineStack[i];
/* istanbul ignore if */
/* v8 ignore next */
if (entry instanceof Literal) {
this.compileStack.push(entry);
} else {
@@ -994,7 +994,7 @@ JavaScriptCompiler.prototype = {
return item.value;
} else {
if (!inline) {
/* istanbul ignore next */
/* v8 ignore next */
if (!this.stackSlot) {
throw new Exception('Invalid stack pop');
}
@@ -1008,7 +1008,7 @@ JavaScriptCompiler.prototype = {
let stack = this.isInline() ? this.inlineStack : this.compileStack,
item = stack[stack.length - 1];
/* istanbul ignore if */
/* v8 ignore next */
if (item instanceof Literal) {
return item.value;
} else {
+1 -1
View File
@@ -1,7 +1,7 @@
export default function (Handlebars) {
let $Handlebars = globalThis.Handlebars;
/* istanbul ignore next */
/* v8 ignore next */
Handlebars.noConflict = function () {
if (globalThis.Handlebars === Handlebars) {
globalThis.Handlebars = $Handlebars;
+1 -1
View File
@@ -47,7 +47,7 @@ export function checkRevision(compilerInfo) {
}
export function template(templateSpec, env) {
/* istanbul ignore next */
/* v8 ignore next */
if (!env) {
throw new Exception('No environment passed to template');
}