-
-
Notifications
You must be signed in to change notification settings - Fork 475
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Windows tests (back), skip DO test in macOS/Win
- Loading branch information
Showing
5 changed files
with
63 additions
and
26 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
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 |
---|---|---|
@@ -1,13 +1,17 @@ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
|
||
// important: MUST use require()! | ||
const fs = require("node:fs"); | ||
const openapiTS = require("../dist/index.cjs"); | ||
const yaml = require("js-yaml"); | ||
|
||
// note: this import is fine; it’s just a test helper | ||
import { replaceLB } from "./helpers.js"; | ||
|
||
describe("CJS bundle", () => { | ||
it("basic", async () => { | ||
const input = yaml.load(fs.readFileSync(new URL("../examples/stripe-api.yaml", import.meta.url), "utf8")); | ||
const output = await openapiTS(input); | ||
expect(output).toBe(fs.readFileSync(new URL("../examples/stripe-api.ts", import.meta.url), "utf8")); | ||
expect(output).toBe(replaceLB(fs.readFileSync(new URL("../examples/stripe-api.ts", import.meta.url), "utf8"))); | ||
}); | ||
}); |
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,9 @@ | ||
export const CLRF_RE = /\r\n/g; | ||
|
||
/** Normalize all linebreaks to \n (for Windows tests) */ | ||
export function replaceLB(clrf: string): string { | ||
if (process.env.CI_ENV === "windows") { | ||
return clrf.replace(CLRF_RE, "\n"); | ||
} | ||
return clrf; | ||
} |
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