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
41 changes: 41 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Test

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6

- name: Setup Node 20
uses: actions/setup-node@v6
with:
cache: "npm"
node-version: 20

- name: Install deps
run: |
echo "::group::npm ci"
npm ci
echo "::endgroup::"
echo "::group::npm ls -a"
npm ls -a || true
echo "::endgroup::"
shell: bash

# script "build" also calls "lint"
- name: Build
run: npm run build

- name: Test
run: npm run test
8 changes: 4 additions & 4 deletions lib/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import * as path from "path";
import * as fs from "fs";
import jsYaml from "js-yaml";
import { dump as yamlDump } from "js-yaml";

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

narrow import to fix lint error

import { flatMap, StringMap } from "@azure-tools/openapi-tools-common";
import * as utils from "./util/utils";

Expand Down Expand Up @@ -63,7 +63,7 @@ const prettyPrint = <T extends NodeError<T>>(
) => {
if (errors !== undefined) {
for (const error of errors) {
const yaml = jsYaml.dump(error);
const yaml = yamlDump(error);
if (process.env["Agent.Id"]) {
// eslint-disable-next-line no-console
console.error(vsoLogIssueWrapper(errorType, yaml));
Expand All @@ -78,7 +78,7 @@ const prettyPrint = <T extends NodeError<T>>(
const prettyPrintInfo = <T>(errors: readonly T[] | undefined, errorType: ErrorType) => {
if (errors !== undefined) {
for (const error of errors) {
const yaml = jsYaml.dump(error);
const yaml = yamlDump(error);
if (process.env["Agent.Id"]) {
// eslint-disable-next-line no-console
console.error(vsoLogIssueWrapper(errorType, yaml));
Expand Down Expand Up @@ -122,7 +122,7 @@ export const validateSpec = async (specPath: string, options: Options | undefine
} catch (err) {
let outputMsg = err;
if (typeof err === "object") {
outputMsg = jsYaml.dump(err);
outputMsg = yamlDump(err);
}
if (o.pretty) {
logMessage(`Semantically validating ${specPath}`);
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@
"copy-templates": "copyfiles -V -E -u 1 lib/apiScenario/templates/* lib/templates/base*.mustache dist/lib",
"build": "run-p tsc lint copy-templates",
"tsc": "tsc",
"lint": "eslint ./lib/**/*.ts ./test/**/*.ts ./*.ts",
"lint-fix": "eslint ./lib/**/*.ts ./test/**/*.ts ./*.ts --fix",
"lint": "DEBUG=eslint:eslint,eslint:linter eslint \"./lib/**/*.ts\" \"./test/**/*.ts\" \"./*.ts\"",

@mikeharder Mike Harder (mikeharder) Apr 24, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

increase verbosity, quote args to prevent shell expansion (files were being missed)

"lint-fix": "DEBUG=eslint:eslint,eslint:linter eslint \"./lib/**/*.ts\" \"./test/**/*.ts\" \"./*.ts\" --fix",
"test": "npm run tsc && jest --ci --reporters=default --reporters=jest-junit",
"fast-test": "jest --ci --reporters=default --reporters=jest-junit --config ./jest.config.js ",
"slow-test": "node --max-old-space-size=10192 ./node_modules/.bin/jest -u --runInBand --ci --reporters=default --reporters=jest-junit --config ./regression/jest.regression.config.js ",
Expand Down
2 changes: 1 addition & 1 deletion test/roundtripValidatorTests.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as assert from "assert";
import * as glob from "glob";
import * as path from "path";
import * as glob from "glob";

@mikeharder Mike Harder (mikeharder) Apr 24, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

linter error (imports must be sorted)

import { DefaultConfig } from "../lib/util/constants";
import { RequestResponsePair, LiveValidator } from "../lib/liveValidation/liveValidator";

Expand Down
Loading