@@ -41,6 +41,29 @@ describe('jest functions', () => {
4141 } ) ;
4242 } ) ;
4343
44+ describe ( 'jest.doMock' , ( ) => {
45+ it ( 'should resolve the path based on the root config' , ( ) => {
46+ const code = 'jest.doMock("c1", () => {});' ;
47+ const result = transform ( code , transformerOpts ) ;
48+
49+ expect ( result . code ) . toBe ( 'jest.doMock("./test/examples/components/c1", () => {});' ) ;
50+ } ) ;
51+
52+ it ( 'should alias the path' , ( ) => {
53+ const code = 'jest.doMock("utils", () => {});' ;
54+ const result = transform ( code , transformerOpts ) ;
55+
56+ expect ( result . code ) . toBe ( 'jest.doMock("./src/mylib/subfolder/utils", () => {});' ) ;
57+ } ) ;
58+
59+ it ( 'should not change the path' , ( ) => {
60+ const code = 'jest.doMock("./utils", () => {});' ;
61+ const result = transform ( code , transformerOpts ) ;
62+
63+ expect ( result . code ) . toBe ( 'jest.doMock("./utils", () => {});' ) ;
64+ } ) ;
65+ } ) ;
66+
4467 describe ( 'jest.unmock' , ( ) => {
4568 it ( 'should resolve the path based on the root config' , ( ) => {
4669 const code = 'jest.unmock("c1");' ;
@@ -64,6 +87,29 @@ describe('jest functions', () => {
6487 } ) ;
6588 } ) ;
6689
90+ describe ( 'jest.dontMock' , ( ) => {
91+ it ( 'should resolve the path based on the root config' , ( ) => {
92+ const code = 'jest.dontMock("c1");' ;
93+ const result = transform ( code , transformerOpts ) ;
94+
95+ expect ( result . code ) . toBe ( 'jest.dontMock("./test/examples/components/c1");' ) ;
96+ } ) ;
97+
98+ it ( 'should alias the path' , ( ) => {
99+ const code = 'jest.dontMock("utils");' ;
100+ const result = transform ( code , transformerOpts ) ;
101+
102+ expect ( result . code ) . toBe ( 'jest.dontMock("./src/mylib/subfolder/utils");' ) ;
103+ } ) ;
104+
105+ it ( 'should not change the path' , ( ) => {
106+ const code = 'jest.dontMock("./utils");' ;
107+ const result = transform ( code , transformerOpts ) ;
108+
109+ expect ( result . code ) . toBe ( 'jest.dontMock("./utils");' ) ;
110+ } ) ;
111+ } ) ;
112+
67113 describe ( 'jest.genMockFromModule' , ( ) => {
68114 it ( 'should resolve the path based on the root config' , ( ) => {
69115 const code = 'jest.genMockFromModule("c1");' ;
0 commit comments