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
57 changes: 57 additions & 0 deletions .github/workflows/tsp-client-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: tsp-client - Test

on:
push:
branches:
- main
pull_request:
paths:
- .github/workflows/tsp-client-tests.yml
- tools/tsp-client/**
Comment thread
catalinaperalta marked this conversation as resolved.

jobs:
tsp-client:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node-version: [18, 20]
exclude:
- os: ubuntu-latest
node-version: 20
- os: windows-latest
node-version: 18

runs-on: ${{ matrix.os }}

steps:
- if: runner.os == 'Windows'
run: git config --global core.longpaths true
shell: pwsh

- uses: actions/checkout@v4
with:
sparse-checkout: |
.github/workflows
tools/tsp-client

- name: Use Node ${{ matrix.node-version }}.x
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}.x

- run: npm ci
shell: pwsh
working-directory: tools/tsp-client

- run: npm ls -a
shell: pwsh
continue-on-error: true
working-directory: tools/tsp-client

- run: npm run build
shell: pwsh
working-directory: tools/tsp-client

- run: npm run test
shell: pwsh
working-directory: tools/tsp-client
36 changes: 27 additions & 9 deletions tools/tsp-client/test/commands.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ describe("Verify commands", async function () {
await it("Sync example sdk", async function () {
try {
const args = {
"output-dir": "./test/examples/sdk/contosowidgetmanager/contosowidgetmanager-rest",
"output-dir": joinPaths(
cwd(),
"./test/examples/sdk/contosowidgetmanager/contosowidgetmanager-rest",
),
};
await syncCommand(args);
} catch (error) {
Expand All @@ -60,7 +63,7 @@ describe("Verify commands", async function () {
await it("Sync example sdk with local spec", async function () {
try {
const args = {
"output-dir": "./test/examples/sdk/local-spec-sdk",
"output-dir": joinPaths(cwd(), "./test/examples/sdk/local-spec-sdk"),
"local-spec-repo":
"./test/examples/specification/contosowidgetmanager/Contoso.WidgetManager",
};
Expand All @@ -75,7 +78,10 @@ describe("Verify commands", async function () {
await it("Generate example sdk", async function () {
try {
const args = {
"output-dir": "./test/examples/sdk/contosowidgetmanager/contosowidgetmanager-rest",
"output-dir": joinPaths(
cwd(),
"./test/examples/sdk/contosowidgetmanager/contosowidgetmanager-rest",
),
"save-inputs": true,
};
await generateCommand(args);
Expand All @@ -91,7 +97,10 @@ describe("Verify commands", async function () {
await it("Update example sdk", async function () {
try {
const args = {
"output-dir": "./test/examples/sdk/contosowidgetmanager/contosowidgetmanager-rest",
"output-dir": joinPaths(
cwd(),
"./test/examples/sdk/contosowidgetmanager/contosowidgetmanager-rest",
),
"save-inputs": true,
};
await updateCommand(args);
Expand All @@ -103,7 +112,10 @@ describe("Verify commands", async function () {
await it("Update example sdk & pass tspconfig.yaml", async function () {
try {
const args = {
"output-dir": "./test/examples/sdk/contosowidgetmanager/contosowidgetmanager-rest",
"output-dir": joinPaths(
cwd(),
"./test/examples/sdk/contosowidgetmanager/contosowidgetmanager-rest",
),
"tsp-config":
"https://github.com/Azure/azure-rest-api-specs/blob/db63bea839f5648462c94e685d5cc96f8e8b38ba/specification/contosowidgetmanager/Contoso.WidgetManager/tspconfig.yaml",
"save-inputs": true,
Expand All @@ -117,7 +129,10 @@ describe("Verify commands", async function () {
await it("Update example sdk & pass commit", async function () {
try {
const args = {
"output-dir": "./test/examples/sdk/contosowidgetmanager/contosowidgetmanager-rest",
"output-dir": joinPaths(
cwd(),
"./test/examples/sdk/contosowidgetmanager/contosowidgetmanager-rest",
),
commit: "db63bea839f5648462c94e685d5cc96f8e8b38ba",
"save-inputs": true,
};
Expand All @@ -130,7 +145,10 @@ describe("Verify commands", async function () {
await it("Update example sdk & pass only --repo", async function () {
try {
const args = {
"output-dir": "./test/examples/sdk/contosowidgetmanager/contosowidgetmanager-rest",
"output-dir": joinPaths(
cwd(),
"./test/examples/sdk/contosowidgetmanager/contosowidgetmanager-rest",
),
repo: "foo",
"save-inputs": true,
};
Expand All @@ -147,7 +165,7 @@ describe("Verify commands", async function () {
await it.skip("Init example sdk", async function () {
try {
const args = {
"output-dir": "./test/examples/",
"output-dir": joinPaths(cwd(), "./test/examples/"),
"tsp-config":
"https://github.com/Azure/azure-rest-api-specs/blob/7ed015e3dd1b8b1b0e71c9b5e6b6c5ccb8968b3a/specification/cognitiveservices/ContentSafety/tspconfig.yaml",
};
Expand All @@ -169,7 +187,7 @@ describe("Verify commands", async function () {
await it.skip("Init with --skip-sync-and-generate", async function () {
try {
const args = {
"output-dir": "./test/examples/",
"output-dir": joinPaths(cwd(), "./test/examples/"),
"tsp-config":
"https://github.com/Azure/azure-rest-api-specs/blob/7ed015e3dd1b8b1b0e71c9b5e6b6c5ccb8968b3a/specification/cognitiveservices/ContentSafety/tspconfig.yaml",
"skip-sync-and-generate": true,
Expand Down