Skip to content

Commit

Permalink
chore: changes after review
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryAnansky committed Jan 21, 2025
1 parent 5dff470 commit 2f7e4b0
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 14 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/smoke.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,34 @@ jobs:
node-version: 18
- run: bash ./__tests__/smoke/run-smoke.sh "yarn add redoc ./redocly-cli.tgz" "yarn"

run-smoke--npm--node-22--windows:
needs: prepare-smoke
runs-on: windows-latest
steps:
- uses: actions/cache@v3
with:
path: __tests__/smoke/
key: cache-${{ github.run_id }}-${{ github.run_attempt }}
enableCrossOsArchive: true
- uses: actions/setup-node@v3
with:
node-version: 22
- run: bash ./__tests__/smoke/run-smoke.sh "npm i redocly-cli.tgz" "npm run"

run-smoke--yarn--node-22--windows:
needs: prepare-smoke
runs-on: windows-latest
steps:
- uses: actions/cache@v3
with:
path: __tests__/smoke/
key: cache-${{ github.run_id }}-${{ github.run_attempt }}
enableCrossOsArchive: true
- uses: actions/setup-node@v3
with:
node-version: 22
- run: bash ./__tests__/smoke/run-smoke.sh "yarn add ./redocly-cli.tgz" "yarn"

run-smoke--npm--node-18--windows:
needs: prepare-smoke
runs-on: windows-latest
Expand Down
6 changes: 3 additions & 3 deletions 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 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"private": true,
"engines": {
"node": ">=18.17.0",
"npm": ">=7.0.0"
"npm": ">=10.8.2"
},
"engineStrict": true,
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"engines": {
"node": ">=18.17.0",
"npm": ">=7.0.0"
"npm": ">=10.8.2"
},
"engineStrict": true,
"scripts": {
Expand Down
14 changes: 9 additions & 5 deletions packages/cli/src/__tests__/commands/push.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ import { ConfigFixture } from '../fixtures/config';
import { yellow } from 'colorette';
import { Readable } from 'node:stream';

jest.mock('fs');
jest.mock('@redocly/openapi-core');
jest.mock('../../utils/miscellaneous');

// Mock fs operations
jest.mock('fs', () => ({
...jest.requireActual('fs'),
Expand All @@ -25,6 +21,9 @@ jest.mock('fs', () => ({
readdirSync: jest.fn(() => []),
}));

jest.mock('@redocly/openapi-core');
jest.mock('../../utils/miscellaneous');

// Mock fetch
const mockFetch = jest.fn(() =>
Promise.resolve({
Expand All @@ -46,7 +45,7 @@ const mockFetch = jest.fn(() =>
} as Response)
);

global.fetch = mockFetch;
const originalFetch = global.fetch;

(getMergedConfig as jest.Mock).mockImplementation((config) => config);

Expand All @@ -55,12 +54,17 @@ describe('push', () => {

beforeEach(() => {
jest.spyOn(process.stdout, 'write').mockImplementation(() => true);
global.fetch = mockFetch;
});

afterEach(() => {
mockFetch.mockClear();
});

afterAll(() => {
global.fetch = originalFetch;
});

it('pushes definition', async () => {
await handlePush({
argv: {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/cms/api/api-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import fetchWithTimeout, {
} from '../../utils/fetch-with-timeout';

import type { ReadStream } from 'fs';
import type { Readable } from 'node:stream';
import type {
ListRemotesResponse,
ProjectSourceResponse,
PushResponse,
UpsertRemoteResponse,
} from './types';
import type { Readable } from 'stream';

interface BaseApiClient {
request(url: string, options: FetchWithTimeoutOptions): Promise<Response>;
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/commands/push.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ import { promptClientToken } from './login';
import { handlePush as handleCMSPush } from '../cms/commands/push';
import { streamToBuffer } from '../cms/api/api-client';

import type { Readable } from 'node:stream';
import type { Agent } from 'node:http';
import type { Config, BundleOutputFormat, Region } from '@redocly/openapi-core';
import type { CommandArgs } from '../wrapper';
import type { VerifyConfigOptions } from '../types';
import type { Readable } from 'node:stream';
import type { Agent } from 'node:http';

const DEFAULT_VERSION = 'latest';

Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "lib/index.js",
"engines": {
"node": ">=18.17.0",
"npm": ">=7.0.0"
"npm": ">=10.8.2"
},
"engineStrict": true,
"license": "MIT",
Expand Down

0 comments on commit 2f7e4b0

Please sign in to comment.