diff --git a/js/tests/defaultKernels.test.ts b/js/tests/defaultKernels.test.ts index d8120267..5750644a 100644 --- a/js/tests/defaultKernels.test.ts +++ b/js/tests/defaultKernels.test.ts @@ -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') +}) diff --git a/python/tests/async/test_async_default_kernels.py b/python/tests/async/test_async_default_kernels.py index a632bda6..83f92746 100644 --- a/python/tests/async/test_async_default_kernels.py +++ b/python/tests/async/test_async_default_kernels.py @@ -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" diff --git a/python/tests/sync/test_default_kernels.py b/python/tests/sync/test_default_kernels.py index d0daf820..0695defd 100644 --- a/python/tests/sync/test_default_kernels.py +++ b/python/tests/sync/test_default_kernels.py @@ -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"