Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: migrate jest-message-util to TypeScript #7834

Merged
merged 1 commit into from
Feb 9, 2019

Conversation

SimenB
Copy link
Member

@SimenB SimenB commented Feb 8, 2019

Summary

I've added a new package called @jest/types (/cc @rubennorte) where we can stick shared type definitions that don't belong in a single package.

(One could argue that Config belongs in jest-config, but jest-config depends on babel, jsdom etc which seems hefty when I just want ProjectConfig typings).

Built diff:

diff --git c/packages/jest-message-util/build/index.js w/packages/jest-message-util/build/index.js
index 9af04fc06..15c9e5078 100644
--- c/packages/jest-message-util/build/index.js
+++ w/packages/jest-message-util/build/index.js
@@ -282,20 +282,18 @@ const formatStackTrace = (stack, config, options, testPath) => {
     : null;
 
   if (topFrame) {
-    const filename = topFrame.file;
+    const column = topFrame.column,
+      filename = topFrame.file,
+      line = topFrame.line;
 
-    if (_path.default.isAbsolute(filename)) {
+    if (line && filename && _path.default.isAbsolute(filename)) {
       let fileContent;
 
       try {
         // TODO: check & read HasteFS instead of reading the filesystem:
         // see: https://github.com/facebook/jest/pull/5405#discussion_r164281696
         fileContent = jestReadFile(filename, 'utf8');
-        renderedCallsite = getRenderedCallsite(
-          fileContent,
-          topFrame.line,
-          topFrame.column
-        );
+        renderedCallsite = getRenderedCallsite(fileContent, line, column);
       } catch (e) {
         // the file does not exist or is inaccessible, we ignore
       }

Test plan

Green CI

"dependencies": {
"@babel/code-frame": "^7.0.0",
"@jest/types": "^24.0.0",
"@types/stack-utils": "^1.0.1",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved since it's part of the exported interface

@SimenB SimenB force-pushed the ts-message-util branch 3 times, most recently from ac24837 to 165430a Compare February 8, 2019 13:34
Copy link
Collaborator

@thymikee thymikee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants