-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(typeof-module): prevent unsupported declaration to be transformer…
… when mocking typeof of a module that uses exports = chore(module): add type to lambda refactor(typeof-module): extract interface
- Loading branch information
Showing
5 changed files
with
61 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
test/transformer/descriptor/typeQuery/typeQueryExportClasses.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { createMock } from 'ts-auto-mock'; | ||
import exportEqual = require('../utils/export/exportEqual'); | ||
|
||
describe('TypeQuery export equal classes', () => { | ||
it('should exclude the class and not fail', () => { | ||
// When transforming typeof a module there are some scenario that are not playing nicely with ts-auto-mock implementation | ||
// Ts auto mock uses typeChecker getExportsOfModule functionality to find symbols | ||
// When the module uses export = ClassName ts auto mock will find the prototype but it will not be able to find the original declaration. | ||
const mock: typeof exportEqual = createMock<typeof exportEqual>(); | ||
|
||
expect(mock).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
declare namespace Test { | ||
interface HelloWorld { | ||
prop: string; | ||
} | ||
} | ||
|
||
class Test { | ||
public a: string; | ||
} | ||
|
||
export = Test; |