diff --git a/package.json b/package.json index cd3a13b33b..90107b5945 100644 --- a/package.json +++ b/package.json @@ -73,7 +73,6 @@ "@swc/jest": "^0.2.21", "@types/file-entry-cache": "^5.0.2", "@types/jest": "^28.1.6", - "@types/jest-when": "^2.7.3", "@types/karma": "^6.3.3", "@types/lodash": "^4.14.176", "@types/node": "^15.12.4", @@ -93,7 +92,6 @@ "husky": "^7.0.4", "jest": "^28.1.3", "jest-mock": "^27.5.1", - "jest-when": "^3.4.2", "karma": "^6.4.0", "karma-chrome-launcher": "^3.1.1", "karma-jasmine": "^5.1.0", diff --git a/packages/cli/package.json b/packages/cli/package.json index 80b26a97ef..00d6c846e1 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -33,17 +33,16 @@ "release": "semantic-release -e semantic-release-monorepo" }, "dependencies": { - "@rollup/plugin-commonjs": "^20.0.0", - "@stoplight/json": "3.17.0", + "@stoplight/json": "~3.20.1", "@stoplight/path": "1.3.2", - "@stoplight/spectral-core": "^1.5.1", - "@stoplight/spectral-parsers": "^1.0.1", + "@stoplight/spectral-core": "^1.14.1", + "@stoplight/spectral-parsers": "^1.0.2", "@stoplight/spectral-ref-resolver": "1.0.1", - "@stoplight/spectral-ruleset-bundler": "^1.0.0", - "@stoplight/spectral-ruleset-migrator": "^1.5.0", + "@stoplight/spectral-ruleset-bundler": "^1.3.2", + "@stoplight/spectral-ruleset-migrator": "^1.7.4", "@stoplight/spectral-rulesets": ">=1", - "@stoplight/spectral-runtime": "^1.1.0", - "@stoplight/types": "12.3.0", + "@stoplight/spectral-runtime": "^1.1.2", + "@stoplight/types": "^13.6.0", "chalk": "4.1.2", "cliui": "7.0.4", "eol": "0.9.1", @@ -63,7 +62,6 @@ "@types/yargs": "^17.0.8", "copyfiles": "^2.4.1", "es-aggregate-error": "^1.0.7", - "jest-when": "^3.4.2", "nock": "^13.1.3", "node-html-parser": "^4.1.5", "pkg": "^5.4.1", diff --git a/packages/cli/src/services/linter/utils/__tests__/listFiles.test.ts b/packages/cli/src/services/linter/utils/__tests__/listFiles.test.ts index 07b613757a..0c1fec0d1e 100644 --- a/packages/cli/src/services/linter/utils/__tests__/listFiles.test.ts +++ b/packages/cli/src/services/linter/utils/__tests__/listFiles.test.ts @@ -1,6 +1,5 @@ import * as path from '@stoplight/path'; import * as fg from 'fast-glob'; -import { when } from 'jest-when'; import { listFiles } from '../listFiles'; jest.mock('fast-glob', () => jest.fn(async () => [])); @@ -25,11 +24,13 @@ describe('listFiles CLI util', () => { it('given disabled ignoredUnmatchedGlobs, reports unmatched patterns', async () => { const list = [path.join(__dirname, 'foo/a.json'), path.join(__dirname, 'foo/b.json')]; - when(fg as unknown as jest.Mock) - .calledWith('./foo/*.json', expect.any(Object)) - .mockResolvedValueOnce([...list]) - .calledWith('bar/**/baz*.yaml', expect.any(Object)) - .mockResolvedValueOnce([]); + (fg as unknown as jest.Mock).mockImplementation(async pattern => { + if (pattern === './foo/*.json') { + return list; + } + + return []; + }); expect(await listFiles(['./foo/*.json', 'bar/**/baz*.yaml'], false)).toEqual([list, ['bar/**/baz*.yaml']]); }); diff --git a/packages/cli/src/services/linter/utils/getRuleset.ts b/packages/cli/src/services/linter/utils/getRuleset.ts index f2af0b7c91..ba974b18c9 100644 --- a/packages/cli/src/services/linter/utils/getRuleset.ts +++ b/packages/cli/src/services/linter/utils/getRuleset.ts @@ -8,10 +8,10 @@ import { fetch } from '@stoplight/spectral-runtime'; import { migrateRuleset } from '@stoplight/spectral-ruleset-migrator'; import { bundleRuleset } from '@stoplight/spectral-ruleset-bundler'; import { node } from '@stoplight/spectral-ruleset-bundler/presets/node'; +import { commonjs } from '@stoplight/spectral-ruleset-bundler/plugins/commonjs'; import { stdin } from '@stoplight/spectral-ruleset-bundler/plugins/stdin'; import { builtins } from '@stoplight/spectral-ruleset-bundler/plugins/builtins'; import { isError, isObject } from 'lodash'; -import commonjs from '@rollup/plugin-commonjs'; import { CLIError } from '../../../errors'; async function getDefaultRulesetFile(): Promise> { diff --git a/yarn.lock b/yarn.lock index 250d405113..45d41ec3c4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2218,23 +2218,6 @@ __metadata: languageName: node linkType: hard -"@rollup/plugin-commonjs@npm:^20.0.0": - version: 20.0.0 - resolution: "@rollup/plugin-commonjs@npm:20.0.0" - dependencies: - "@rollup/pluginutils": ^3.1.0 - commondir: ^1.0.1 - estree-walker: ^2.0.1 - glob: ^7.1.6 - is-reference: ^1.2.1 - magic-string: ^0.25.7 - resolve: ^1.17.0 - peerDependencies: - rollup: ^2.38.3 - checksum: fefc4b5ab1509ff64e26dfee3eca2f23cea204bf20f3dc76c616d3aa3faf4b1035166287518a64ba07faaaea1621a0af5b94b8f8199371ca67db905562e7e619 - languageName: node - linkType: hard - "@rollup/plugin-commonjs@npm:~22.0.2": version: 22.0.2 resolution: "@rollup/plugin-commonjs@npm:22.0.2" @@ -2463,19 +2446,6 @@ __metadata: languageName: node linkType: hard -"@stoplight/json@npm:3.17.0": - version: 3.17.0 - resolution: "@stoplight/json@npm:3.17.0" - dependencies: - "@stoplight/ordered-object-literal": ^1.0.2 - "@stoplight/types": ^12.3.0 - jsonc-parser: ~2.2.1 - lodash: ^4.17.21 - safe-stable-stringify: ^1.1 - checksum: 452bb6963d35196420d1214320223c38d3c7858a0420ad222d347c6bcaf69a5897add288ae7305f6cf46ff1f078c037f4c9deb42911f8f0907bcfbd97dcfbd62 - languageName: node - linkType: hard - "@stoplight/json@npm:^3.17.0, @stoplight/json@npm:^3.17.1, @stoplight/json@npm:^3.20.1, @stoplight/json@npm:~3.20.1": version: 3.20.1 resolution: "@stoplight/json@npm:3.20.1" @@ -2499,7 +2469,7 @@ __metadata: languageName: node linkType: hard -"@stoplight/ordered-object-literal@npm:^1.0.1, @stoplight/ordered-object-literal@npm:^1.0.2, @stoplight/ordered-object-literal@npm:^1.0.3, @stoplight/ordered-object-literal@npm:~1.0.4": +"@stoplight/ordered-object-literal@npm:^1.0.1, @stoplight/ordered-object-literal@npm:^1.0.3, @stoplight/ordered-object-literal@npm:~1.0.4": version: 1.0.4 resolution: "@stoplight/ordered-object-literal@npm:1.0.4" checksum: 81afa24943880b0a213af3728a9fe0a28bd01d4840b9583d448f7823ced5b6e673628698b59d201cef50afebcbd89256e133714a174968d11b624d943e0c2c2f @@ -2517,17 +2487,16 @@ __metadata: version: 0.0.0-use.local resolution: "@stoplight/spectral-cli@workspace:packages/cli" dependencies: - "@rollup/plugin-commonjs": ^20.0.0 - "@stoplight/json": 3.17.0 + "@stoplight/json": ~3.20.1 "@stoplight/path": 1.3.2 - "@stoplight/spectral-core": ^1.5.1 - "@stoplight/spectral-parsers": ^1.0.1 + "@stoplight/spectral-core": ^1.14.1 + "@stoplight/spectral-parsers": ^1.0.2 "@stoplight/spectral-ref-resolver": 1.0.1 - "@stoplight/spectral-ruleset-bundler": ^1.0.0 - "@stoplight/spectral-ruleset-migrator": ^1.5.0 + "@stoplight/spectral-ruleset-bundler": ^1.3.2 + "@stoplight/spectral-ruleset-migrator": ^1.7.4 "@stoplight/spectral-rulesets": ">=1" - "@stoplight/spectral-runtime": ^1.1.0 - "@stoplight/types": 12.3.0 + "@stoplight/spectral-runtime": ^1.1.2 + "@stoplight/types": ^13.6.0 "@types/es-aggregate-error": ^1.0.2 "@types/xml2js": ^0.4.9 "@types/yargs": ^17.0.8 @@ -2537,7 +2506,6 @@ __metadata: eol: 0.9.1 es-aggregate-error: ^1.0.7 fast-glob: 3.2.7 - jest-when: ^3.4.2 lodash: ~4.17.21 nock: ^13.1.3 node-html-parser: ^4.1.5 @@ -2555,7 +2523,7 @@ __metadata: languageName: unknown linkType: soft -"@stoplight/spectral-core@>=1, @stoplight/spectral-core@^1.1.0, @stoplight/spectral-core@^1.5.1, @stoplight/spectral-core@^1.7.0, @stoplight/spectral-core@^1.8.0, @stoplight/spectral-core@^1.8.1, @stoplight/spectral-core@workspace:packages/core": +"@stoplight/spectral-core@>=1, @stoplight/spectral-core@^1.1.0, @stoplight/spectral-core@^1.14.1, @stoplight/spectral-core@^1.7.0, @stoplight/spectral-core@^1.8.0, @stoplight/spectral-core@^1.8.1, @stoplight/spectral-core@workspace:packages/core": version: 0.0.0-use.local resolution: "@stoplight/spectral-core@workspace:packages/core" dependencies: @@ -2622,7 +2590,7 @@ __metadata: languageName: unknown linkType: soft -"@stoplight/spectral-parsers@*, @stoplight/spectral-parsers@>=1, @stoplight/spectral-parsers@^1.0.1, @stoplight/spectral-parsers@workspace:packages/parsers": +"@stoplight/spectral-parsers@*, @stoplight/spectral-parsers@>=1, @stoplight/spectral-parsers@^1.0.2, @stoplight/spectral-parsers@workspace:packages/parsers": version: 0.0.0-use.local resolution: "@stoplight/spectral-parsers@workspace:packages/parsers" dependencies: @@ -2645,7 +2613,31 @@ __metadata: languageName: unknown linkType: soft -"@stoplight/spectral-ruleset-bundler@^1.0.0, @stoplight/spectral-ruleset-bundler@workspace:packages/ruleset-bundler": +"@stoplight/spectral-ruleset-bundler@npm:^1.3.2": + version: 1.3.2 + resolution: "@stoplight/spectral-ruleset-bundler@npm:1.3.2" + dependencies: + "@rollup/plugin-commonjs": ~22.0.2 + "@stoplight/path": 1.3.2 + "@stoplight/spectral-core": ">=1" + "@stoplight/spectral-formats": ">=1" + "@stoplight/spectral-functions": ">=1" + "@stoplight/spectral-parsers": ">=1" + "@stoplight/spectral-ref-resolver": ">=1" + "@stoplight/spectral-ruleset-migrator": ^1.7.4 + "@stoplight/spectral-rulesets": ">=1" + "@stoplight/spectral-runtime": ^1.1.0 + "@stoplight/types": ^13.6.0 + "@types/node": "*" + pony-cause: 1.1.1 + rollup: ~2.79.0 + tslib: ^2.3.1 + validate-npm-package-name: 3.0.0 + checksum: 449d30d2128df33c02d96ba90bc47d7528231ed3db0b6f598c541535d689444bd978eed460497a555a814f62b391d8bb371d2ab2e03a25c95f11d403efa219f7 + languageName: node + linkType: hard + +"@stoplight/spectral-ruleset-bundler@workspace:packages/ruleset-bundler": version: 0.0.0-use.local resolution: "@stoplight/spectral-ruleset-bundler@workspace:packages/ruleset-bundler" dependencies: @@ -2672,7 +2664,7 @@ __metadata: languageName: unknown linkType: soft -"@stoplight/spectral-ruleset-migrator@^1.5.0, @stoplight/spectral-ruleset-migrator@^1.7.4, @stoplight/spectral-ruleset-migrator@workspace:packages/ruleset-migrator": +"@stoplight/spectral-ruleset-migrator@^1.7.4, @stoplight/spectral-ruleset-migrator@workspace:packages/ruleset-migrator": version: 0.0.0-use.local resolution: "@stoplight/spectral-ruleset-migrator@workspace:packages/ruleset-migrator" dependencies: @@ -2724,7 +2716,7 @@ __metadata: languageName: unknown linkType: soft -"@stoplight/spectral-runtime@^1.0.0, @stoplight/spectral-runtime@^1.1.0, @stoplight/spectral-runtime@^1.1.1, @stoplight/spectral-runtime@workspace:packages/runtime": +"@stoplight/spectral-runtime@^1.0.0, @stoplight/spectral-runtime@^1.1.0, @stoplight/spectral-runtime@^1.1.1, @stoplight/spectral-runtime@^1.1.2, @stoplight/spectral-runtime@workspace:packages/runtime": version: 0.0.0-use.local resolution: "@stoplight/spectral-runtime@workspace:packages/runtime" dependencies: @@ -2738,16 +2730,6 @@ __metadata: languageName: unknown linkType: soft -"@stoplight/types@npm:12.3.0": - version: 12.3.0 - resolution: "@stoplight/types@npm:12.3.0" - dependencies: - "@types/json-schema": ^7.0.4 - utility-types: ^3.10.0 - checksum: 28065540d2d30743bfaa4ab09df3dc1e2a216f14962f78e27d8e53eda7f293f64eba8703be53b8d179dff403f54764e0823baa578fa85f78280d21b0ae22e773 - languageName: node - linkType: hard - "@stoplight/types@npm:^12.3.0": version: 12.5.0 resolution: "@stoplight/types@npm:12.5.0" @@ -3119,16 +3101,7 @@ __metadata: languageName: node linkType: hard -"@types/jest-when@npm:^2.7.3": - version: 2.7.4 - resolution: "@types/jest-when@npm:2.7.4" - dependencies: - "@types/jest": "*" - checksum: fea5f5c9b882ee5191ef47dfbbe71ce7935d4ede7ac12c2bf7dbceead3da066930aa492fc534f8b53ef6694f30313b5669b87cb45e36ddbece42c6ff27b01364 - languageName: node - linkType: hard - -"@types/jest@npm:*, @types/jest@npm:^28.1.6": +"@types/jest@npm:^28.1.6": version: 28.1.7 resolution: "@types/jest@npm:28.1.7" dependencies: @@ -8235,15 +8208,6 @@ __metadata: languageName: node linkType: hard -"jest-when@npm:^3.4.2": - version: 3.5.1 - resolution: "jest-when@npm:3.5.1" - peerDependencies: - jest: ">= 25" - checksum: 1efb9f497f7c846fe8b0f4125d5f449c4a4d78d5d0afa910d134b301ae4c119ea52c9465db38d2146269d42808afe8f3a4328d1d656878a9a69458ee653f6499 - languageName: node - linkType: hard - "jest-worker@npm:^28.1.3": version: 28.1.3 resolution: "jest-worker@npm:28.1.3" @@ -11573,7 +11537,6 @@ __metadata: "@swc/jest": ^0.2.21 "@types/file-entry-cache": ^5.0.2 "@types/jest": ^28.1.6 - "@types/jest-when": ^2.7.3 "@types/karma": ^6.3.3 "@types/lodash": ^4.14.176 "@types/node": ^15.12.4 @@ -11593,7 +11556,6 @@ __metadata: husky: ^7.0.4 jest: ^28.1.3 jest-mock: ^27.5.1 - jest-when: ^3.4.2 karma: ^6.4.0 karma-chrome-launcher: ^3.1.1 karma-jasmine: ^5.1.0