vitest 0.0.112 → 0.0.113

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { c, s as slash$1, i as isAbsolute, r as relative, d as dirname, b as basename, g as getFullName, a as getTests, f as getSuites, h as resolve, n as noop$1, t as toArray, j as hasFailed } from './utils-cb6b1266.js';
1
+ import { i as isAbsolute, r as relative, d as dirname, b as basename, a as resolve } from './index-1488b423.js';
2
2
  import { createServer, mergeConfig } from 'vite';
3
3
  import path$a from 'path';
4
4
  import process$1 from 'process';
@@ -7,9 +7,11 @@ import require$$0 from 'os';
7
7
  import require$$0$1 from 'util';
8
8
  import require$$0$2 from 'stream';
9
9
  import require$$2 from 'events';
10
- import { d as defaultInclude, a as defaultExclude, b as defaultPort, c as distDir, e as configFiles } from './constants-2b0310b7.js';
10
+ import { c, s as slash$1, g as getFullName, h as hasFailed, a as getSuites, b as getTests, n as noop$1, t as toArray } from './index-041e627e.js';
11
+ import { d as defaultInclude, a as defaultExclude, b as defaultPort, c as distDir, e as configFiles } from './constants-900abe4a.js';
12
+ import MagicString from './magic-string.es-94000aea.js';
11
13
  import { performance } from 'perf_hooks';
12
- import { F as F_POINTER, a as F_DOWN, s as stripAnsi, b as F_LONG_DASH, c as F_DOWN_RIGHT, d as F_DOT, e as F_CHECK, f as F_CROSS, g as F_RIGHT, p as printError, h as stringWidth, i as ansiStyles, j as sliceAnsi, k as cliTruncate } from './diff-66d6bb83.js';
14
+ import { F as F_POINTER, a as F_DOWN, s as stripAnsi, b as F_LONG_DASH, c as F_DOWN_RIGHT, d as F_DOT, e as F_CHECK, f as F_CROSS, g as F_RIGHT, p as printError, h as stringWidth, i as ansiStyles, j as sliceAnsi, k as cliTruncate } from './diff-9c43ab50.js';
13
15
  import { o as onetime, s as signalExit } from './index-61c8686f.js';
14
16
  import { MessageChannel } from 'worker_threads';
15
17
  import { pathToFileURL } from 'url';
@@ -411,7 +413,7 @@ var isExtglob$1 = function isExtglob(str) {
411
413
  */
412
414
 
413
415
  var isExtglob = isExtglob$1;
414
- var chars$1 = { '{': '}', '(': ')', '[': ']'};
416
+ var chars = { '{': '}', '(': ')', '[': ']'};
415
417
  var strictCheck = function(str) {
416
418
  if (str[0] === '!') {
417
419
  return true;
@@ -484,7 +486,7 @@ var strictCheck = function(str) {
484
486
  if (str[index] === '\\') {
485
487
  var open = str[index + 1];
486
488
  index += 2;
487
- var close = chars$1[open];
489
+ var close = chars[open];
488
490
 
489
491
  if (close) {
490
492
  var n = str.indexOf(close, index);
@@ -516,7 +518,7 @@ var relaxedCheck = function(str) {
516
518
  if (str[index] === '\\') {
517
519
  var open = str[index + 1];
518
520
  index += 2;
519
- var close = chars$1[open];
521
+ var close = chars[open];
520
522
 
521
523
  if (close) {
522
524
  var n = str.indexOf(close, index);
@@ -1055,7 +1057,7 @@ var toRegexRange_1 = toRegexRange$1;
1055
1057
  const util$1 = require$$0$1;
1056
1058
  const toRegexRange = toRegexRange_1;
1057
1059
 
1058
- const isObject$2 = val => val !== null && typeof val === 'object' && !Array.isArray(val);
1060
+ const isObject$1 = val => val !== null && typeof val === 'object' && !Array.isArray(val);
1059
1061
 
1060
1062
  const transform = toNumber => {
1061
1063
  return value => toNumber === true ? Number(value) : String(value);
@@ -1271,7 +1273,7 @@ const fill$2 = (start, end, step, options = {}) => {
1271
1273
  return fill$2(start, end, 1, { transform: step });
1272
1274
  }
1273
1275
 
1274
- if (isObject$2(step)) {
1276
+ if (isObject$1(step)) {
1275
1277
  return fill$2(start, end, 0, step);
1276
1278
  }
1277
1279
 
@@ -1280,7 +1282,7 @@ const fill$2 = (start, end, step, options = {}) => {
1280
1282
  step = step || opts.step || 1;
1281
1283
 
1282
1284
  if (!isNumber(step)) {
1283
- if (step != null && !isObject$2(step)) return invalidStep(step, opts);
1285
+ if (step != null && !isObject$1(step)) return invalidStep(step, opts);
1284
1286
  return fill$2(start, end, 1, step);
1285
1287
  }
1286
1288
 
@@ -3739,7 +3741,7 @@ const scan = scan_1;
3739
3741
  const parse = parse_1;
3740
3742
  const utils$c = utils$f;
3741
3743
  const constants$1 = constants$3;
3742
- const isObject$1 = val => val && typeof val === 'object' && !Array.isArray(val);
3744
+ const isObject = val => val && typeof val === 'object' && !Array.isArray(val);
3743
3745
 
3744
3746
  /**
3745
3747
  * Creates a matcher function from one or more glob patterns. The
@@ -3776,7 +3778,7 @@ const picomatch$2 = (glob, options, returnState = false) => {
3776
3778
  return arrayMatcher;
3777
3779
  }
3778
3780
 
3779
- const isState = isObject$1(glob) && glob.tokens && glob.input;
3781
+ const isState = isObject(glob) && glob.tokens && glob.input;
3780
3782
 
3781
3783
  if (glob === '' || (typeof glob !== 'string' && !isState)) {
3782
3784
  throw new TypeError('Expected pattern to be a non-empty string');
@@ -6750,1079 +6752,6 @@ function addSnapshotResult(summary, result) {
6750
6752
  summary.total += result.added + result.matched + result.unmatched + result.updated;
6751
6753
  }
6752
6754
 
6753
- var charToInteger = {};
6754
- var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
6755
- for (var i = 0; i < chars.length; i++) {
6756
- charToInteger[chars.charCodeAt(i)] = i;
6757
- }
6758
- function encode(decoded) {
6759
- var sourceFileIndex = 0; // second field
6760
- var sourceCodeLine = 0; // third field
6761
- var sourceCodeColumn = 0; // fourth field
6762
- var nameIndex = 0; // fifth field
6763
- var mappings = '';
6764
- for (var i = 0; i < decoded.length; i++) {
6765
- var line = decoded[i];
6766
- if (i > 0)
6767
- mappings += ';';
6768
- if (line.length === 0)
6769
- continue;
6770
- var generatedCodeColumn = 0; // first field
6771
- var lineMappings = [];
6772
- for (var _i = 0, line_1 = line; _i < line_1.length; _i++) {
6773
- var segment = line_1[_i];
6774
- var segmentMappings = encodeInteger(segment[0] - generatedCodeColumn);
6775
- generatedCodeColumn = segment[0];
6776
- if (segment.length > 1) {
6777
- segmentMappings +=
6778
- encodeInteger(segment[1] - sourceFileIndex) +
6779
- encodeInteger(segment[2] - sourceCodeLine) +
6780
- encodeInteger(segment[3] - sourceCodeColumn);
6781
- sourceFileIndex = segment[1];
6782
- sourceCodeLine = segment[2];
6783
- sourceCodeColumn = segment[3];
6784
- }
6785
- if (segment.length === 5) {
6786
- segmentMappings += encodeInteger(segment[4] - nameIndex);
6787
- nameIndex = segment[4];
6788
- }
6789
- lineMappings.push(segmentMappings);
6790
- }
6791
- mappings += lineMappings.join(',');
6792
- }
6793
- return mappings;
6794
- }
6795
- function encodeInteger(num) {
6796
- var result = '';
6797
- num = num < 0 ? (-num << 1) | 1 : num << 1;
6798
- do {
6799
- var clamped = num & 31;
6800
- num >>>= 5;
6801
- if (num > 0) {
6802
- clamped |= 32;
6803
- }
6804
- result += chars[clamped];
6805
- } while (num > 0);
6806
- return result;
6807
- }
6808
-
6809
- var BitSet = function BitSet(arg) {
6810
- this.bits = arg instanceof BitSet ? arg.bits.slice() : [];
6811
- };
6812
-
6813
- BitSet.prototype.add = function add (n) {
6814
- this.bits[n >> 5] |= 1 << (n & 31);
6815
- };
6816
-
6817
- BitSet.prototype.has = function has (n) {
6818
- return !!(this.bits[n >> 5] & (1 << (n & 31)));
6819
- };
6820
-
6821
- var Chunk = function Chunk(start, end, content) {
6822
- this.start = start;
6823
- this.end = end;
6824
- this.original = content;
6825
-
6826
- this.intro = '';
6827
- this.outro = '';
6828
-
6829
- this.content = content;
6830
- this.storeName = false;
6831
- this.edited = false;
6832
-
6833
- // we make these non-enumerable, for sanity while debugging
6834
- Object.defineProperties(this, {
6835
- previous: { writable: true, value: null },
6836
- next: { writable: true, value: null }
6837
- });
6838
- };
6839
-
6840
- Chunk.prototype.appendLeft = function appendLeft (content) {
6841
- this.outro += content;
6842
- };
6843
-
6844
- Chunk.prototype.appendRight = function appendRight (content) {
6845
- this.intro = this.intro + content;
6846
- };
6847
-
6848
- Chunk.prototype.clone = function clone () {
6849
- var chunk = new Chunk(this.start, this.end, this.original);
6850
-
6851
- chunk.intro = this.intro;
6852
- chunk.outro = this.outro;
6853
- chunk.content = this.content;
6854
- chunk.storeName = this.storeName;
6855
- chunk.edited = this.edited;
6856
-
6857
- return chunk;
6858
- };
6859
-
6860
- Chunk.prototype.contains = function contains (index) {
6861
- return this.start < index && index < this.end;
6862
- };
6863
-
6864
- Chunk.prototype.eachNext = function eachNext (fn) {
6865
- var chunk = this;
6866
- while (chunk) {
6867
- fn(chunk);
6868
- chunk = chunk.next;
6869
- }
6870
- };
6871
-
6872
- Chunk.prototype.eachPrevious = function eachPrevious (fn) {
6873
- var chunk = this;
6874
- while (chunk) {
6875
- fn(chunk);
6876
- chunk = chunk.previous;
6877
- }
6878
- };
6879
-
6880
- Chunk.prototype.edit = function edit (content, storeName, contentOnly) {
6881
- this.content = content;
6882
- if (!contentOnly) {
6883
- this.intro = '';
6884
- this.outro = '';
6885
- }
6886
- this.storeName = storeName;
6887
-
6888
- this.edited = true;
6889
-
6890
- return this;
6891
- };
6892
-
6893
- Chunk.prototype.prependLeft = function prependLeft (content) {
6894
- this.outro = content + this.outro;
6895
- };
6896
-
6897
- Chunk.prototype.prependRight = function prependRight (content) {
6898
- this.intro = content + this.intro;
6899
- };
6900
-
6901
- Chunk.prototype.split = function split (index) {
6902
- var sliceIndex = index - this.start;
6903
-
6904
- var originalBefore = this.original.slice(0, sliceIndex);
6905
- var originalAfter = this.original.slice(sliceIndex);
6906
-
6907
- this.original = originalBefore;
6908
-
6909
- var newChunk = new Chunk(index, this.end, originalAfter);
6910
- newChunk.outro = this.outro;
6911
- this.outro = '';
6912
-
6913
- this.end = index;
6914
-
6915
- if (this.edited) {
6916
- // TODO is this block necessary?...
6917
- newChunk.edit('', false);
6918
- this.content = '';
6919
- } else {
6920
- this.content = originalBefore;
6921
- }
6922
-
6923
- newChunk.next = this.next;
6924
- if (newChunk.next) { newChunk.next.previous = newChunk; }
6925
- newChunk.previous = this;
6926
- this.next = newChunk;
6927
-
6928
- return newChunk;
6929
- };
6930
-
6931
- Chunk.prototype.toString = function toString () {
6932
- return this.intro + this.content + this.outro;
6933
- };
6934
-
6935
- Chunk.prototype.trimEnd = function trimEnd (rx) {
6936
- this.outro = this.outro.replace(rx, '');
6937
- if (this.outro.length) { return true; }
6938
-
6939
- var trimmed = this.content.replace(rx, '');
6940
-
6941
- if (trimmed.length) {
6942
- if (trimmed !== this.content) {
6943
- this.split(this.start + trimmed.length).edit('', undefined, true);
6944
- }
6945
- return true;
6946
-
6947
- } else {
6948
- this.edit('', undefined, true);
6949
-
6950
- this.intro = this.intro.replace(rx, '');
6951
- if (this.intro.length) { return true; }
6952
- }
6953
- };
6954
-
6955
- Chunk.prototype.trimStart = function trimStart (rx) {
6956
- this.intro = this.intro.replace(rx, '');
6957
- if (this.intro.length) { return true; }
6958
-
6959
- var trimmed = this.content.replace(rx, '');
6960
-
6961
- if (trimmed.length) {
6962
- if (trimmed !== this.content) {
6963
- this.split(this.end - trimmed.length);
6964
- this.edit('', undefined, true);
6965
- }
6966
- return true;
6967
-
6968
- } else {
6969
- this.edit('', undefined, true);
6970
-
6971
- this.outro = this.outro.replace(rx, '');
6972
- if (this.outro.length) { return true; }
6973
- }
6974
- };
6975
-
6976
- var btoa = function () {
6977
- throw new Error('Unsupported environment: `window.btoa` or `Buffer` should be supported.');
6978
- };
6979
- if (typeof window !== 'undefined' && typeof window.btoa === 'function') {
6980
- btoa = function (str) { return window.btoa(unescape(encodeURIComponent(str))); };
6981
- } else if (typeof Buffer === 'function') {
6982
- btoa = function (str) { return Buffer.from(str, 'utf-8').toString('base64'); };
6983
- }
6984
-
6985
- var SourceMap = function SourceMap(properties) {
6986
- this.version = 3;
6987
- this.file = properties.file;
6988
- this.sources = properties.sources;
6989
- this.sourcesContent = properties.sourcesContent;
6990
- this.names = properties.names;
6991
- this.mappings = encode(properties.mappings);
6992
- };
6993
-
6994
- SourceMap.prototype.toString = function toString () {
6995
- return JSON.stringify(this);
6996
- };
6997
-
6998
- SourceMap.prototype.toUrl = function toUrl () {
6999
- return 'data:application/json;charset=utf-8;base64,' + btoa(this.toString());
7000
- };
7001
-
7002
- function guessIndent(code) {
7003
- var lines = code.split('\n');
7004
-
7005
- var tabbed = lines.filter(function (line) { return /^\t+/.test(line); });
7006
- var spaced = lines.filter(function (line) { return /^ {2,}/.test(line); });
7007
-
7008
- if (tabbed.length === 0 && spaced.length === 0) {
7009
- return null;
7010
- }
7011
-
7012
- // More lines tabbed than spaced? Assume tabs, and
7013
- // default to tabs in the case of a tie (or nothing
7014
- // to go on)
7015
- if (tabbed.length >= spaced.length) {
7016
- return '\t';
7017
- }
7018
-
7019
- // Otherwise, we need to guess the multiple
7020
- var min = spaced.reduce(function (previous, current) {
7021
- var numSpaces = /^ +/.exec(current)[0].length;
7022
- return Math.min(numSpaces, previous);
7023
- }, Infinity);
7024
-
7025
- return new Array(min + 1).join(' ');
7026
- }
7027
-
7028
- function getRelativePath(from, to) {
7029
- var fromParts = from.split(/[/\\]/);
7030
- var toParts = to.split(/[/\\]/);
7031
-
7032
- fromParts.pop(); // get dirname
7033
-
7034
- while (fromParts[0] === toParts[0]) {
7035
- fromParts.shift();
7036
- toParts.shift();
7037
- }
7038
-
7039
- if (fromParts.length) {
7040
- var i = fromParts.length;
7041
- while (i--) { fromParts[i] = '..'; }
7042
- }
7043
-
7044
- return fromParts.concat(toParts).join('/');
7045
- }
7046
-
7047
- var toString = Object.prototype.toString;
7048
-
7049
- function isObject(thing) {
7050
- return toString.call(thing) === '[object Object]';
7051
- }
7052
-
7053
- function getLocator(source) {
7054
- var originalLines = source.split('\n');
7055
- var lineOffsets = [];
7056
-
7057
- for (var i = 0, pos = 0; i < originalLines.length; i++) {
7058
- lineOffsets.push(pos);
7059
- pos += originalLines[i].length + 1;
7060
- }
7061
-
7062
- return function locate(index) {
7063
- var i = 0;
7064
- var j = lineOffsets.length;
7065
- while (i < j) {
7066
- var m = (i + j) >> 1;
7067
- if (index < lineOffsets[m]) {
7068
- j = m;
7069
- } else {
7070
- i = m + 1;
7071
- }
7072
- }
7073
- var line = i - 1;
7074
- var column = index - lineOffsets[line];
7075
- return { line: line, column: column };
7076
- };
7077
- }
7078
-
7079
- var Mappings = function Mappings(hires) {
7080
- this.hires = hires;
7081
- this.generatedCodeLine = 0;
7082
- this.generatedCodeColumn = 0;
7083
- this.raw = [];
7084
- this.rawSegments = this.raw[this.generatedCodeLine] = [];
7085
- this.pending = null;
7086
- };
7087
-
7088
- Mappings.prototype.addEdit = function addEdit (sourceIndex, content, loc, nameIndex) {
7089
- if (content.length) {
7090
- var segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
7091
- if (nameIndex >= 0) {
7092
- segment.push(nameIndex);
7093
- }
7094
- this.rawSegments.push(segment);
7095
- } else if (this.pending) {
7096
- this.rawSegments.push(this.pending);
7097
- }
7098
-
7099
- this.advance(content);
7100
- this.pending = null;
7101
- };
7102
-
7103
- Mappings.prototype.addUneditedChunk = function addUneditedChunk (sourceIndex, chunk, original, loc, sourcemapLocations) {
7104
- var originalCharIndex = chunk.start;
7105
- var first = true;
7106
-
7107
- while (originalCharIndex < chunk.end) {
7108
- if (this.hires || first || sourcemapLocations.has(originalCharIndex)) {
7109
- this.rawSegments.push([this.generatedCodeColumn, sourceIndex, loc.line, loc.column]);
7110
- }
7111
-
7112
- if (original[originalCharIndex] === '\n') {
7113
- loc.line += 1;
7114
- loc.column = 0;
7115
- this.generatedCodeLine += 1;
7116
- this.raw[this.generatedCodeLine] = this.rawSegments = [];
7117
- this.generatedCodeColumn = 0;
7118
- first = true;
7119
- } else {
7120
- loc.column += 1;
7121
- this.generatedCodeColumn += 1;
7122
- first = false;
7123
- }
7124
-
7125
- originalCharIndex += 1;
7126
- }
7127
-
7128
- this.pending = null;
7129
- };
7130
-
7131
- Mappings.prototype.advance = function advance (str) {
7132
- if (!str) { return; }
7133
-
7134
- var lines = str.split('\n');
7135
-
7136
- if (lines.length > 1) {
7137
- for (var i = 0; i < lines.length - 1; i++) {
7138
- this.generatedCodeLine++;
7139
- this.raw[this.generatedCodeLine] = this.rawSegments = [];
7140
- }
7141
- this.generatedCodeColumn = 0;
7142
- }
7143
-
7144
- this.generatedCodeColumn += lines[lines.length - 1].length;
7145
- };
7146
-
7147
- var n = '\n';
7148
-
7149
- var warned = {
7150
- insertLeft: false,
7151
- insertRight: false,
7152
- storeName: false
7153
- };
7154
-
7155
- var MagicString = function MagicString(string, options) {
7156
- if ( options === void 0 ) options = {};
7157
-
7158
- var chunk = new Chunk(0, string.length, string);
7159
-
7160
- Object.defineProperties(this, {
7161
- original: { writable: true, value: string },
7162
- outro: { writable: true, value: '' },
7163
- intro: { writable: true, value: '' },
7164
- firstChunk: { writable: true, value: chunk },
7165
- lastChunk: { writable: true, value: chunk },
7166
- lastSearchedChunk: { writable: true, value: chunk },
7167
- byStart: { writable: true, value: {} },
7168
- byEnd: { writable: true, value: {} },
7169
- filename: { writable: true, value: options.filename },
7170
- indentExclusionRanges: { writable: true, value: options.indentExclusionRanges },
7171
- sourcemapLocations: { writable: true, value: new BitSet() },
7172
- storedNames: { writable: true, value: {} },
7173
- indentStr: { writable: true, value: guessIndent(string) }
7174
- });
7175
-
7176
- this.byStart[0] = chunk;
7177
- this.byEnd[string.length] = chunk;
7178
- };
7179
-
7180
- MagicString.prototype.addSourcemapLocation = function addSourcemapLocation (char) {
7181
- this.sourcemapLocations.add(char);
7182
- };
7183
-
7184
- MagicString.prototype.append = function append (content) {
7185
- if (typeof content !== 'string') { throw new TypeError('outro content must be a string'); }
7186
-
7187
- this.outro += content;
7188
- return this;
7189
- };
7190
-
7191
- MagicString.prototype.appendLeft = function appendLeft (index, content) {
7192
- if (typeof content !== 'string') { throw new TypeError('inserted content must be a string'); }
7193
-
7194
- this._split(index);
7195
-
7196
- var chunk = this.byEnd[index];
7197
-
7198
- if (chunk) {
7199
- chunk.appendLeft(content);
7200
- } else {
7201
- this.intro += content;
7202
- }
7203
- return this;
7204
- };
7205
-
7206
- MagicString.prototype.appendRight = function appendRight (index, content) {
7207
- if (typeof content !== 'string') { throw new TypeError('inserted content must be a string'); }
7208
-
7209
- this._split(index);
7210
-
7211
- var chunk = this.byStart[index];
7212
-
7213
- if (chunk) {
7214
- chunk.appendRight(content);
7215
- } else {
7216
- this.outro += content;
7217
- }
7218
- return this;
7219
- };
7220
-
7221
- MagicString.prototype.clone = function clone () {
7222
- var cloned = new MagicString(this.original, { filename: this.filename });
7223
-
7224
- var originalChunk = this.firstChunk;
7225
- var clonedChunk = (cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone());
7226
-
7227
- while (originalChunk) {
7228
- cloned.byStart[clonedChunk.start] = clonedChunk;
7229
- cloned.byEnd[clonedChunk.end] = clonedChunk;
7230
-
7231
- var nextOriginalChunk = originalChunk.next;
7232
- var nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone();
7233
-
7234
- if (nextClonedChunk) {
7235
- clonedChunk.next = nextClonedChunk;
7236
- nextClonedChunk.previous = clonedChunk;
7237
-
7238
- clonedChunk = nextClonedChunk;
7239
- }
7240
-
7241
- originalChunk = nextOriginalChunk;
7242
- }
7243
-
7244
- cloned.lastChunk = clonedChunk;
7245
-
7246
- if (this.indentExclusionRanges) {
7247
- cloned.indentExclusionRanges = this.indentExclusionRanges.slice();
7248
- }
7249
-
7250
- cloned.sourcemapLocations = new BitSet(this.sourcemapLocations);
7251
-
7252
- cloned.intro = this.intro;
7253
- cloned.outro = this.outro;
7254
-
7255
- return cloned;
7256
- };
7257
-
7258
- MagicString.prototype.generateDecodedMap = function generateDecodedMap (options) {
7259
- var this$1$1 = this;
7260
-
7261
- options = options || {};
7262
-
7263
- var sourceIndex = 0;
7264
- var names = Object.keys(this.storedNames);
7265
- var mappings = new Mappings(options.hires);
7266
-
7267
- var locate = getLocator(this.original);
7268
-
7269
- if (this.intro) {
7270
- mappings.advance(this.intro);
7271
- }
7272
-
7273
- this.firstChunk.eachNext(function (chunk) {
7274
- var loc = locate(chunk.start);
7275
-
7276
- if (chunk.intro.length) { mappings.advance(chunk.intro); }
7277
-
7278
- if (chunk.edited) {
7279
- mappings.addEdit(
7280
- sourceIndex,
7281
- chunk.content,
7282
- loc,
7283
- chunk.storeName ? names.indexOf(chunk.original) : -1
7284
- );
7285
- } else {
7286
- mappings.addUneditedChunk(sourceIndex, chunk, this$1$1.original, loc, this$1$1.sourcemapLocations);
7287
- }
7288
-
7289
- if (chunk.outro.length) { mappings.advance(chunk.outro); }
7290
- });
7291
-
7292
- return {
7293
- file: options.file ? options.file.split(/[/\\]/).pop() : null,
7294
- sources: [options.source ? getRelativePath(options.file || '', options.source) : null],
7295
- sourcesContent: options.includeContent ? [this.original] : [null],
7296
- names: names,
7297
- mappings: mappings.raw
7298
- };
7299
- };
7300
-
7301
- MagicString.prototype.generateMap = function generateMap (options) {
7302
- return new SourceMap(this.generateDecodedMap(options));
7303
- };
7304
-
7305
- MagicString.prototype.getIndentString = function getIndentString () {
7306
- return this.indentStr === null ? '\t' : this.indentStr;
7307
- };
7308
-
7309
- MagicString.prototype.indent = function indent (indentStr, options) {
7310
- var pattern = /^[^\r\n]/gm;
7311
-
7312
- if (isObject(indentStr)) {
7313
- options = indentStr;
7314
- indentStr = undefined;
7315
- }
7316
-
7317
- indentStr = indentStr !== undefined ? indentStr : this.indentStr || '\t';
7318
-
7319
- if (indentStr === '') { return this; } // noop
7320
-
7321
- options = options || {};
7322
-
7323
- // Process exclusion ranges
7324
- var isExcluded = {};
7325
-
7326
- if (options.exclude) {
7327
- var exclusions =
7328
- typeof options.exclude[0] === 'number' ? [options.exclude] : options.exclude;
7329
- exclusions.forEach(function (exclusion) {
7330
- for (var i = exclusion[0]; i < exclusion[1]; i += 1) {
7331
- isExcluded[i] = true;
7332
- }
7333
- });
7334
- }
7335
-
7336
- var shouldIndentNextCharacter = options.indentStart !== false;
7337
- var replacer = function (match) {
7338
- if (shouldIndentNextCharacter) { return ("" + indentStr + match); }
7339
- shouldIndentNextCharacter = true;
7340
- return match;
7341
- };
7342
-
7343
- this.intro = this.intro.replace(pattern, replacer);
7344
-
7345
- var charIndex = 0;
7346
- var chunk = this.firstChunk;
7347
-
7348
- while (chunk) {
7349
- var end = chunk.end;
7350
-
7351
- if (chunk.edited) {
7352
- if (!isExcluded[charIndex]) {
7353
- chunk.content = chunk.content.replace(pattern, replacer);
7354
-
7355
- if (chunk.content.length) {
7356
- shouldIndentNextCharacter = chunk.content[chunk.content.length - 1] === '\n';
7357
- }
7358
- }
7359
- } else {
7360
- charIndex = chunk.start;
7361
-
7362
- while (charIndex < end) {
7363
- if (!isExcluded[charIndex]) {
7364
- var char = this.original[charIndex];
7365
-
7366
- if (char === '\n') {
7367
- shouldIndentNextCharacter = true;
7368
- } else if (char !== '\r' && shouldIndentNextCharacter) {
7369
- shouldIndentNextCharacter = false;
7370
-
7371
- if (charIndex === chunk.start) {
7372
- chunk.prependRight(indentStr);
7373
- } else {
7374
- this._splitChunk(chunk, charIndex);
7375
- chunk = chunk.next;
7376
- chunk.prependRight(indentStr);
7377
- }
7378
- }
7379
- }
7380
-
7381
- charIndex += 1;
7382
- }
7383
- }
7384
-
7385
- charIndex = chunk.end;
7386
- chunk = chunk.next;
7387
- }
7388
-
7389
- this.outro = this.outro.replace(pattern, replacer);
7390
-
7391
- return this;
7392
- };
7393
-
7394
- MagicString.prototype.insert = function insert () {
7395
- throw new Error('magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)');
7396
- };
7397
-
7398
- MagicString.prototype.insertLeft = function insertLeft (index, content) {
7399
- if (!warned.insertLeft) {
7400
- console.warn('magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead'); // eslint-disable-line no-console
7401
- warned.insertLeft = true;
7402
- }
7403
-
7404
- return this.appendLeft(index, content);
7405
- };
7406
-
7407
- MagicString.prototype.insertRight = function insertRight (index, content) {
7408
- if (!warned.insertRight) {
7409
- console.warn('magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead'); // eslint-disable-line no-console
7410
- warned.insertRight = true;
7411
- }
7412
-
7413
- return this.prependRight(index, content);
7414
- };
7415
-
7416
- MagicString.prototype.move = function move (start, end, index) {
7417
- if (index >= start && index <= end) { throw new Error('Cannot move a selection inside itself'); }
7418
-
7419
- this._split(start);
7420
- this._split(end);
7421
- this._split(index);
7422
-
7423
- var first = this.byStart[start];
7424
- var last = this.byEnd[end];
7425
-
7426
- var oldLeft = first.previous;
7427
- var oldRight = last.next;
7428
-
7429
- var newRight = this.byStart[index];
7430
- if (!newRight && last === this.lastChunk) { return this; }
7431
- var newLeft = newRight ? newRight.previous : this.lastChunk;
7432
-
7433
- if (oldLeft) { oldLeft.next = oldRight; }
7434
- if (oldRight) { oldRight.previous = oldLeft; }
7435
-
7436
- if (newLeft) { newLeft.next = first; }
7437
- if (newRight) { newRight.previous = last; }
7438
-
7439
- if (!first.previous) { this.firstChunk = last.next; }
7440
- if (!last.next) {
7441
- this.lastChunk = first.previous;
7442
- this.lastChunk.next = null;
7443
- }
7444
-
7445
- first.previous = newLeft;
7446
- last.next = newRight || null;
7447
-
7448
- if (!newLeft) { this.firstChunk = first; }
7449
- if (!newRight) { this.lastChunk = last; }
7450
- return this;
7451
- };
7452
-
7453
- MagicString.prototype.overwrite = function overwrite (start, end, content, options) {
7454
- if (typeof content !== 'string') { throw new TypeError('replacement content must be a string'); }
7455
-
7456
- while (start < 0) { start += this.original.length; }
7457
- while (end < 0) { end += this.original.length; }
7458
-
7459
- if (end > this.original.length) { throw new Error('end is out of bounds'); }
7460
- if (start === end)
7461
- { throw new Error('Cannot overwrite a zero-length range – use appendLeft or prependRight instead'); }
7462
-
7463
- this._split(start);
7464
- this._split(end);
7465
-
7466
- if (options === true) {
7467
- if (!warned.storeName) {
7468
- console.warn('The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string'); // eslint-disable-line no-console
7469
- warned.storeName = true;
7470
- }
7471
-
7472
- options = { storeName: true };
7473
- }
7474
- var storeName = options !== undefined ? options.storeName : false;
7475
- var contentOnly = options !== undefined ? options.contentOnly : false;
7476
-
7477
- if (storeName) {
7478
- var original = this.original.slice(start, end);
7479
- this.storedNames[original] = true;
7480
- }
7481
-
7482
- var first = this.byStart[start];
7483
- var last = this.byEnd[end];
7484
-
7485
- if (first) {
7486
- if (end > first.end && first.next !== this.byStart[first.end]) {
7487
- throw new Error('Cannot overwrite across a split point');
7488
- }
7489
-
7490
- first.edit(content, storeName, contentOnly);
7491
-
7492
- if (first !== last) {
7493
- var chunk = first.next;
7494
- while (chunk !== last) {
7495
- chunk.edit('', false);
7496
- chunk = chunk.next;
7497
- }
7498
-
7499
- chunk.edit('', false);
7500
- }
7501
- } else {
7502
- // must be inserting at the end
7503
- var newChunk = new Chunk(start, end, '').edit(content, storeName);
7504
-
7505
- // TODO last chunk in the array may not be the last chunk, if it's moved...
7506
- last.next = newChunk;
7507
- newChunk.previous = last;
7508
- }
7509
- return this;
7510
- };
7511
-
7512
- MagicString.prototype.prepend = function prepend (content) {
7513
- if (typeof content !== 'string') { throw new TypeError('outro content must be a string'); }
7514
-
7515
- this.intro = content + this.intro;
7516
- return this;
7517
- };
7518
-
7519
- MagicString.prototype.prependLeft = function prependLeft (index, content) {
7520
- if (typeof content !== 'string') { throw new TypeError('inserted content must be a string'); }
7521
-
7522
- this._split(index);
7523
-
7524
- var chunk = this.byEnd[index];
7525
-
7526
- if (chunk) {
7527
- chunk.prependLeft(content);
7528
- } else {
7529
- this.intro = content + this.intro;
7530
- }
7531
- return this;
7532
- };
7533
-
7534
- MagicString.prototype.prependRight = function prependRight (index, content) {
7535
- if (typeof content !== 'string') { throw new TypeError('inserted content must be a string'); }
7536
-
7537
- this._split(index);
7538
-
7539
- var chunk = this.byStart[index];
7540
-
7541
- if (chunk) {
7542
- chunk.prependRight(content);
7543
- } else {
7544
- this.outro = content + this.outro;
7545
- }
7546
- return this;
7547
- };
7548
-
7549
- MagicString.prototype.remove = function remove (start, end) {
7550
- while (start < 0) { start += this.original.length; }
7551
- while (end < 0) { end += this.original.length; }
7552
-
7553
- if (start === end) { return this; }
7554
-
7555
- if (start < 0 || end > this.original.length) { throw new Error('Character is out of bounds'); }
7556
- if (start > end) { throw new Error('end must be greater than start'); }
7557
-
7558
- this._split(start);
7559
- this._split(end);
7560
-
7561
- var chunk = this.byStart[start];
7562
-
7563
- while (chunk) {
7564
- chunk.intro = '';
7565
- chunk.outro = '';
7566
- chunk.edit('');
7567
-
7568
- chunk = end > chunk.end ? this.byStart[chunk.end] : null;
7569
- }
7570
- return this;
7571
- };
7572
-
7573
- MagicString.prototype.lastChar = function lastChar () {
7574
- if (this.outro.length)
7575
- { return this.outro[this.outro.length - 1]; }
7576
- var chunk = this.lastChunk;
7577
- do {
7578
- if (chunk.outro.length)
7579
- { return chunk.outro[chunk.outro.length - 1]; }
7580
- if (chunk.content.length)
7581
- { return chunk.content[chunk.content.length - 1]; }
7582
- if (chunk.intro.length)
7583
- { return chunk.intro[chunk.intro.length - 1]; }
7584
- } while (chunk = chunk.previous);
7585
- if (this.intro.length)
7586
- { return this.intro[this.intro.length - 1]; }
7587
- return '';
7588
- };
7589
-
7590
- MagicString.prototype.lastLine = function lastLine () {
7591
- var lineIndex = this.outro.lastIndexOf(n);
7592
- if (lineIndex !== -1)
7593
- { return this.outro.substr(lineIndex + 1); }
7594
- var lineStr = this.outro;
7595
- var chunk = this.lastChunk;
7596
- do {
7597
- if (chunk.outro.length > 0) {
7598
- lineIndex = chunk.outro.lastIndexOf(n);
7599
- if (lineIndex !== -1)
7600
- { return chunk.outro.substr(lineIndex + 1) + lineStr; }
7601
- lineStr = chunk.outro + lineStr;
7602
- }
7603
-
7604
- if (chunk.content.length > 0) {
7605
- lineIndex = chunk.content.lastIndexOf(n);
7606
- if (lineIndex !== -1)
7607
- { return chunk.content.substr(lineIndex + 1) + lineStr; }
7608
- lineStr = chunk.content + lineStr;
7609
- }
7610
-
7611
- if (chunk.intro.length > 0) {
7612
- lineIndex = chunk.intro.lastIndexOf(n);
7613
- if (lineIndex !== -1)
7614
- { return chunk.intro.substr(lineIndex + 1) + lineStr; }
7615
- lineStr = chunk.intro + lineStr;
7616
- }
7617
- } while (chunk = chunk.previous);
7618
- lineIndex = this.intro.lastIndexOf(n);
7619
- if (lineIndex !== -1)
7620
- { return this.intro.substr(lineIndex + 1) + lineStr; }
7621
- return this.intro + lineStr;
7622
- };
7623
-
7624
- MagicString.prototype.slice = function slice (start, end) {
7625
- if ( start === void 0 ) start = 0;
7626
- if ( end === void 0 ) end = this.original.length;
7627
-
7628
- while (start < 0) { start += this.original.length; }
7629
- while (end < 0) { end += this.original.length; }
7630
-
7631
- var result = '';
7632
-
7633
- // find start chunk
7634
- var chunk = this.firstChunk;
7635
- while (chunk && (chunk.start > start || chunk.end <= start)) {
7636
- // found end chunk before start
7637
- if (chunk.start < end && chunk.end >= end) {
7638
- return result;
7639
- }
7640
-
7641
- chunk = chunk.next;
7642
- }
7643
-
7644
- if (chunk && chunk.edited && chunk.start !== start)
7645
- { throw new Error(("Cannot use replaced character " + start + " as slice start anchor.")); }
7646
-
7647
- var startChunk = chunk;
7648
- while (chunk) {
7649
- if (chunk.intro && (startChunk !== chunk || chunk.start === start)) {
7650
- result += chunk.intro;
7651
- }
7652
-
7653
- var containsEnd = chunk.start < end && chunk.end >= end;
7654
- if (containsEnd && chunk.edited && chunk.end !== end)
7655
- { throw new Error(("Cannot use replaced character " + end + " as slice end anchor.")); }
7656
-
7657
- var sliceStart = startChunk === chunk ? start - chunk.start : 0;
7658
- var sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length;
7659
-
7660
- result += chunk.content.slice(sliceStart, sliceEnd);
7661
-
7662
- if (chunk.outro && (!containsEnd || chunk.end === end)) {
7663
- result += chunk.outro;
7664
- }
7665
-
7666
- if (containsEnd) {
7667
- break;
7668
- }
7669
-
7670
- chunk = chunk.next;
7671
- }
7672
-
7673
- return result;
7674
- };
7675
-
7676
- // TODO deprecate this? not really very useful
7677
- MagicString.prototype.snip = function snip (start, end) {
7678
- var clone = this.clone();
7679
- clone.remove(0, start);
7680
- clone.remove(end, clone.original.length);
7681
-
7682
- return clone;
7683
- };
7684
-
7685
- MagicString.prototype._split = function _split (index) {
7686
- if (this.byStart[index] || this.byEnd[index]) { return; }
7687
-
7688
- var chunk = this.lastSearchedChunk;
7689
- var searchForward = index > chunk.end;
7690
-
7691
- while (chunk) {
7692
- if (chunk.contains(index)) { return this._splitChunk(chunk, index); }
7693
-
7694
- chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start];
7695
- }
7696
- };
7697
-
7698
- MagicString.prototype._splitChunk = function _splitChunk (chunk, index) {
7699
- if (chunk.edited && chunk.content.length) {
7700
- // zero-length edited chunks are a special case (overlapping replacements)
7701
- var loc = getLocator(this.original)(index);
7702
- throw new Error(
7703
- ("Cannot split a chunk that has already been edited (" + (loc.line) + ":" + (loc.column) + " – \"" + (chunk.original) + "\")")
7704
- );
7705
- }
7706
-
7707
- var newChunk = chunk.split(index);
7708
-
7709
- this.byEnd[index] = chunk;
7710
- this.byStart[index] = newChunk;
7711
- this.byEnd[newChunk.end] = newChunk;
7712
-
7713
- if (chunk === this.lastChunk) { this.lastChunk = newChunk; }
7714
-
7715
- this.lastSearchedChunk = chunk;
7716
- return true;
7717
- };
7718
-
7719
- MagicString.prototype.toString = function toString () {
7720
- var str = this.intro;
7721
-
7722
- var chunk = this.firstChunk;
7723
- while (chunk) {
7724
- str += chunk.toString();
7725
- chunk = chunk.next;
7726
- }
7727
-
7728
- return str + this.outro;
7729
- };
7730
-
7731
- MagicString.prototype.isEmpty = function isEmpty () {
7732
- var chunk = this.firstChunk;
7733
- do {
7734
- if (chunk.intro.length && chunk.intro.trim() ||
7735
- chunk.content.length && chunk.content.trim() ||
7736
- chunk.outro.length && chunk.outro.trim())
7737
- { return false; }
7738
- } while (chunk = chunk.next);
7739
- return true;
7740
- };
7741
-
7742
- MagicString.prototype.length = function length () {
7743
- var chunk = this.firstChunk;
7744
- var length = 0;
7745
- do {
7746
- length += chunk.intro.length + chunk.content.length + chunk.outro.length;
7747
- } while (chunk = chunk.next);
7748
- return length;
7749
- };
7750
-
7751
- MagicString.prototype.trimLines = function trimLines () {
7752
- return this.trim('[\\r\\n]');
7753
- };
7754
-
7755
- MagicString.prototype.trim = function trim (charType) {
7756
- return this.trimStart(charType).trimEnd(charType);
7757
- };
7758
-
7759
- MagicString.prototype.trimEndAborted = function trimEndAborted (charType) {
7760
- var rx = new RegExp((charType || '\\s') + '+$');
7761
-
7762
- this.outro = this.outro.replace(rx, '');
7763
- if (this.outro.length) { return true; }
7764
-
7765
- var chunk = this.lastChunk;
7766
-
7767
- do {
7768
- var end = chunk.end;
7769
- var aborted = chunk.trimEnd(rx);
7770
-
7771
- // if chunk was trimmed, we have a new lastChunk
7772
- if (chunk.end !== end) {
7773
- if (this.lastChunk === chunk) {
7774
- this.lastChunk = chunk.next;
7775
- }
7776
-
7777
- this.byEnd[chunk.end] = chunk;
7778
- this.byStart[chunk.next.start] = chunk.next;
7779
- this.byEnd[chunk.next.end] = chunk.next;
7780
- }
7781
-
7782
- if (aborted) { return true; }
7783
- chunk = chunk.previous;
7784
- } while (chunk);
7785
-
7786
- return false;
7787
- };
7788
-
7789
- MagicString.prototype.trimEnd = function trimEnd (charType) {
7790
- this.trimEndAborted(charType);
7791
- return this;
7792
- };
7793
- MagicString.prototype.trimStartAborted = function trimStartAborted (charType) {
7794
- var rx = new RegExp('^' + (charType || '\\s') + '+');
7795
-
7796
- this.intro = this.intro.replace(rx, '');
7797
- if (this.intro.length) { return true; }
7798
-
7799
- var chunk = this.firstChunk;
7800
-
7801
- do {
7802
- var end = chunk.end;
7803
- var aborted = chunk.trimStart(rx);
7804
-
7805
- if (chunk.end !== end) {
7806
- // special case...
7807
- if (chunk === this.lastChunk) { this.lastChunk = chunk.next; }
7808
-
7809
- this.byEnd[chunk.end] = chunk;
7810
- this.byStart[chunk.next.start] = chunk.next;
7811
- this.byEnd[chunk.next.end] = chunk.next;
7812
- }
7813
-
7814
- if (aborted) { return true; }
7815
- chunk = chunk.next;
7816
- } while (chunk);
7817
-
7818
- return false;
7819
- };
7820
-
7821
- MagicString.prototype.trimStart = function trimStart (charType) {
7822
- this.trimStartAborted(charType);
7823
- return this;
7824
- };
7825
-
7826
6755
  const mockRegexp = /\b((?:vitest|vi)\s*.\s*mock\(["`'\s](.*[@\w_-]+)["`'\s])[),]{1}/;
7827
6756
  const pathRegexp = /\b(?:vitest|vi)\s*.\s*(unmock|importActual|importMock)\(["`'\s](.*[@\w_-]+)["`'\s]\);?/mg;
7828
6757
  const isComment = (line) => {
@@ -8042,7 +6971,7 @@ class BaseReporter {
8042
6971
  this.end = 0;
8043
6972
  this.isTTY = process.stdout.isTTY && !process.env.CI;
8044
6973
  this.isFirstWatchRun = true;
8045
- const mode = ctx.config.watch ? c.yellow(" DEV ") : c.cyan(" RUN ");
6974
+ const mode = ctx.config.watch ? c.blue(" WATCH ") : c.cyan(" RUN ");
8046
6975
  this.ctx.log(`
8047
6976
  ${c.inverse(c.bold(mode))} ${c.gray(this.ctx.config.root)}
8048
6977
  `);
@@ -8067,13 +6996,10 @@ ${c.inverse(c.bold(mode))} ${c.gray(this.ctx.config.root)}
8067
6996
  }
8068
6997
  }
8069
6998
  async onWatcherStart() {
8070
- const failed = getTests(this.ctx.state.getFiles()).filter((i) => {
8071
- var _a;
8072
- return ((_a = i.result) == null ? void 0 : _a.state) === "fail";
8073
- });
8074
- if (failed.length)
6999
+ const failed = hasFailed(this.ctx.state.getFiles());
7000
+ if (failed)
8075
7001
  this.ctx.log(`
8076
- ${c.bold(c.inverse(c.red(" FAIL ")))}${c.red(` ${failed.length} tests failed. Watching for file changes...`)}`);
7002
+ ${c.bold(c.inverse(c.red(" FAIL ")))}${c.red(" Tests failed. Watching for file changes...")}`);
8077
7003
  else
8078
7004
  this.ctx.log(`
8079
7005
  ${c.bold(c.inverse(c.green(" PASS ")))}${c.green(" Waiting for file changes...")}`);
@@ -8100,16 +7026,15 @@ ${c.bold(c.inverse(c.green(" PASS ")))}${c.green(" Waiting for file changes...")
8100
7026
  this.ctx.log(c.cyan("Restarted due to config changes..."));
8101
7027
  }
8102
7028
  async reportSummary(files) {
8103
- var _a, _b;
8104
7029
  const suites = getSuites(files);
8105
7030
  const tests = getTests(files);
8106
7031
  const failedSuites = suites.filter((i) => {
8107
- var _a2;
8108
- return (_a2 = i.result) == null ? void 0 : _a2.error;
7032
+ var _a;
7033
+ return (_a = i.result) == null ? void 0 : _a.error;
8109
7034
  });
8110
7035
  const failedTests = tests.filter((i) => {
8111
- var _a2;
8112
- return ((_a2 = i.result) == null ? void 0 : _a2.state) === "fail";
7036
+ var _a;
7037
+ return ((_a = i.result) == null ? void 0 : _a.state) === "fail";
8113
7038
  });
8114
7039
  const failedTotal = failedSuites.length + failedTests.length;
8115
7040
  let current = 1;
@@ -8118,27 +7043,17 @@ ${c.bold(c.inverse(c.green(" PASS ")))}${c.green(" Waiting for file changes...")
8118
7043
  if (failedSuites.length) {
8119
7044
  this.ctx.error(c.red(divider(c.bold(c.inverse(` Failed Suites ${failedSuites.length} `)))));
8120
7045
  this.ctx.error();
8121
- for (const suite of failedSuites) {
8122
- const filepath = (suite == null ? void 0 : suite.filepath) || "";
8123
- this.ctx.error(c.red(`
8124
- - ${getFullName(suite)} ${c.dim(`[ ${this.relative(filepath)} ]`)}`));
8125
- await printError((_a = suite.result) == null ? void 0 : _a.error, this.ctx);
8126
- errorDivider();
8127
- }
7046
+ await this.printTaskErrors(failedSuites, errorDivider);
8128
7047
  }
8129
7048
  if (failedTests.length) {
8130
7049
  this.ctx.error(c.red(divider(c.bold(c.inverse(` Failed Tests ${failedTests.length} `)))));
8131
7050
  this.ctx.error();
8132
- for (const test of failedTests) {
8133
- this.ctx.error(`${c.red(c.bold(c.inverse(" FAIL ")))} ${getFullName(test)}`);
8134
- await printError((_b = test.result) == null ? void 0 : _b.error, this.ctx);
8135
- errorDivider();
8136
- }
7051
+ await this.printTaskErrors(failedTests, errorDivider);
8137
7052
  }
8138
7053
  const executionTime = this.end - this.start;
8139
7054
  const threadTime = tests.reduce((acc, test) => {
8140
- var _a2;
8141
- return acc + (((_a2 = test.result) == null ? void 0 : _a2.end) ? test.result.end - test.result.start : 0);
7055
+ var _a;
7056
+ return acc + (((_a = test.result) == null ? void 0 : _a.end) ? test.result.end - test.result.start : 0);
8142
7057
  }, 0);
8143
7058
  const padTitle = (str) => c.dim(`${str.padStart(10)} `);
8144
7059
  const time = (time2) => {
@@ -8160,6 +7075,32 @@ ${c.bold(c.inverse(c.green(" PASS ")))}${c.green(" Waiting for file changes...")
8160
7075
  this.ctx.log(padTitle("Time"), time(executionTime) + c.gray(` (in thread ${time(threadTime)}, ${(executionTime / threadTime * 100).toFixed(2)}%)`));
8161
7076
  this.ctx.log();
8162
7077
  }
7078
+ async printTaskErrors(tasks, errorDivider) {
7079
+ var _a;
7080
+ const errorsQueue = [];
7081
+ for (const task of tasks) {
7082
+ const error = (_a = task.result) == null ? void 0 : _a.error;
7083
+ const errorItem = (error == null ? void 0 : error.stackStr) && errorsQueue.find((i) => {
7084
+ var _a2;
7085
+ return ((_a2 = i[0]) == null ? void 0 : _a2.stackStr) === error.stackStr;
7086
+ });
7087
+ if (errorItem)
7088
+ errorItem[1].push(task);
7089
+ else
7090
+ errorsQueue.push([error, [task]]);
7091
+ }
7092
+ for (const [error, tasks2] of errorsQueue) {
7093
+ for (const task of tasks2) {
7094
+ const filepath = (task == null ? void 0 : task.filepath) || "";
7095
+ let name = getFullName(task);
7096
+ if (filepath)
7097
+ name = `${name} ${c.dim(`[ ${this.relative(filepath)} ]`)}`;
7098
+ this.ctx.error(`${c.red(c.bold(c.inverse(" FAIL ")))} ${name}`);
7099
+ }
7100
+ await printError(error, this.ctx);
7101
+ errorDivider();
7102
+ }
7103
+ }
8163
7104
  }
8164
7105
 
8165
7106
  const ESC = '\u001B[';
@@ -8989,7 +7930,7 @@ async function _transformRequest(ctx, id) {
8989
7930
  }
8990
7931
  if (result && process.env.NODE_V8_COVERAGE)
8991
7932
  withInlineSourcemap(result);
8992
- return result == null ? void 0 : result.code;
7933
+ return result;
8993
7934
  }
8994
7935
  let SOURCEMAPPING_URL = "sourceMa";
8995
7936
  SOURCEMAPPING_URL += "ppingURL";
@@ -9086,8 +8027,18 @@ function createChannel(ctx) {
9086
8027
  return;
9087
8028
  case "snapshotSaved":
9088
8029
  return send(() => ctx.snapshot.add(args[0]));
8030
+ case "getSourceMap":
8031
+ return send(() => {
8032
+ const [id2, force] = args;
8033
+ if (force) {
8034
+ const mod = ctx.server.moduleGraph.getModuleById(id2);
8035
+ if (mod)
8036
+ ctx.server.moduleGraph.invalidateModule(mod);
8037
+ }
8038
+ return transformRequest(ctx, id2).then((r) => r == null ? void 0 : r.map);
8039
+ });
9089
8040
  case "fetch":
9090
- return send(() => transformRequest(ctx, ...args));
8041
+ return send(() => transformRequest(ctx, ...args).then((r) => r == null ? void 0 : r.code));
9091
8042
  case "onCollected":
9092
8043
  ctx.state.collectFiles(args[0]);
9093
8044
  ctx.reporters.forEach((r) => {
@@ -9318,7 +8269,7 @@ async function createVitest(options, viteOverrides = {}) {
9318
8269
  ctx.setServer(options, server2);
9319
8270
  haveStarted = true;
9320
8271
  if (options.api)
9321
- server2.middlewares.use((await import('./middleware-2028dfa0.js')).default(ctx));
8272
+ server2.middlewares.use((await import('./middleware-0ebc5238.js')).default(ctx));
9322
8273
  }
9323
8274
  },
9324
8275
  MocksPlugin()