-
-
Notifications
You must be signed in to change notification settings - Fork 372
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #440 from danger/tsc_module
Adds an overwrite for the TS module system when transpiling our TS code
- Loading branch information
Showing
4 changed files
with
49 additions
and
2 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
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,22 @@ | ||
jest.mock("fs", () => ({ | ||
readFileSync: jest.fn(), | ||
})) | ||
|
||
import { typescriptify } from "../transpiler" | ||
import * as fs from "fs" | ||
|
||
describe("typescriptify", () => { | ||
it("removes the module option in a tsconfig ", () => { | ||
const dangerfile = `import {a} from 'lodash'; a()` | ||
const fakeTSConfig = { | ||
compilerOptions: { | ||
target: "es5", | ||
module: "es2015", | ||
}, | ||
} | ||
const fsMock = fs.readFileSync as any | ||
fsMock.mockImplementationOnce(() => JSON.stringify(fakeTSConfig)) | ||
|
||
expect(typescriptify(dangerfile)).not.toContain("import") | ||
}) | ||
}) |
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