Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deps/update #61

Merged
merged 7 commits into from
Oct 4, 2024
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
23 changes: 0 additions & 23 deletions .eslintrc.cjs

This file was deleted.

12 changes: 6 additions & 6 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ jobs:
runs-on: macos-latest
strategy:
matrix:
node-version: [16.x, 18.x]
node-version: [18.x, 20.x, 22.x]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: ./scripts/build.sh
Expand All @@ -28,14 +28,14 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x, 18.x]
node-version: [18.x, 20.x, 22.x]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: ./scripts/build.sh
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
if: ${{ github.event.client_payload.release_type == 'major' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: fregante/setup-git-user@v1
Expand All @@ -30,11 +30,11 @@ jobs:
if: ${{ github.event.client_payload.release_type == 'minor' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: fregante/setup-git-user@v1
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
Expand All @@ -50,11 +50,11 @@ jobs:
if: ${{ github.event.client_payload.release_type == 'patch' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: fregante/setup-git-user@v1
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
Expand Down
41 changes: 41 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import tseslint from 'typescript-eslint';
import eslintConfigPrettier from "eslint-config-prettier";

import { includeIgnoreFile } from "@eslint/compat";
import path from "node:path";
import { fileURLToPath } from "node:url";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
import eslint from "@eslint/js";
const gitignorePath = path.resolve(__dirname, ".gitignore");

export default tseslint.config(
includeIgnoreFile(gitignorePath),
eslintConfigPrettier,
{
ignores: [
"**/test/*",
"commitlint.config.cjs",
"gulpfile.cjs"
],
},{
extends: [
eslint.configs.recommended,
...tseslint.configs.recommended,
tseslint.configs.eslintRecommended,
],
rules: {
'@typescript-eslint/no-explicit-any': ['warn'],
'@typescript-eslint/no-unused-vars': [
'warn',
{
args: 'after-used',
argsIgnorePattern: '_',
ignoreRestSiblings: false,
vars: 'all',
},
],
},
},
);
3 changes: 1 addition & 2 deletions lib/swagger-mock-validator/common/traverse-json-schema.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import _ from 'lodash';
import {isBoolean, isUndefined} from 'util';
import {ParsedSpecJsonSchema, ParsedSpecJsonSchemaCore} from '../spec-parser/parsed-spec';

export type JsonSchemaVisitor = (mutableSchema: ParsedSpecJsonSchemaCore) => void;

export const traverseJsonSchema = (mutableSchema: ParsedSpecJsonSchema | undefined, visitor: JsonSchemaVisitor) => {
if (isBoolean(mutableSchema) || isUndefined(mutableSchema)) {
if (typeof mutableSchema === "boolean" || mutableSchema == undefined) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {isString} from 'util';

export const isOpenApi3Content = (specContent: any): boolean => {
const openapiProperty = specContent.openapi;
return isString(openapiProperty) && openapiProperty.indexOf('3.') === 0;
return typeof openapiProperty === "string" && openapiProperty.indexOf('3.') === 0;
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import _ from 'lodash';
import {isObject} from 'util';
import {ValidationResultCode} from '../../api-types';
import {ParsedMockInteraction, ParsedMockValue} from '../mock-parser/parsed-mock';
import {result} from '../result';
Expand Down Expand Up @@ -43,7 +42,7 @@ const getCollectionSeparator = (parsedSpecCollectionFormat?: ParsedSpecCollectio
};

const isParsedSpecJsonSchemaCore = (schema?: ParsedSpecJsonSchema): schema is ParsedSpecJsonSchemaCore =>
isObject(schema);
schema !== null && typeof schema === "object";

const expandArrays = (
parsedMockValue: string,
Expand Down
82 changes: 42 additions & 40 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"scripts": {
"prettier": "prettier --check .",
"prettier:fix": "prettier --cache --write .",
"lint": "eslint --ignore-path .gitignore lib test",
"lint": "eslint",
"test": "jasmine --config=jasmine.json \"test/unit/**/*.ts\"",
"test:e2e": "jasmine --config=jasmine.json \"test/e2e/**/*.ts\"",
"build": "rm -rf dist && rollup -c",
Expand All @@ -34,56 +34,58 @@
},
"type": "module",
"devDependencies": {
"@babel/core": "^7.22.10",
"@babel/preset-env": "^7.22.10",
"@babel/preset-typescript": "^7.22.5",
"@babel/register": "^7.22.5",
"@commitlint/cli": "^17.7.1",
"@commitlint/config-conventional": "^17.7.0",
"@rollup/plugin-babel": "^6.0.3",
"@rollup/plugin-commonjs": "^25.0.4",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.2.0",
"@types/body-parser": "^1.19.2",
"@types/express": "^4.17.17",
"@types/jasmine": "^4.3.5",
"@types/js-yaml": "^4.0.5",
"@types/lodash": "^4.14.197",
"@types/node": "^20.5.1",
"@types/verror": "^1.10.6",
"@typescript-eslint/eslint-plugin": "^6.4.0",
"@typescript-eslint/parser": "^6.4.0",
"@babel/core": "^7.25.7",
"@babel/preset-env": "^7.25.7",
"@babel/preset-typescript": "^7.25.7",
"@babel/register": "^7.25.7",
"@commitlint/cli": "^19.5.0",
"@commitlint/config-conventional": "^19.5.0",
"@eslint/compat": "^1.1.1",
"@eslint/js": "^9.11.1",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^28.0.0",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.3.0",
"@types/body-parser": "^1.19.5",
"@types/eslint__js": "^8.42.3",
"@types/express": "^5.0.0",
"@types/jasmine": "^5.1.4",
"@types/js-yaml": "^4.0.9",
"@types/lodash": "^4.17.10",
"@types/node": "^20.16.10",
"@types/verror": "^1.10.10",
"ansi-colors": "^4.1.3",
"body-parser": "^1.20.2",
"conventional-changelog": "^4.0.0",
"eslint": "^8.47.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-jest": "^27.2.3",
"express": "^4.18.2",
"gulp": "^4.0.2",
"body-parser": "^2.0.1",
"conventional-changelog": "^6.0.0",
"eslint": "^9.11.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jest": "^28.8.3",
"express": "^5.0.0",
"gulp": "^5.0.0",
"gulp-bump": "^3.2.0",
"gulp-cli": "^2.3.0",
"gulp-conventional-changelog": "^3.0.0",
"gulp-git": "^2.10.1",
"husky": "^8.0.3",
"jasmine": "^5.1.0",
"gulp-cli": "^3.0.0",
"gulp-conventional-changelog": "^5.0.0",
"gulp-git": "^2.11.0",
"husky": "^9.1.6",
"jasmine": "^5.3.0",
"minimist": "^1.2.8",
"prettier": "^3.0.2",
"rollup": "^3.28.0",
"typescript": "^5.1.6"
"prettier": "^3.3.3",
"rollup": "^4.24.0",
"typescript": "^5.6.2",
"typescript-eslint": "^8.8.0"
},
"dependencies": {
"@apidevtools/swagger-parser": "^10.1.0",
"ajv": "^8.12.0",
"ajv-formats": "^2.1.1",
"axios": "^1.4.0",
"commander": "^11.0.0",
"ajv": "^8.17.1",
"ajv-formats": "^3.0.1",
"axios": "^1.7.7",
"commander": "^12.1.0",
"js-yaml": "^4.1.0",
"jsonpointer": "^5.0.1",
"lodash": "^4.17.21",
"openapi-types": "^12.1.3",
"patch-package": "^8.0.0",
"uuidjs": "^5.0.1",
"uuidjs": "^5.1.0",
"verror": "^1.10.1"
},
"types": "lib/api-types.d.ts"
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion test/e2e/cli.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ describe('swagger-mock-validator/cli', () => {

const expressApp = express();

expressApp.get('/*', (request, _, next) => {
expressApp.get(/(.*)/, (request, _, next) => {
mockPactBroker.get(request.headers, request.url);
next();
});
Expand Down
Loading
Loading