MCPcopy
hub / github.com/jestjs/jest / get

Method get

packages/jest-reporters/src/Status.ts:153–202  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

151 }
152
153 get(): Cache {
154 if (this._cache) {
155 return this._cache;
156 }
157
158 if (this._done) {
159 return {clear: '', content: ''};
160 }
161
162 const width = process.stdout.columns;
163 let content = '\n';
164 for (const record of this._currentTests.get()) {
165 if (record) {
166 const {config, testPath} = record;
167
168 const projectDisplayName = config.displayName
169 ? `${printDisplayName(config)} `
170 : '';
171 const prefix = RUNNING + projectDisplayName;
172
173 content += `${wrapAnsiString(
174 prefix +
175 trimAndFormatPath(stringLength(prefix), config, testPath, width),
176 width,
177 )}\n`;
178 }
179 }
180
181 if (this._showStatus && this._aggregatedResults) {
182 content += `\n${getSummary(this._aggregatedResults, {
183 currentTestCases: this._currentTestCases,
184 estimatedTime: this._estimatedTime,
185 roundTime: true,
186 seed: this._globalConfig.seed,
187 showSeed: this._globalConfig.showSeed,
188 width,
189 })}`;
190 }
191
192 let height = 0;
193
194 for (const char of content) {
195 if (char === '\n') {
196 height++;
197 }
198 }
199
200 const clear = '\r\u001B[K\r\u001B[1A'.repeat(height);
201 return (this._cache = {clear, content});
202 }
203
204 private _emit() {
205 this._cache = null;

Callers 15

ensureNoDuplicateConfigsFunction · 0.45
fs.jsFile · 0.45
readPkgFunction · 0.45
watchFunction · 0.45
checkForConflictsFunction · 0.45
scheduleTestsMethod · 0.45
collectHandlesFunction · 0.45
formatHandleErrorsFunction · 0.45
_runTimerHandleMethod · 0.45
getCallsiteFunction · 0.45
setModuleMethod · 0.45
_processFileMethod · 0.45

Calls 4

printDisplayNameFunction · 0.85
wrapAnsiStringFunction · 0.85
trimAndFormatPathFunction · 0.85
getSummaryFunction · 0.85

Tested by 1

extractCountFunction · 0.36