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

When using mock-fs + jest + ts-jest, the lines numbers are shown incorrectly on the jest output #226

Open
jhm-ciberman opened this issue Dec 31, 2017 · 1 comment

Comments

@jhm-ciberman
Copy link

I have reported the bug on the ts-jest repo, but I also report it here because I don't know if it's a problem of ts-jest or mock-fs.

Link to ts-jest issue: kulshekhar/ts-jest#405

  • issue

If you use mock-fs package the line numbers are shown icorrectly.

import Dog from "./Dog";
import * as mock from "mock-fs";

describe("Dog", () => {
	
	beforeAll(() => {
		mock({
			"path/to/file.txt": "my text content",
		});
	});

	afterAll(() => {
		mock.restore(); 
	})

	
	test("should woof", () => {
		const dog = new Dog();
		expect(dog.woof()).toBe("Woof!____ SHOULD FAIL AND DISPLAY LINE NUMBER 19");
               // but it shows error at line number 16
	});
});
  • Expected behavior
    When running the tests, the line number should be shown correctly. But instead the JS line number is shown (not the TS input file line number)

  • Link to a minimal repo that reproduces this issue
    https://github.com/jhm-ciberman/ts-jest-bug

@G1itcher
Copy link

This is still an issue. Make mock-fs unusable for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants