Skip to content

Commit d656834

Browse files
authored
Convert tests to vitest (#2127)
* Convert tests to vitest * fix git tests * Cleanup * Convert ignore comments * address code review comments
1 parent 1245255 commit d656834

38 files changed

Lines changed: 3762 additions & 3447 deletions

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,6 @@ jobs:
8585
run: npx grunt prepare
8686

8787
- name: Test
88-
run: npm run test:browser
88+
run: |
89+
npm run test:browser-smoke
90+
npm run test:browser

Gruntfile.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,17 +151,15 @@ module.exports = function (grunt) {
151151
grunt.registerTask('globals', ['webpack']);
152152
grunt.registerTask('release', 'Build final packages', [
153153
'uglify',
154-
'test:min',
155154
'copy:dist',
156155
'copy:components',
157156
]);
158157

159-
grunt.registerTask('on-file-change', ['build', 'concat:tests', 'test']);
158+
grunt.registerTask('on-file-change', ['build', 'concat:tests']);
160159

161160
// === Primary tasks ===
162161
grunt.registerTask('dev', ['clean', 'connect', 'watch']);
163-
grunt.registerTask('default', ['clean', 'build', 'test', 'release']);
164-
grunt.registerTask('test', ['test:bin', 'test:cov']);
162+
grunt.registerTask('default', ['clean', 'build', 'release']);
165163
grunt.registerTask('bench', ['metrics']);
166164
grunt.registerTask('prepare', ['build', 'concat:tests']);
167165
grunt.registerTask(

lib/handlebars/compiler/code-gen.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { isArray } from '../utils';
44
let SourceNode;
55

66
try {
7-
/* istanbul ignore next */
7+
/* v8 ignore next */
88
if (typeof define !== 'function' || !define.amd) {
99
// We don't support this in AMD environments. For these environments, we assume that
1010
// they are running on the browser and thus have no need for the source-map library.
@@ -15,15 +15,15 @@ try {
1515
/* NOP */
1616
}
1717

18-
/* istanbul ignore if: tested but not covered in istanbul due to dist build */
18+
/* v8 ignore next -- tested but not covered due to dist build */
1919
if (!SourceNode) {
2020
SourceNode = function (line, column, srcFile, chunks) {
2121
this.src = '';
2222
if (chunks) {
2323
this.add(chunks);
2424
}
2525
};
26-
/* istanbul ignore next */
26+
/* v8 ignore next */
2727
SourceNode.prototype = {
2828
add: function (chunks) {
2929
if (isArray(chunks)) {

lib/handlebars/compiler/compiler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Compiler.prototype = {
8787
},
8888

8989
accept: function (node) {
90-
/* istanbul ignore next: Sanity code */
90+
/* v8 ignore next -- Sanity code */
9191
if (!this[node.type]) {
9292
throw new Exception('Unknown type: ' + node.type, node);
9393
}

lib/handlebars/compiler/javascript-compiler.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ JavaScriptCompiler.prototype = {
112112
this.source.currentLocation = firstLoc;
113113
this.pushSource('');
114114

115-
/* istanbul ignore next */
115+
/* v8 ignore next */
116116
if (this.stackSlot || this.inlineStack.length || this.compileStack.length) {
117117
throw new Exception('Compile completed with content left on stack');
118118
}
@@ -924,7 +924,7 @@ JavaScriptCompiler.prototype = {
924924
createdStack,
925925
usedLiteral;
926926

927-
/* istanbul ignore next */
927+
/* v8 ignore next */
928928
if (!this.isInline()) {
929929
throw new Exception('replaceStack on non-inline');
930930
}
@@ -972,7 +972,7 @@ JavaScriptCompiler.prototype = {
972972
this.inlineStack = [];
973973
for (let i = 0, len = inlineStack.length; i < len; i++) {
974974
let entry = inlineStack[i];
975-
/* istanbul ignore if */
975+
/* v8 ignore next */
976976
if (entry instanceof Literal) {
977977
this.compileStack.push(entry);
978978
} else {
@@ -994,7 +994,7 @@ JavaScriptCompiler.prototype = {
994994
return item.value;
995995
} else {
996996
if (!inline) {
997-
/* istanbul ignore next */
997+
/* v8 ignore next */
998998
if (!this.stackSlot) {
999999
throw new Exception('Invalid stack pop');
10001000
}
@@ -1008,7 +1008,7 @@ JavaScriptCompiler.prototype = {
10081008
let stack = this.isInline() ? this.inlineStack : this.compileStack,
10091009
item = stack[stack.length - 1];
10101010

1011-
/* istanbul ignore if */
1011+
/* v8 ignore next */
10121012
if (item instanceof Literal) {
10131013
return item.value;
10141014
} else {

lib/handlebars/no-conflict.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export default function (Handlebars) {
22
let $Handlebars = globalThis.Handlebars;
33

4-
/* istanbul ignore next */
4+
/* v8 ignore next */
55
Handlebars.noConflict = function () {
66
if (globalThis.Handlebars === Handlebars) {
77
globalThis.Handlebars = $Handlebars;

lib/handlebars/runtime.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export function checkRevision(compilerInfo) {
4747
}
4848

4949
export function template(templateSpec, env) {
50-
/* istanbul ignore next */
50+
/* v8 ignore next */
5151
if (!env) {
5252
throw new Exception('No environment passed to template');
5353
}

lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function extension(module, filename) {
1919
var templateString = fs.readFileSync(filename, 'utf8');
2020
module.exports = handlebars.compile(templateString);
2121
}
22-
/* istanbul ignore else */
22+
/* v8 ignore next 4 */
2323
if (typeof require !== 'undefined' && require.extensions) {
2424
require.extensions['.handlebars'] = extension;
2525
require.extensions['.hbs'] = extension;

lib/precompiler.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ function loadFiles(opts, callback) {
9595
opts.hasDirectory = true;
9696

9797
fs.readdir(path, function (err, children) {
98-
/* istanbul ignore next : Race condition that being too lazy to test */
98+
/* v8 ignore next -- Race condition that being too lazy to test */
9999
if (err) {
100100
return callback(err);
101101
}
@@ -114,7 +114,7 @@ function loadFiles(opts, callback) {
114114
});
115115
} else {
116116
fs.readFile(path, 'utf8', function (err, data) {
117-
/* istanbul ignore next : Race condition that being too lazy to test */
117+
/* v8 ignore next -- Race condition that being too lazy to test */
118118
if (err) {
119119
return callback(err);
120120
}

nyc.config.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)