From ee45561cf1782d042a3bc975229e0d44e69ec5bb Mon Sep 17 00:00:00 2001 From: "Henry H. Andrews" Date: Fri, 2 Oct 2026 09:33:51 -0700 Subject: [PATCH] Remove duplicated build infrastructure tests Keep renderer implementation tests in build-infra and make the schema workflow run only the repository-owned schema suite when it is present. Co-authored-by: Codex --- .github/workflows/schema-tests.yaml | 5 +- CONTRIBUTING.md | 2 +- tests/md2html/README.md | 7 - tests/md2html/fixtures/.gitattributes | 1 - tests/md2html/fixtures/basic-new.html | 119 ---------------- tests/md2html/fixtures/basic-new.maintainers | 11 -- tests/md2html/fixtures/basic-new.md | 135 ------------------- tests/md2html/fixtures/basic-old.html | 38 ------ tests/md2html/fixtures/basic-old.maintainers | 2 - tests/md2html/fixtures/basic-old.md | 26 ---- tests/md2html/fixtures/spec.config.json | 35 ----- tests/md2html/md2html.test.mjs | 49 ------- 12 files changed, 4 insertions(+), 426 deletions(-) delete mode 100644 tests/md2html/README.md delete mode 100644 tests/md2html/fixtures/.gitattributes delete mode 100644 tests/md2html/fixtures/basic-new.html delete mode 100644 tests/md2html/fixtures/basic-new.maintainers delete mode 100644 tests/md2html/fixtures/basic-new.md delete mode 100644 tests/md2html/fixtures/basic-old.html delete mode 100644 tests/md2html/fixtures/basic-old.maintainers delete mode 100644 tests/md2html/fixtures/basic-old.md delete mode 100644 tests/md2html/fixtures/spec.config.json delete mode 100644 tests/md2html/md2html.test.mjs diff --git a/.github/workflows/schema-tests.yaml b/.github/workflows/schema-tests.yaml index 93de58b64c..b6f23223d5 100644 --- a/.github/workflows/schema-tests.yaml +++ b/.github/workflows/schema-tests.yaml @@ -33,7 +33,8 @@ jobs: - name: Install dependencies run: yarn install --immutable - - name: Run tests - run: yarn test + - name: Run schema tests + if: ${{ hashFiles('tests/schema/schema.test.mjs') != '' }} + run: yarn test tests/schema/schema.test.mjs env: BASE: ${{ github.event.pull_request.base.ref }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d2f87a526e..40df0577a9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -209,7 +209,7 @@ Before creating a pull request or marking a draft pull request as ready for revi | `yarn validate-markdown` | markdownlint + link check only — fast loop while editing | | `yarn format-markdown` | auto-fix markdownlint violations | | `yarn build-src` | full check: validation, HTML build, schema publish | - | `yarn test` | runs the JSON Schema and build tooling test suites | + | `yarn test` | runs the JSON Schema test suite on development branches | 5. After `yarn build-src`, open output file `deploy-preview/oas.html` with a browser and check your changes diff --git a/tests/md2html/README.md b/tests/md2html/README.md deleted file mode 100644 index 726a104d58..0000000000 --- a/tests/md2html/README.md +++ /dev/null @@ -1,7 +0,0 @@ -To view the HTML files in folder `fixtures` with respec formatting, you can -~~~sh -mkdir js -cp ../../node_modules/respec/builds/respec-w3c.js js/ -echo "*" > js/.gitignore -~~~ -and open them in a local browser. diff --git a/tests/md2html/fixtures/.gitattributes b/tests/md2html/fixtures/.gitattributes deleted file mode 100644 index 9a582600c1..0000000000 --- a/tests/md2html/fixtures/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -*.html text eol=lf \ No newline at end of file diff --git a/tests/md2html/fixtures/basic-new.html b/tests/md2html/fixtures/basic-new.html deleted file mode 100644 index 7f04b29f3d..0000000000 --- a/tests/md2html/fixtures/basic-new.html +++ /dev/null @@ -1,119 +0,0 @@ - - - - - -OpenAPI Specification v30.0.1 | Introduction, Definitions, & More - - -

OpenAPI Specification v30.0.1

What is the OpenAPI Specification?

The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for HTTP APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service.

Status of This Document

The source-of-truth for this specification is the HTML file referenced above as This version.
-

Heading 1

-

Text for first chapter

-

Version 30.0.1

-

This is the conformance section

-

Heading 2

-

Text for first section

-

Definitions

-

Foo

-

Definition of Foo.

-

Another Heading 2

-

Text for second section

-

Relative link to example

-

Relative link to something else

-

Heading 3

-

Text for first subsection

-

[[RFC3986]]

-

[[RFC9110]] Section 4

-
{
-  "foo": true
-}
-
-
foo: true
-
-
text/plain
-
-
no language
-
-
unknown language
-
-
https://foo.com/bar?baz=qux&fred=waldo#fragment
-
-
https://foo.com/bar{?baz*,qux}
-
-
--boundary-example
-Content-Type: application/openapi+yaml
-Content-Location: https://inaccessible-domain.com/api/openapi.yaml
-
-openapi: 3.2.0
-info:
-  title: Example API
-  version: 1.0
-  externalDocs:
-    url: docs.html
-
---boundary-example
-Content-Type: text/html
-Content-Location: https://example.com/api/docs.html
-
-<html>
-  <head>
-    <title>API Documentation</title>
-  </head>
-  <body>
-    <p>Awesome documentation goes here</p>
-  </body>
-</html>
-
-
event: addString
-data: This data is formatted
-data: across two lines
-retry: 5
-
-event: addNumber
-data: 1234.5678
-unknownField: this is ignored
-
-: This is a comment
-event: addJSON
-data: {"foo": 42}
-
-
{"event": "addString", "data": "This data is formatted\nacross two lines", "retry": 5}
-{"event": "addNumber", "data": "1234.5678"}
-{"event": "addJSON", "data": "{\"foo\": 42}"}
-
-
{"event": "addString", "data": "This data is formatted\nacross two lines", "retry": 5}
-{"event": "addNumber", "data": "1234.5678"}
-{"event": "addJSON", "data": "{\"foo\": 42}"}
-
-
0x1E{
-  "timestamp": "1985-04-12T23:20:50.52Z",
-  "level": 1,
-  "message": "Hi!"
-}
-0x1E{
-  "timestamp": "1985-04-12T23:20:51.37Z",
-  "level": 1,
-  "message": "Bye!"
-}
-
-

Appendix A: Revision History

- - - - - - - - - - - - - -
VersionDate
30.0.13001-04-01
- diff --git a/tests/md2html/fixtures/basic-new.maintainers b/tests/md2html/fixtures/basic-new.maintainers deleted file mode 100644 index f2f4308e82..0000000000 --- a/tests/md2html/fixtures/basic-new.maintainers +++ /dev/null @@ -1,11 +0,0 @@ -# Editors - -## Active -* John Doe [@johndoe](https://github.com/johndoe) -* Jane Doe [@janedow](https://github.com/janedoe) - -## Trainee -* New Bee [@newbee](https://github.com/newbee) - -## Emeritus -* Foo Bar [@foobar](https://github.com/foobar) diff --git a/tests/md2html/fixtures/basic-new.md b/tests/md2html/fixtures/basic-new.md deleted file mode 100644 index 8c5ffc209c..0000000000 --- a/tests/md2html/fixtures/basic-new.md +++ /dev/null @@ -1,135 +0,0 @@ -# Heading 1 - -Text for first chapter - -## Version 30.0.1 - -This is the conformance section - -## Heading 2 - -Text for first section - -## Definitions - -### Foo - -Definition of Foo. - -## Another Heading 2 - -Text for second section - -[Relative link to example](../examples/foo.yaml) - -[Relative link to something else](../something/else) - -### Heading 3 - -Text for first subsection - -[RFC3986](https://datatracker.ietf.org/doc/html/rfc3986) - -[RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#section-4) - -```json -{ - "foo": true -} -``` - -```yaml -foo: true -``` - -```text -text/plain -``` - -``` -no language -``` - -```unknown -unknown language -``` - -```uri -https://foo.com/bar?baz=qux&fred=waldo#fragment -``` - -```uritemplate -https://foo.com/bar{?baz*,qux} -``` - -```multipart ---boundary-example -Content-Type: application/openapi+yaml -Content-Location: https://inaccessible-domain.com/api/openapi.yaml - -openapi: 3.2.0 -info: - title: Example API - version: 1.0 - externalDocs: - url: docs.html - ---boundary-example -Content-Type: text/html -Content-Location: https://example.com/api/docs.html - - - - API Documentation - - -

Awesome documentation goes here

- - -``` - -```eventstream -event: addString -data: This data is formatted -data: across two lines -retry: 5 - -event: addNumber -data: 1234.5678 -unknownField: this is ignored - -: This is a comment -event: addJSON -data: {"foo": 42} -``` - -```jsonl -{"event": "addString", "data": "This data is formatted\nacross two lines", "retry": 5} -{"event": "addNumber", "data": "1234.5678"} -{"event": "addJSON", "data": "{\"foo\": 42}"} -``` - -```ndjson -{"event": "addString", "data": "This data is formatted\nacross two lines", "retry": 5} -{"event": "addNumber", "data": "1234.5678"} -{"event": "addJSON", "data": "{\"foo\": 42}"} -``` - -```jsonseq -0x1E{ - "timestamp": "1985-04-12T23:20:50.52Z", - "level": 1, - "message": "Hi!" -} -0x1E{ - "timestamp": "1985-04-12T23:20:51.37Z", - "level": 1, - "message": "Bye!" -} -``` - -## Appendix A: Revision History - -Version | Date ---------|----------- -30.0.1 | 3001-04-01 diff --git a/tests/md2html/fixtures/basic-old.html b/tests/md2html/fixtures/basic-old.html deleted file mode 100644 index c0beda2755..0000000000 --- a/tests/md2html/fixtures/basic-old.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - -OpenAPI Specification v30.0.1 | Introduction, Definitions, & More - - -

OpenAPI Specification v30.0.1

What is the OpenAPI Specification?

The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for HTTP APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service.

Status of This Document

The source-of-truth for this specification is the HTML file referenced above as This version.
-

Heading 1

-

Text for first chapter

-

Version 30.0.1

-

This is the conformance section

-

Heading 2

-

Text for first section

-

Broken anchor

-

Heading 3

-

Text for first subsection

- - - - - - - - - - - - - -
VersionDate
30.0.13001-04-01
- diff --git a/tests/md2html/fixtures/basic-old.maintainers b/tests/md2html/fixtures/basic-old.maintainers deleted file mode 100644 index f0d8428147..0000000000 --- a/tests/md2html/fixtures/basic-old.maintainers +++ /dev/null @@ -1,2 +0,0 @@ -## Active -* Foo Bar [@foobar](https://github.com/foobar) diff --git a/tests/md2html/fixtures/basic-old.md b/tests/md2html/fixtures/basic-old.md deleted file mode 100644 index 22be28ae57..0000000000 --- a/tests/md2html/fixtures/basic-old.md +++ /dev/null @@ -1,26 +0,0 @@ -# Heading 1 - -Text for first chapter - -#### Version 30.0.1 - -This is the conformance section - -## Table of Contents - -Will be removed - -## Heading 2 - -Text for first section - -Broken anchor - -### Heading 3 - -Text for first subsection - - -Version | Date ---------|----------- -30.0.1 | 3001-04-01 diff --git a/tests/md2html/fixtures/spec.config.json b/tests/md2html/fixtures/spec.config.json deleted file mode 100644 index b270bc3542..0000000000 --- a/tests/md2html/fixtures/spec.config.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "slug": "oas", - "shortName": "OAS", - "titleName": "OpenAPI Specification", - "titleSuffix": "| Introduction, Definitions, & More", - "abstractQuestion": "What is the OpenAPI Specification?", - "abstractText": "The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for HTTP APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service.", - "metaDescription": "The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for HTTP APIs.", - "copyright": "the Linux Foundation", - "edDraftURI": "https://github.com/OAI/OpenAPI-Specification/", - "logo": { - "src": "https://raw.githubusercontent.com/OAI/OpenAPI-Style-Guide/master/graphics/bitmap/OpenAPI_Logo_Pantone.png", - "alt": "OpenAPI Initiative", - "height": 48, - "url": "https://openapis.org/" - }, - "participateLinks": [ - { - "value": "GitHub OAI/OpenAPI-Specification", - "href": "https://github.com/OAI/OpenAPI-Specification/" - }, - { - "value": "File a bug", - "href": "https://github.com/OAI/OpenAPI-Specification/issues" - }, - { - "value": "Commit history", - "href": "https://github.com/OAI/OpenAPI-Specification/commits/main/versions/30.0.1.md" - }, - { - "value": "Pull requests", - "href": "https://github.com/OAI/OpenAPI-Specification/pulls" - } - ] -} diff --git a/tests/md2html/md2html.test.mjs b/tests/md2html/md2html.test.mjs deleted file mode 100644 index b9dbc91866..0000000000 --- a/tests/md2html/md2html.test.mjs +++ /dev/null @@ -1,49 +0,0 @@ -import { readdirSync, readFileSync } from "node:fs"; -import { execFile } from "node:child_process"; -import { resolve } from "node:path"; -import { describe, test, expect } from "@oai/build-infra/test"; -import assert from "node:assert"; - -const folder = "./tests/md2html/fixtures/"; -describe("md2html", async () => { - readdirSync(folder, { withFileTypes: true }) - .filter((entry) => entry.isFile() && /\.md$/.test(entry.name)) - .forEach((entry) => { - test(entry.name, async () => { - const expected = readFileSync( - folder + entry.name.replace(".md", ".html"), - "utf8", - ); - const output = await md2html( - [ - "--spec-config", - "spec.config.json", - "--maintainers", - entry.name.replace(".md", ".maintainers"), - entry.name, - "path/31.0.0.md\npath/30.0.1.md\npath/30.0.0.md", - ], - folder, - ); - expect(output.stdout).to.equal(expected); - }); - }); -}); - -function md2html(args, cwd) { - return new Promise((res) => { - execFile( - "node", - [`${resolve("./node_modules/@oai/build-infra/src/md2html/md2html.js")}`, ...args], - { cwd }, - (error, stdout, stderr) => { - res({ - code: error?.code || 0, - error, - stdout, - stderr, - }); - }, - ); - }); -}