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

test(custom-compiler): deprecated ttypescript and use ttsc #4074

Closed
wants to merge 2 commits into from
Closed
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
21 changes: 21 additions & 0 deletions e2e/__tests__/custom-compiler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,24 @@ describe.skip('ttypescript', () => {
expect(json.success).toBe(true)
})
})

/**
* Development has progressed since being cloned to ttsc due to slow ttypescript development.
* Support for typescript@5 has been added at the same time as the existing ttypescript behavior.
* Additional info can be found on the following links:
* @see https://github.com/cevek/ttypescript/issues/146
* @see https://github.com/cevek/ttypescript/issues/140
*/
describe('ttsc', () => {
const TTS_DIR_NAME = 'ttsc'

beforeAll(() => {
runNpmInstall(path.join(__dirname, '..', DIR_NAME, TTS_DIR_NAME))
})

test(`successfully runs the tests inside ${DIR_NAME}/${TTS_DIR_NAME}`, () => {
const { json } = runWithJson(`${DIR_NAME}/${TTS_DIR_NAME}`)

expect(json.success).toBe(true)
})
})
7 changes: 7 additions & 0 deletions e2e/custom-compiler/ttsc/__tests__/direct-import.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { getWelcomeMessage } from '../share/foo'

test('should return welcome message', () => {
const userName = 'github-user'

expect(getWelcomeMessage(userName)).toEqual(`yolo ${userName}`)
})
90 changes: 90 additions & 0 deletions e2e/custom-compiler/ttsc/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions e2e/custom-compiler/ttsc/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"dependencies": {
"typescript-transform-paths": "^3.4.6",
"ttsc": "0.0.5"
},
"jest": {
"transform": {
"^.+.tsx?$": [
"<rootDir>/../../../legacy.js",
{
"compiler": "ttsc"
}
]
}
}
}
13 changes: 13 additions & 0 deletions e2e/custom-compiler/ttsc/share/foo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export function getWelcomeMessage(username: string): string {
return `yolo ${username}`
}

function getMessage(username: string): string {
return getWelcomeMessage(username)
}

export interface Foo {
bar: number
}

export default getMessage
15 changes: 15 additions & 0 deletions e2e/custom-compiler/ttsc/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"compilerOptions": {
"baseUrl": ".",
"module": "CommonJS",
"paths": {
"@share/*": ["share/*"]
},
"plugins": [
{
"transform": "typescript-transform-paths",
}
]
},
"files": ["../../../globals.d.ts"]
}
Loading