Skip to content

Added TypeScript language tests #99

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

Merged
merged 1 commit into from
May 2, 2025
Merged
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
15 changes: 15 additions & 0 deletions js/tests/defaultKernels.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,18 @@ sandboxTest('test js kernel', async ({ sandbox }) => {
})
expect(output.logs.stdout).toEqual(['Hello World!\n'])
})

sandboxTest('test ts kernel', async ({ sandbox }) => {
const output = await sandbox.runCode(
'const message: string = "Hello World!"; console.log(message)',
{ language: 'ts' }
)
expect(output.logs.stdout).toEqual(['Hello World!\n'])
})

sandboxTest('test ts kernel errors', async ({ sandbox }) => {
const output = await sandbox.runCode('import x from "module";', {
language: 'typescript',
})
expect(output.error?.name).toEqual('TypeScriptCompilerError')
})
15 changes: 15 additions & 0 deletions python/tests/async/test_async_default_kernels.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,18 @@ async def test_js_kernel(async_sandbox: AsyncSandbox):
"console.log('Hello, World!')", language="js"
)
assert execution.logs.stdout == ["Hello, World!\n"]


async def test_ts_kernel(async_sandbox: AsyncSandbox):
execution = await async_sandbox.run_code(
"const message: string = 'Hello, World!'; console.log(message);", language="ts"
)
assert execution.logs.stdout == ["Hello, World!\n"]


async def test_ts_kernel_errors(async_sandbox: AsyncSandbox):
execution = await async_sandbox.run_code(
"import x from 'module';", language="ts"
)
assert execution.error is not None
assert execution.error.name == "TypeScriptCompilerError"
12 changes: 12 additions & 0 deletions python/tests/sync/test_default_kernels.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,15 @@ def test_r_kernel(sandbox: Sandbox):
def test_java_kernel(sandbox: Sandbox):
execution = sandbox.run_code('System.out.println("Hello, World!")', language="java")
assert execution.logs.stdout[0] == "Hello, World!"


@pytest.mark.skip_debug()
def test_ts_kernel(sandbox: Sandbox):
execution = sandbox.run_code("const message: string = 'Hello, World!'; console.log(message)", language="ts")
assert execution.logs.stdout == ["Hello, World!\n"]


def test_ts_kernel_errors(sandbox: Sandbox):
execution = sandbox.run_code("import x from 'module';", language="ts")
assert execution.error is not None
assert execution.error.name == "TypeScriptCompilerError"
Loading