diff --git a/jest.config.js b/jest.config.js index 117724ba..d5038d9c 100644 --- a/jest.config.js +++ b/jest.config.js @@ -6,6 +6,7 @@ const config = { testEnvironment: 'node', reporters: ['default', 'jest-junit'], setupFilesAfterEnv: ['./jest.setup.js'], + testPathIgnorePatterns: ['/node_modules/'], }; module.exports = config; diff --git a/package.json b/package.json index 31bf2ade..7c2e1f7b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@adobe/aio-cli-plugin-api-mesh", - "version": "5.7.0", + "version": "5.7.1-beta.0", "description": "Adobe I/O CLI plugin to develop and manage API mesh sources", "keywords": [ "oclif-plugin" @@ -34,6 +34,7 @@ "postpack": "rm -f oclif.manifest.json", "test": "jest", "test:ci": "jest --ci", + "test:integration": "jest --testPathPattern=\\.integration\\.test\\.js", "unit-tests": "jest --ci", "version": "oclif-dev readme && git add README.md" }, @@ -51,7 +52,7 @@ "@escape.tech/graphql-armor": "3.2.0", "@graphql-mesh/cli": "0.82.30", "@graphql-mesh/graphql": "0.34.13", - "@graphql-mesh/http": "^0.96.9", + "@graphql-mesh/http": "0.3.26", "@graphql-mesh/json-schema": "0.35.38", "@graphql-mesh/openapi": "0.33.39", "@graphql-mesh/plugin-http-details-extensions": "^0.103.4", @@ -129,7 +130,8 @@ "stdout-stderr": "^0.1.9" }, "overrides": { - "plain-crypto-js": "./_EXCLUDE_UNSAFE_DEPENDENCIES_/plain-crypto-js" + "plain-crypto-js": "./_EXCLUDE_UNSAFE_DEPENDENCIES_/plain-crypto-js", + "@graphql-mesh/utils": "0.43.20" }, "engines": { "node": "^16.13 || >=18.0.0", diff --git a/src/commands/api-mesh/__tests__/init.integration.test.js b/src/commands/api-mesh/__tests__/init.integration.test.js new file mode 100644 index 00000000..38d24cf7 --- /dev/null +++ b/src/commands/api-mesh/__tests__/init.integration.test.js @@ -0,0 +1,50 @@ +/* +Copyright 2021 Adobe. All rights reserved. +This file is licensed to you under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. You may obtain a copy +of the License at http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed under +the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +OF ANY KIND, either express or implied. See the License for the specific language +governing permissions and limitations under the License. +*/ + +const { execSync } = require('child_process'); +const fs = require('fs'); +const path = require('path'); +const os = require('os'); + +jest.setTimeout(120000); + +describe('init template dependency resolution', () => { + let tmpDir; + + beforeEach(() => { + tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'mesh-init-')); + fs.copyFileSync( + path.resolve(__dirname, '../../../templates/package.json'), + path.join(tmpDir, 'package.json'), + ); + }); + + afterEach(() => { + fs.rmSync(tmpDir, { recursive: true, force: true }); + }); + + test('template package.json resolves without ERESOLVE errors', () => { + try { + execSync('npm install --dry-run --json', { + cwd: tmpDir, + encoding: 'utf8', + stdio: ['pipe', 'pipe', 'pipe'], + }); + } catch (error) { + const stderr = error.stderr || ''; + if (stderr.includes('ERESOLVE')) { + throw new Error(`Template package.json has dependency conflicts:\n${stderr}`); + } + throw error; + } + }); +}); diff --git a/src/templates/package.json b/src/templates/package.json index 451171f1..bb874dda 100644 --- a/src/templates/package.json +++ b/src/templates/package.json @@ -24,7 +24,6 @@ "@graphql-mesh/transform-type-merging": "0.5.20", "@graphql-mesh/types": "0.91.12", "@graphql-mesh/soap": "0.14.25", - "@graphql-mesh/http": "^0.96.9", "graphql": "^16.6.0", "@adobe/plugin-hooks": "0.4.0", "@adobe/plugin-on-fetch": "0.1.1", @@ -35,6 +34,9 @@ "fastify": "^4.10.2", "graphql-yoga": "3.1.1" }, + "overrides": { + "@graphql-mesh/utils": "0.43.20" + }, "engines": { "node": ">=18.0.0" },