Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tools/automated-tests/collect-urls.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
import { readFileSync, existsSync, readdirSync } from "fs";
import { join, dirname } from "path";
import { fileURLToPath } from "url";
import yaml from "js-yaml";
import { load } from "js-yaml";

const SCRIPT_DIR = dirname(fileURLToPath(import.meta.url));
const REPO_ROOT = join(SCRIPT_DIR, "../..");
const VERSION_DIR = /^v\d+$/i;

function defaultBaseUrl() {
const testsConfig = yaml.load(
const testsConfig = load(
readFileSync(join(SCRIPT_DIR, "config/tests.yaml"), "utf8"),
);
return testsConfig.baseUrl;
Expand All @@ -44,7 +44,7 @@ function parseFrontmatter(content) {
const m = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
if (!m) return {};
try {
return yaml.load(m[1]) ?? {};
return load(m[1]) ?? {};
} catch {
return {};
}
Expand Down
4 changes: 2 additions & 2 deletions tools/automated-tests/generate-instructions-files.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import yaml from "js-yaml";
import { load } from "js-yaml";
import fs from "fs/promises";
import minimist from "minimist";
import { generateInstructionFiles } from "./instructions/extractor.js";
Expand All @@ -10,7 +10,7 @@ import { collectUrls } from "./collect-urls.mjs";
try {
const args = minimist(process.argv.slice(2));
const fileContent = await fs.readFile("./config/tests.yaml", "utf8");
const testsConfig = yaml.load(fileContent);
const testsConfig = load(fileContent);
let urlsToTest;
let howToFiles;
let haltOnSeriesError = true;
Expand Down
4 changes: 2 additions & 2 deletions tools/automated-tests/instructions-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fs from "fs/promises";
import { glob } from "tinyglobby";
import matter from "gray-matter";
import path from "path";
import yaml from "js-yaml";
import { dump } from "js-yaml";

function fileToUrl(file) {
return file.replace("../../app/_how-tos/", "").replace(".md", "/");
Expand Down Expand Up @@ -94,7 +94,7 @@ export async function testeableUrlsFromFiles(config, files, { explicit = false }
}
}
}
await fs.writeFile(".automated-tests", yaml.dump(skipped), "utf-8");
await fs.writeFile(".automated-tests", dump(skipped), "utf-8");

return howTosUrls;
}
Expand Down
4 changes: 2 additions & 2 deletions tools/automated-tests/instructions/extractor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { chromium } from "playwright";
import fs from "fs/promises";
import path from "path";
import yaml from "js-yaml";
import { dump } from "js-yaml";

class NonFirstSeriesPageError extends Error {}

Expand Down Expand Up @@ -283,7 +283,7 @@ async function writeInstructionsToFile(url, config, platform, product, instructi
const instructionsDir = path.dirname(instructionsFile);
await fs.mkdir(instructionsDir, { recursive: true });

await fs.writeFile(instructionsFile, yaml.dump(instructions), "utf-8");
await fs.writeFile(instructionsFile, dump(instructions), "utf-8");

return instructionsFile;
}
Expand Down
4 changes: 2 additions & 2 deletions tools/automated-tests/instructions/runner.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from "fs/promises";
import yaml from "js-yaml";
import { load } from "js-yaml";
import debug from "debug";
import { processPrereqs } from "./prereqs.js";
import { processCleanup } from "./cleanup.js";
Expand Down Expand Up @@ -228,7 +228,7 @@ export async function runInstructionsFile(file, runtimeConfig, container) {
const start = Date.now();
log(`Running file: ${file}`);
const fileContent = await fs.readFile(file, "utf8");
const instructions = yaml.load(fileContent);
const instructions = load(fileContent);
const { status, assertions, name } = await runInstructions(
instructions,
runtimeConfig,
Expand Down
4 changes: 2 additions & 2 deletions tools/automated-tests/instructions/validations.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import path from "path";
import { dirname } from "path";
import { fileURLToPath } from "url";

import yaml from "js-yaml";
import { load } from "js-yaml";

import {
setEnvVariable,
Expand All @@ -20,7 +20,7 @@ const log = debug("tests:runner");
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

const testsConfig = yaml.load(fs.readFileSync("./config/tests.yaml", "utf-8"));
const testsConfig = load(fs.readFileSync("./config/tests.yaml", "utf-8"));
const skipEnvVariables = new Set(
testsConfig.validations?.skip_env_variables ?? [],
);
Expand Down
10 changes: 5 additions & 5 deletions tools/automated-tests/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tools/automated-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"fetch-cookie": "^3.1.0",
"formdata-node": "^6.0.3",
"gray-matter": "^4.0.3",
"js-yaml": "^4.1.0",
"js-yaml": "^5.0.0",
"minimist": "^1.2.8",
"node-fetch": "^3.3.2",
"playwright": "^1.54.2",
Expand Down
9 changes: 4 additions & 5 deletions tools/automated-tests/reporting.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from "fs/promises";
import yaml from "js-yaml";
import { load } from "js-yaml";

const expectedFailures = yaml.load(
const expectedFailures = load(
await fs.readFile("./config/expected_failures.yaml", "utf-8")
);

Expand Down Expand Up @@ -128,9 +128,8 @@ export async function logResults(
if (includeGlobalSkips) {
let skippedInstructions;
try {
skippedInstructions = yaml.load(
await fs.readFile("./.automated-tests", "utf-8")
);
const content = await fs.readFile("./.automated-tests", "utf-8");
skippedInstructions = content.trim() ? load(content) : [];
} catch (error) {
if (error.code !== "ENOENT") throw error;
}
Expand Down
6 changes: 3 additions & 3 deletions tools/automated-tests/run.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from "fs/promises";
import yaml from "js-yaml";
import { load } from "js-yaml";
import Dockerode from "dockerode";
import minimist from "minimist";
import { logResult, logResults, isFailureExpected } from "./reporting.js";
Expand Down Expand Up @@ -40,7 +40,7 @@ export async function loadConfig() {
const configFile = "./config/tests.yaml";

const fileContent = await fs.readFile(configFile, "utf8");
const config = yaml.load(fileContent);
const config = load(fileContent);

return config;
}
Expand All @@ -52,7 +52,7 @@ export async function loadConfig() {
// ever starts, then boot it once for the rest of the batch as usual.
async function usesStandaloneGateway(file) {
const fileContent = await fs.readFile(file, "utf8");
const instructions = yaml.load(fileContent);
const instructions = load(fileContent);
const { standaloneGateway } = await getSetupConfig(instructions.setup);
return Boolean(standaloneGateway);
}
Expand Down
4 changes: 2 additions & 2 deletions tools/automated-tests/runtimes.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import debug from "debug";
import fs from "fs/promises";
import yaml from "js-yaml";
import { load } from "js-yaml";
import { executeCommand, fetchImage, setEnvVariable } from "./docker-helper.js";
import path from "path";
import { dirname } from "path";
Expand All @@ -12,7 +12,7 @@ const __dirname = dirname(__filename);

export async function getRuntimeConfig(deploymentModel, product) {
const fileContent = await fs.readFile(`./config/runtimes.yaml`, "utf8");
const configs = yaml.load(fileContent);
const configs = load(fileContent);
const imageName = `automated-tests`;

if (!configs[deploymentModel]) {
Expand Down
4 changes: 2 additions & 2 deletions tools/changelog-generator/changelog.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from "fs";
import yaml from "js-yaml";
import { load } from "js-yaml";
import path from "path";
import { globSync } from "tinyglobby";
import mergeWith from "lodash.mergewith";
Expand Down Expand Up @@ -61,7 +61,7 @@ function generateChangelog(product) {
.map((file) => "./" + path.join(versionPath, file));

const entries = files.flatMap((f) =>
yaml.load(fs.readFileSync(f, "utf-8"))
load(fs.readFileSync(f, "utf-8"))
);
entries_by_version[version] = entries;
}
Expand Down
10 changes: 5 additions & 5 deletions tools/changelog-generator/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tools/changelog-generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"license": "MIT",
"dependencies": {
"tinyglobby": "^0.2.12",
"js-yaml": "^4.1.0",
"js-yaml": "^5.0.0",
"lodash.mergewith": "^4.6.2",
"minimist": "^1.2.8"
}
Expand Down
6 changes: 3 additions & 3 deletions tools/changelog-generator/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fs from "fs";
import path from "path";
import { globSync } from "tinyglobby";
import minimist from "minimist";
import yaml from "js-yaml";
import { load } from "js-yaml";
import { compareVersions } from "./compare-versions.js";

function generateChangelogsByVersion(folderPath, version, product) {
Expand All @@ -19,13 +19,13 @@ function generateChangelogsByVersion(folderPath, version, product) {
});

let changelog = {};
const setup = yaml.load(fs.readFileSync("./config/setup.yaml", "utf-8"));
const setup = load(fs.readFileSync("./config/setup.yaml", "utf-8"));
folders.forEach((folder) => {
const key = path.basename(folder);
changelog[key] = [];
const entries = globSync(`${folder}/*`);
entries.forEach((entry) => {
const change = yaml.load(fs.readFileSync(entry, "utf-8"));
const change = load(fs.readFileSync(entry, "utf-8"));
if (!change.hasOwnProperty("scope")) {
change.scope = setup.defaults.scope;
}
Expand Down
4 changes: 2 additions & 2 deletions tools/missing-redirects/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { execSync } from "node:child_process";
import fs from "node:fs";
import path from "node:path";
import matter from "gray-matter";
import yaml from "js-yaml";
import { load } from "js-yaml";
import minimist from "minimist";

const argv = minimist(process.argv.slice(2));
Expand Down Expand Up @@ -30,7 +30,7 @@ const collectionPermalinks = (function () {
const configFile = "../../jekyll.yml";
let permalinks = {};
if (fs.existsSync(configFile)) {
const config = yaml.load(fs.readFileSync(configFile, "utf8"));
const config = load(fs.readFileSync(configFile, "utf8"));
if (config.defaults) {
for (const def of config.defaults) {
if (def.scope?.path?.startsWith("_") && def.values?.permalink) {
Expand Down
10 changes: 5 additions & 5 deletions tools/missing-redirects/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tools/missing-redirects/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"license": "MIT",
"dependencies": {
"gray-matter": "^4.0.3",
"js-yaml": "^4.1.0",
"js-yaml": "^5.0.0",
"minimist": "^1.2.8"
}
}
10 changes: 5 additions & 5 deletions tools/plugins-changelog-generator/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tools/plugins-changelog-generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"dependencies": {
"tinyglobby": "^0.2.12",
"gray-matter": "^4.0.3",
"js-yaml": "^4.1.1",
"js-yaml": "^5.0.0",
"minimist": "^1.2.8",
"semver": "^7.7.2"
}
Expand Down
Loading
Loading