From 9480ac33bbd6d0ac49875c0c4ed8223eff6da69e Mon Sep 17 00:00:00 2001 From: breblanc Date: Sat, 26 Oct 2024 17:59:08 +0200 Subject: [PATCH] fixed all tests --- tested/judge/utils.py | 4 ++++ tested/languages/typescript/config.py | 18 +++++++----------- .../typescript/tsconfig-compilation.json | 19 +++++++++++++++++++ tested/languages/typescript/tsconfig.json | 2 +- 4 files changed, 31 insertions(+), 12 deletions(-) create mode 100644 tested/languages/typescript/tsconfig-compilation.json diff --git a/tested/judge/utils.py b/tested/judge/utils.py index c50a00b2..f2fa53da 100644 --- a/tested/judge/utils.py +++ b/tested/judge/utils.py @@ -47,6 +47,10 @@ def run_command( :return: The result of the execution if the command was not None. """ + print(f"Running command {command} in {directory}") + print(f"Timeout: {timeout}") + print(f"Check: {check}") + print(f"Stdin: {stdin}") if not command: return None diff --git a/tested/languages/typescript/config.py b/tested/languages/typescript/config.py index 24a6c5fb..7c2fc7a6 100644 --- a/tested/languages/typescript/config.py +++ b/tested/languages/typescript/config.py @@ -111,12 +111,9 @@ def compilation(self, files: list[str]) -> CallbackResult: if main_file: return ( [ - "tsc", - "--module", - "nodenext", - "--moduleResolution", - "nodenext", - "--noEmit", + "tsx", + "--tsconfig", + str(Path(__file__).parent / "tsconfig-compilation.json"), main_file[0], ], files, @@ -125,8 +122,7 @@ def compilation(self, files: list[str]) -> CallbackResult: return [], files def execution(self, cwd: Path, file: str, arguments: list[str]) -> Command: - # Used es2022 because of the top-level await feature (most up-to data). - return ["tsx", "--tsconfig", str(Path(__file__).parent / "tsconfig.json"), file, *arguments] + return ["tsx", file, *arguments] def modify_solution(self, solution: Path): # import local to prevent errors @@ -138,10 +134,10 @@ def modify_solution(self, solution: Path): output = run_command( solution.parent, timeout=None, - command=["tsx", "--tsconfig", str(Path(__file__).parent / "tsconfig.json"), parse_file, str(solution.absolute())], - check=False, + command=["tsx", parse_file, str(solution.absolute())], + check=True, ) - print(output.stderr) + print(output) assert output, "Missing output from TypesScript's modify_solution" namings = output.stdout.strip() with open(solution, "a") as file: diff --git a/tested/languages/typescript/tsconfig-compilation.json b/tested/languages/typescript/tsconfig-compilation.json new file mode 100644 index 00000000..9d1c2b86 --- /dev/null +++ b/tested/languages/typescript/tsconfig-compilation.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "esnext", + "strict": true, + "target": "es6", + "moduleDetection": "force", + "resolveJsonModule": true, + "allowJs": true, + "esModuleInterop": true, + "skipLibCheck": true, + "isolatedModules": true, + "verbatimModuleSyntax" : true, + "types" : ["node"], + "moduleResolution" : "node", + "allowImportingTsExtensions" : true, + "noEmit" : true + }, + +} diff --git a/tested/languages/typescript/tsconfig.json b/tested/languages/typescript/tsconfig.json index be08f0df..24eb8bdd 100644 --- a/tested/languages/typescript/tsconfig.json +++ b/tested/languages/typescript/tsconfig.json @@ -6,7 +6,7 @@ "moduleDetection": "force", "resolveJsonModule": true, "allowJs": true, - "esModuleInterop": true, + "esModuleInterop": true, "skipLibCheck": true, "isolatedModules": true, "verbatimModuleSyntax" : true,