Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ts-jest",
"version": "21.1.2",
"version": "21.1.3",
"main": "index.js",
"types": "./dist/index.d.ts",
"description": "A preprocessor with sourcemap support to help use Typescript with Jest",
Expand Down Expand Up @@ -31,6 +31,7 @@
],
"author": "Kulshekhar Kabra <kulshekhar@users.noreply.github.com> (https://github.com/kulshekhar)",
"contributors": [
"Bnaya Peretz <me@bnaya.net> (https://github.com/Bnaya)",
"Brian Ruddy <briancruddy@gmail.com> (https://github.com/bcruddy)",
"Emil Persson <emil.n.persson@gmail.com> (https://github.com/emilniklas)",
"Gustav Wengel <gustavwengel@gmail.com>(https://github.com/GeeWee)",
Expand Down
3 changes: 2 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ function getStartDir(): string {

const grandparent = path.resolve(__dirname, '..', '..');
if (grandparent.endsWith('/node_modules')) {
return path.resolve(grandparent, '..');
return process.cwd();
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

If we're using process.cwd(), there's no need for the getStartDir function at all. process.cwd() is synonymous with . so the conditions in the function don't make any sense.

It would be better to remove this function and replace all calls to getStartDir with process.cwd(). Alternatively, just replace the contents of getStartDir with

return process.cwd()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it seems like that to me but,
When i change the function to just return process.cwd()
more test fails

I assume it because absolute and relative paths are handled differently in some point in the code.
If its important i can try to figure what's going on.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

You're right. This change is good in its current form.

}

return '.';
}

Expand Down
2 changes: 1 addition & 1 deletion tests/__tests__/synthetic-default-imports.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('synthetic default imports', () => {
expect(stderr).toContain(
`TypeError: Cannot read property 'someExport' of undefined`,
);
expect(stderr).toContain('module.test.ts:6:15');
expect(stderr).toContain('module.test.ts:6');
});

it('should work when the compiler option is true', () => {
Expand Down