From c058058a6eefdc57596e0f4176fd76ff39089636 Mon Sep 17 00:00:00 2001 From: Paul Gottschling Date: Fri, 15 Nov 2024 14:56:58 -0500 Subject: [PATCH] Reproduce the bug in local.mdx --- server/fixtures/hcl-addr-var.mdx | 44 ++++++++++++++++++++++++ server/fixtures/result/hcl-addr-var.html | 0 uvu-tests/rehype-hljs-var.test.ts | 18 ++++++++++ 3 files changed, 62 insertions(+) create mode 100644 server/fixtures/hcl-addr-var.mdx create mode 100644 server/fixtures/result/hcl-addr-var.html diff --git a/server/fixtures/hcl-addr-var.mdx b/server/fixtures/hcl-addr-var.mdx new file mode 100644 index 0000000000..cc19103aa9 --- /dev/null +++ b/server/fixtures/hcl-addr-var.mdx @@ -0,0 +1,44 @@ +1. Create a `main.tf` file containing this minimal Terraform code: + + ```hcl + terraform { + required_providers { + teleport = { + source = "terraform.releases.teleport.dev/gravitational/teleport" + version = "~> (=teleport.major_version=).0" + } + } + } + + provider "teleport" { + addr = '' + } + + # We must create a test role, if we don't declare resources, Terraform won't try to + # connect to Teleport and we won't be able to validate the setup. + resource "teleport_role" "test" { + version = "v7" + metadata = { + name = "test" + description = "Dummy role to validate Terraform Provider setup" + labels = { + test = "yes" + } + } + + spec = {} + } + ``` + +1. Then, init your Terraform working directory to download the Teleport provider: + + ```code + $ terraform init + Initializing the backend... + + Initializing provider plugins... + - Finding terraform.releases.teleport.dev/gravitational/teleport versions matching ... + ``` + +1. Finally, run a Terraform plan: + diff --git a/server/fixtures/result/hcl-addr-var.html b/server/fixtures/result/hcl-addr-var.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/uvu-tests/rehype-hljs-var.test.ts b/uvu-tests/rehype-hljs-var.test.ts index fcac8731db..d0fb25c981 100644 --- a/uvu-tests/rehype-hljs-var.test.ts +++ b/uvu-tests/rehype-hljs-var.test.ts @@ -145,4 +145,22 @@ Suite("Ignore VarList in code snippet components", () => { }); }); +Suite("TODO", () => { + const result = transformer({ + value: readFileSync(resolve("server/fixtures/hcl-addr-var.mdx"), "utf-8"), + path: "/docs/index.mdx", + }); + + // Note that, because of rehypeMdxToHast, the components ending up + // having the tag. The MDX configuration in the DocsPage layout maps + // this to Var. + assert.equal( + (result.value as string).trim(), + readFileSync( + resolve("server/fixtures/result/hcl-addr-var.html"), + "utf-8" + ).trim() + ); +}); + Suite.run();