-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unit tests for remark/rehype plugins
See #17 Migrate unit tests for our custom remark and rehype plugins from the archived `gravitational/docs` repo. Convert these tests to Jest, which unlike the uvu testing tool we used for `gravitational/docs`, is still being maintained. Add a GitHub Actions workflow to run the tests on pull requests. To get the `remark-includes` test to pass, edit the `updatePaths` function to only extract a version number from the path of a partial if the partial falls under a directory path for production content.
- Loading branch information
Showing
66 changed files
with
3,598 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: Test | ||
on: | ||
pull_request: | ||
|
||
jobs: | ||
run-tests: | ||
name: Run tests | ||
runs-on: ubuntu-22.04-2core-arm64 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: yarn && yarn test |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
const jestConfig = { | ||
preset: "ts-jest/presets/default-esm", | ||
testEnvironment: "node", | ||
extensionsToTreatAsEsm: [".ts"], | ||
transform: { | ||
"^.+\\.[tj]s$": [ | ||
"ts-jest", | ||
{ | ||
useESM: true, | ||
tsconfig: "tsconfig.node.json", | ||
}, | ||
], | ||
}, | ||
transformIgnorePatterns: ["<rootDir>/node_modules/*"], | ||
}; | ||
export default jestConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
```code | ||
$ tsh request search --kind node | ||
Name Hostname Labels Resource ID | ||
------------------------------------ ----------- ------------ | ||
------------------------------------------------------ | ||
b1168402-9340-421a-a344-af66a6675738 iot test=test | ||
/teleport.example.com/node/b1168402-9340-421a-a344-af66a6675738 | ||
bbb56211-7b54-4f9e-bee9-b68ea156be5f node test=test | ||
/teleport.example.com/node/bbb56211-7b54-4f9e-bee9-b68ea156be5f | ||
To request access to these resources, run | ||
> tsh request create --resource | ||
> /teleport.example.com/node/b1168402-9340-421a-a344-af66a6675738 --resource | ||
> /teleport.example.com/node/bbb56211-7b54-4f9e-bee9-b68ea156be5f \ | ||
> --reason <request reason> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
```go | ||
// This is a comment about the code below, which contains a | ||
// <Var name="myvar" />. This comment also includes another | ||
// <Var name="othervar" />. This is the end of the comment. | ||
func myfunc(attr string) error { | ||
return nil | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
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 = '<Var name="teleport.example.com:443" />' | ||
} | ||
``` | ||
|
||
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: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Assign <Var name="proxy" initial="teleport.example.com:443" /> to the address of | ||
your Teleport Proxy Service. | ||
|
||
```hcl | ||
provider "teleport" { | ||
# Update addr to point to your Teleport Cloud tenant URL's host:port | ||
addr = "<Var name="proxy" />" | ||
identity_file_path = "terraform-identity" | ||
} | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
## Example code block | ||
|
||
Code block with multiple includes. | ||
|
||
```css | ||
.example1 { | ||
width: 50%; | ||
height: 50%; | ||
} | ||
|
||
.base { | ||
width: 100%; | ||
height: 100%; | ||
} | ||
|
||
.base { | ||
width: 100%; | ||
height: 100%; | ||
} | ||
|
||
.example2 { | ||
width: 50%; | ||
height: 50%; | ||
} | ||
|
||
.base { | ||
width: 100%; | ||
height: 100%; | ||
} | ||
|
||
``` | ||
|
||
## Example test block | ||
|
||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. | ||
|
||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. | ||
|
||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
## Example code block | ||
|
||
Code block with multiple includes. | ||
|
||
```css | ||
.example1 { | ||
width: 50%; | ||
height: 50%; | ||
} | ||
|
||
(!include.css!) | ||
(!include.css!) | ||
.example2 { | ||
width: 50%; | ||
height: 50%; | ||
} | ||
|
||
(!include.css!) | ||
``` | ||
|
||
## Example test block | ||
|
||
(!include-string.mdx!) | ||
|
||
(!include-string.mdx!) | ||
|
||
(!include-string.mdx!) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
## Header | ||
|
||
```css | ||
.base { | ||
width: 100%; | ||
height: 100%; | ||
} | ||
|
||
``` | ||
|
||
```css | ||
/* Some text inside codeblock before */ | ||
|
||
.base { | ||
width: 100%; | ||
height: 100%; | ||
} | ||
|
||
|
||
/* And after */ | ||
``` | ||
|
||
```md | ||
| OPERATING SYSTEM | CHECKSUM | DOWNLOAD LINK | | ||
| ----------------------------------------- | ----------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| Linux 32-bit | [SHA256](https://get.gravitational.com/teleport-v6.0.0-alpha.2-linux-386-bin.tar.gz.sha256) | [teleport-v6.0.0-alpha.2-linux-386-bin.tar.gz](https://get.gravitational.com/teleport-v6.0.0-alpha.2-linux-386-bin.tar.gz) | | ||
| Linux 64-bit | [SHA256](https://get.gravitational.com/teleport-v6.0.0-alpha.2-linux-amd64-bin.tar.gz.sha256) | [teleport-v6.0.0-alpha.2-linux-amd64-bin.tar.gz](https://get.gravitational.com/teleport-v6.0.0-alpha.2-linux-amd64-bin.tar.gz) | | ||
| Linux 64-bit (RHEL/CentOS 6.x compatible) | [SHA256](https://get.gravitational.com/teleport-v6.0.0-alpha.2-linux-amd64-centos6-bin.tar.gz.sha256) | [teleport-v6.0.0-alpha.2-linux-amd64-centos6-bin.tar.gz](https://get.gravitational.com/teleport-v6.0.0-alpha.2-linux-amd64-centos6-bin.tar.gz) | | ||
| Linux ARMv7 | [SHA256](https://get.gravitational.com/teleport-v6.0.0-alpha.2-linux-arm-bin.tar.gz.sha256) | [teleport-v6.0.0-alpha.2-linux-arm-bin.tar.gz](https://get.gravitational.com/teleport-v6.0.0-alpha.2-linux-arm-bin.tar.gz) | | ||
| Linux 64-bit DEB | [SHA256](https://get.gravitational.com/teleport_6.0.0-alpha.2_amd64.deb.sha256) | [teleport-v6.0.0-alpha.2-amd64.deb](https://get.gravitational.com/teleport_6.0.0-alpha.2_amd64.deb) | | ||
| Linux 32-bit DEB | [SHA256](https://get.gravitational.com/teleport_6.0.0-alpha.2_i386.deb.sha256) | [teleport-v6.0.0-alpha.2-i386.deb](https://get.gravitational.com/teleport_6.0.0-alpha.2_amd64.deb) | | ||
| Linux 64-bit RPM | [SHA256](https://get.gravitational.com/teleport-6.0.0-alpha.2-1.x86_64.rpm.sha256) | [teleport-6.0.0-alpha.2-1.x86-64.rpm](https://get.gravitational.com/teleport-6.0.0-alpha.2-1.x86_64.rpm) | | ||
| Docker Image | [SHA256](https://quay.io/repository/gravitational/teleport?tab=tags) | `docker pull quay.io/gravitational/teleport:6.0.0-alpha.2` | | ||
``` | ||
|
||
| OPERATING SYSTEM | CHECKSUM | DOWNLOAD LINK | | ||
| ----------------------------------------- | ----------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| Linux 32-bit | [SHA256](https://get.gravitational.com/teleport-v6.0.0-alpha.2-linux-386-bin.tar.gz.sha256) | [teleport-v6.0.0-alpha.2-linux-386-bin.tar.gz](https://get.gravitational.com/teleport-v6.0.0-alpha.2-linux-386-bin.tar.gz) | | ||
| Linux 64-bit | [SHA256](https://get.gravitational.com/teleport-v6.0.0-alpha.2-linux-amd64-bin.tar.gz.sha256) | [teleport-v6.0.0-alpha.2-linux-amd64-bin.tar.gz](https://get.gravitational.com/teleport-v6.0.0-alpha.2-linux-amd64-bin.tar.gz) | | ||
| Linux 64-bit (RHEL/CentOS 6.x compatible) | [SHA256](https://get.gravitational.com/teleport-v6.0.0-alpha.2-linux-amd64-centos6-bin.tar.gz.sha256) | [teleport-v6.0.0-alpha.2-linux-amd64-centos6-bin.tar.gz](https://get.gravitational.com/teleport-v6.0.0-alpha.2-linux-amd64-centos6-bin.tar.gz) | | ||
| Linux ARMv7 | [SHA256](https://get.gravitational.com/teleport-v6.0.0-alpha.2-linux-arm-bin.tar.gz.sha256) | [teleport-v6.0.0-alpha.2-linux-arm-bin.tar.gz](https://get.gravitational.com/teleport-v6.0.0-alpha.2-linux-arm-bin.tar.gz) | | ||
| Linux 64-bit DEB | [SHA256](https://get.gravitational.com/teleport_6.0.0-alpha.2_amd64.deb.sha256) | [teleport-v6.0.0-alpha.2-amd64.deb](https://get.gravitational.com/teleport_6.0.0-alpha.2_amd64.deb) | | ||
| Linux 32-bit DEB | [SHA256](https://get.gravitational.com/teleport_6.0.0-alpha.2_i386.deb.sha256) | [teleport-v6.0.0-alpha.2-i386.deb](https://get.gravitational.com/teleport_6.0.0-alpha.2_amd64.deb) | | ||
| Linux 64-bit RPM | [SHA256](https://get.gravitational.com/teleport-6.0.0-alpha.2-1.x86_64.rpm.sha256) | [teleport-6.0.0-alpha.2-1.x86-64.rpm](https://get.gravitational.com/teleport-6.0.0-alpha.2-1.x86_64.rpm) | | ||
| Docker Image | [SHA256](https://quay.io/repository/gravitational/teleport?tab=tags) | `docker pull quay.io/gravitational/teleport:6.0.0-alpha.2` | | ||
|
||
Some text before (!include-table.mdx!) and after | ||
|
||
(!non-existing.mdx!) | ||
|
||
<Tabs> | ||
<TabItem label="Include inside tab"> | ||
| OPERATING SYSTEM | CHECKSUM | DOWNLOAD LINK | | ||
| ----------------------------------------- | ----------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| Linux 32-bit | [SHA256](https://get.gravitational.com/teleport-v6.0.0-alpha.2-linux-386-bin.tar.gz.sha256) | [teleport-v6.0.0-alpha.2-linux-386-bin.tar.gz](https://get.gravitational.com/teleport-v6.0.0-alpha.2-linux-386-bin.tar.gz) | | ||
| Linux 64-bit | [SHA256](https://get.gravitational.com/teleport-v6.0.0-alpha.2-linux-amd64-bin.tar.gz.sha256) | [teleport-v6.0.0-alpha.2-linux-amd64-bin.tar.gz](https://get.gravitational.com/teleport-v6.0.0-alpha.2-linux-amd64-bin.tar.gz) | | ||
| Linux 64-bit (RHEL/CentOS 6.x compatible) | [SHA256](https://get.gravitational.com/teleport-v6.0.0-alpha.2-linux-amd64-centos6-bin.tar.gz.sha256) | [teleport-v6.0.0-alpha.2-linux-amd64-centos6-bin.tar.gz](https://get.gravitational.com/teleport-v6.0.0-alpha.2-linux-amd64-centos6-bin.tar.gz) | | ||
| Linux ARMv7 | [SHA256](https://get.gravitational.com/teleport-v6.0.0-alpha.2-linux-arm-bin.tar.gz.sha256) | [teleport-v6.0.0-alpha.2-linux-arm-bin.tar.gz](https://get.gravitational.com/teleport-v6.0.0-alpha.2-linux-arm-bin.tar.gz) | | ||
| Linux 64-bit DEB | [SHA256](https://get.gravitational.com/teleport_6.0.0-alpha.2_amd64.deb.sha256) | [teleport-v6.0.0-alpha.2-amd64.deb](https://get.gravitational.com/teleport_6.0.0-alpha.2_amd64.deb) | | ||
| Linux 32-bit DEB | [SHA256](https://get.gravitational.com/teleport_6.0.0-alpha.2_i386.deb.sha256) | [teleport-v6.0.0-alpha.2-i386.deb](https://get.gravitational.com/teleport_6.0.0-alpha.2_amd64.deb) | | ||
| Linux 64-bit RPM | [SHA256](https://get.gravitational.com/teleport-6.0.0-alpha.2-1.x86_64.rpm.sha256) | [teleport-6.0.0-alpha.2-1.x86-64.rpm](https://get.gravitational.com/teleport-6.0.0-alpha.2-1.x86_64.rpm) | | ||
| Docker Image | [SHA256](https://quay.io/repository/gravitational/teleport?tab=tags) | `docker pull quay.io/gravitational/teleport:6.0.0-alpha.2` | | ||
</TabItem> | ||
</Tabs> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
## Header | ||
|
||
```css | ||
(!include.css!) | ||
``` | ||
|
||
```css | ||
/* Some text inside codeblock before */ | ||
|
||
(!include.css!) | ||
|
||
/* And after */ | ||
``` | ||
|
||
```md | ||
(!include-table.mdx!) | ||
``` | ||
|
||
(!include-table.mdx!) | ||
|
||
Some text before (!include-table.mdx!) and after | ||
|
||
(!non-existing.mdx!) | ||
|
||
<Tabs> | ||
<TabItem label="Include inside tab"> | ||
(!include-table.mdx!) | ||
</TabItem> | ||
</Tabs> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
## Installation | ||
|
||
Here is a test for including variables in an MDX file. | ||
|
||
(!install-version.mdx version="10" unsupport="9" !) |
Oops, something went wrong.