diff --git a/tested/languages/typescript/config.py b/tested/languages/typescript/config.py index abf8fb1d..ee746073 100644 --- a/tested/languages/typescript/config.py +++ b/tested/languages/typescript/config.py @@ -138,12 +138,11 @@ def modify_solution(self, solution: Path): solution.parent, timeout=None, command=["tsx", parse_file, str(solution.absolute())], - check=True, + check=False, ) assert output, "Missing output from TypesScript's modify_solution" namings = output.stdout.strip() with open(solution, "a") as file: - # print(f"\ndeclare var module: any;", file=file) print(f"\nexport {{{namings}}};", file=file) # Add strict mode to the script. diff --git a/tested/languages/typescript/generators.py b/tested/languages/typescript/generators.py index c93a8923..20a462b9 100644 --- a/tested/languages/typescript/generators.py +++ b/tested/languages/typescript/generators.py @@ -160,7 +160,7 @@ def _generate_internal_context(ctx: PreparedContext, pu: PreparedExecutionUnit) if not ctx.context.has_main_testcase(): result += f""" writeSeparator(); - //delete require.cache[require.resolve("./{submission_file(pu.language)}")]; + delete require.cache[require.resolve("./{submission_file(pu.language)}")]; let {pu.submission_name} = await import('./{submission_file(pu.language)}'); """ @@ -192,7 +192,7 @@ def _generate_internal_context(ctx: PreparedContext, pu: PreparedExecutionUnit) if tc.testcase.is_main_testcase(): assert isinstance(tc.input, MainInput) result += f""" - //delete require.cache[require.resolve("./{pu.submission_name}.ts")]; + delete require.cache[require.resolve("./{pu.submission_name}.ts")]; let {pu.submission_name} = await import('./{pu.submission_name}.ts'); """ else: diff --git a/tests/exercises/echo-function-additional-source-files/solution/correct.ts b/tests/exercises/echo-function-additional-source-files/solution/correct.ts index cd443043..7d4a970d 100644 --- a/tests/exercises/echo-function-additional-source-files/solution/correct.ts +++ b/tests/exercises/echo-function-additional-source-files/solution/correct.ts @@ -1,3 +1,4 @@ +// @ts-ignore import * as e from "./echo.ts"; function echo(content) {