Skip to content

Commit

Permalink
feat(it-tests): test schematics with yarn 1
Browse files Browse the repository at this point in the history
  • Loading branch information
vscaiceanu-1a committed Mar 13, 2024
1 parent 4bcd0f1 commit f03bba0
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/it-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
packageManager: [yarn, npm]
packageManager: [yarn, npm, yarn1]
testEnvironment: [o3r-project-with-app]
runs-on: ${{ matrix.os }}
env:
Expand Down
36 changes: 20 additions & 16 deletions packages/@ama-sdk/create/src/index.it.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
getDefaultExecSyncOptions,
getPackageManager,
getYarnVersionFromRoot,
isYarn1Enforced,
packageManagerCreate,
packageManagerExec,
packageManagerInstall,
Expand All @@ -25,8 +25,9 @@ describe('Create new sdk command', () => {
setupLocalRegistry();
beforeEach(async () => {
const isYarnTest = packageManager.startsWith('yarn');
const yarnVersion = isYarnTest ? getYarnVersionFromRoot(process.cwd()) || 'latest' : undefined;
sdkFolderPath = (await prepareTestEnv(projectName, {type: 'blank', yarnVersion })).workspacePath;
const testEnv = await prepareTestEnv(projectName, { type: 'blank' });
sdkFolderPath = testEnv.workspacePath;
const yarnVersion = testEnv.packageManagerConfig.yarnVersion;
sdkPackagePath = path.join(sdkFolderPath, sdkPackageName.replace(/^@/, ''));
execAppOptions.cwd = sdkFolderPath;

Expand All @@ -35,9 +36,10 @@ describe('Create new sdk command', () => {
packageManagerInstall(execAppOptions);

// copy yarnrc config to generated SDK
mkdirSync(sdkPackagePath, {recursive: true});
cpSync(path.join(sdkFolderPath, '.yarnrc.yml'), path.join(sdkPackagePath, '.yarnrc.yml'));
cpSync(path.join(sdkFolderPath, '.yarn'), path.join(sdkPackagePath, '.yarn'), {recursive: true});
mkdirSync(sdkPackagePath, { recursive: true });
const yarnConfigFile = isYarn1Enforced() ? '.yarnrc' : '.yarnrc.yml';
cpSync(path.join(sdkFolderPath, yarnConfigFile), path.join(sdkPackagePath, yarnConfigFile));
cpSync(path.join(sdkFolderPath, '.yarn'), path.join(sdkPackagePath, '.yarn'), { recursive: true });
fs.writeFileSync(path.join(sdkPackagePath, 'yarn.lock'), '');
} else {
// copy npmrc config to generated SDK
Expand All @@ -55,39 +57,41 @@ describe('Create new sdk command', () => {
packageManagerCreate({
script: '@ama-sdk',
args: ['typescript', sdkPackageName, '--package-manager', packageManager, '--spec-path', path.join(sdkFolderPath, 'swagger-spec.yml')]
}, execAppOptions)
}, execAppOptions, !isYarn1Enforced() ? 'npm' : undefined)
).not.toThrow();

Check failure on line 61 in packages/@ama-sdk/create/src/index.it.spec.ts

View workflow job for this annotation

GitHub Actions / it-tests / it-tests (ubuntu-latest, yarn1, o3r-project-with-app)

Create new sdk command › should generate a full SDK when the specification is provided

expect(received).not.toThrow() Error name: "Error" Error message: "Command failed: yarn create @ama-sdk typescript @my-test/sdk --package-manager yarn --spec-path /home/runner/work/otter/it-tests/test-sdk/swagger-spec.yml STDERR: warning package.json: No license field warning @ama-sdk/create > @ama-sdk/schematics > sway > swagger-methods@1.0.8: This package is no longer being maintained. warning @ama-sdk/create > @ama-sdk/schematics > sway > z-schema > core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js. warning @ama-sdk/create > @ama-sdk/schematics > sway > json-schema-faker > json-schema-ref-parser@6.1.0: Please switch to @apidevtools/json-schema-ref-parser warning @ama-sdk/create > @ama-sdk/schematics > sway > json-refs > path-loader > superagent@7.1.6: Please downgrade to v7.1.5 if you need IE/ActiveXObject support OR upgrade to v8.0.0 as we no longer support IE and published an incorrect patch version (see https://github.com/visionmedia/superagent/issues/1731) error https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz: Extracting tar content of undefined failed, the file appears to be corrupt: \"ENOENT: no such file or directory, chmod '/home/runner/.cache/yarn/v6/npm-lodash-4.17.21-679591c564c3bffaae8454cf0b3df370c3d6911c-integrity/node_modules/lodash/fp/T.js'\"· OUTPUT: ,yarn create v1.22.22 [1/4] Resolving packages... [2/4] Fetching packages... info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command. ,warning package.json: No license field warning @ama-sdk/create > @ama-sdk/schematics > sway > swagger-methods@1.0.8: This package is no longer being maintained. warning @ama-sdk/create > @ama-sdk/schematics > sway > z-schema > core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js. warning @ama-sdk/create > @ama-sdk/schematics > sway > json-schema-faker > json-schema-ref-parser@6.1.0: Please switch to @apidevtools/json-schema-ref-parser warning @ama-sdk/create > @ama-sdk/schematics > sway > json-refs > path-loader > superagent@7.1.6: Please downgrade to v7.1.5 if you need IE/ActiveXObject support OR upgrade to v8.0.0 as we no longer support IE and published an incorrect patch version (see https://github.com/visionmedia/superagent/issues/1731) error https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz: Extracting tar content of undefined failed, the file appears to be corrupt: \"ENOENT: no such file or directory, chmod '/home/runner/.cache/yarn/v6/npm-lodash-4.17.21-679591c564c3bffaae8454cf0b3df370c3d6911c-integrity/node_modules/lodash/fp/T.js'\" " 106 | // Yarn doesn't log errors on stderr, so we need to get them from stdout to have them in the reports 107 | // eslint-disable-next-line @typescript-eslint/restrict-template-expressions > 108 | throw new Error(`Command failed: ${args.join(' ') }\nSTDERR:\n${err.stderr?.toString() || ''}\nOUTPUT:\n${err.output?.toString() || ''}`); | ^ 109 | } 110 | } 111 | at execCmd (packages/@o3r/test-helpers/src/utilities/package-manager.ts:108:11) at packageManagerCreate (packages/@o3r/test-helpers/src/utilities/package-manager.ts:130:10) at packages/@ama-sdk/create/src/index.it.spec.ts:57:27 at Object.<anonymous> (.yarn/cache/expect-npm-29.7.0-62e9f7979e-63f97bc51f.zip/node_modules/expect/build/toThrowMatchers.js:74:11) at Object.throwingMatcher [as toThrow] (.yarn/cache/expect-npm-29.7.0-62e9f7979e-63f97bc51f.zip/node_modules/
expect(() => packageManagerRun({script: 'build'}, { ...execAppOptions, cwd: sdkPackagePath })).not.toThrow();
expect(() => packageManagerRun({ script: 'build' }, { ...execAppOptions, cwd: sdkPackagePath })).not.toThrow();
});

test('should generate an empty SDK ready to be used', () => {
expect(() => packageManagerCreate({script: '@ama-sdk', args: ['typescript', sdkPackageName]}, execAppOptions)).not.toThrow();
expect(() => packageManagerRun({script: 'build'}, { ...execAppOptions, cwd: sdkPackagePath })).not.toThrow();
expect(() => packageManagerCreate({
script: '@ama-sdk',
args: ['typescript', sdkPackageName] }, execAppOptions, !isYarn1Enforced() ? 'npm' : undefined)).not.toThrow();

Check failure on line 68 in packages/@ama-sdk/create/src/index.it.spec.ts

View workflow job for this annotation

GitHub Actions / it-tests / it-tests (ubuntu-latest, yarn, o3r-project-with-app)

Create new sdk command › should generate an empty SDK ready to be used

expect(received).not.toThrow() Error name: "Error" Error message: "Command failed: npm create @ama-sdk typescript @my-test/sdk STDERR: \"6.6.0\" - Installing packages (npm)... npm ERR! code ETARGET npm ERR! notarget No matching version found for @ama-sdk/core@~999.0.0. npm ERR! notarget In most cases you or one of your dependencies are requesting npm ERR! notarget a package version that doesn't exist.· npm ERR! A complete log of this run can be found in: /home/runner/work/otter/otter/.cache/test-app/npm-cache/_logs/2024-03-13T12_49_51_407Z-debug-0.log ✖ Package install failed, see above. The Schematic workflow failed. See above. npm ERR! code 1 npm ERR! path /home/runner/work/otter/it-tests/test-sdk npm ERR! command failed npm ERR! command sh -c create typescript @my-test/sdk· npm ERR! A complete log of this run can be found in: /home/runner/work/otter/otter/.cache/test-app/npm-cache/_logs/2024-03-13T12_49_50_175Z-debug-0.log· OUTPUT: ,CREATE my-test/sdk/.commitlintrc.json (810 bytes) CREATE my-test/sdk/.editorconfig (208 bytes) CREATE my-test/sdk/.openapi-generator-ignore (90 bytes) CREATE my-test/sdk/.renovaterc.json (1862 bytes) CREATE my-test/sdk/.swcrc (329 bytes) CREATE my-test/sdk/.versionrc.json (110 bytes) CREATE my-test/sdk/CONTRIBUTING.md (122 bytes) CREATE my-test/sdk/jest.config.js (737 bytes) CREATE my-test/sdk/readme.md (7144 bytes) CREATE my-test/sdk/tsconfig.build.json (542 bytes) CREATE my-test/sdk/tsconfig.doc.json (354 bytes) CREATE my-test/sdk/tsconfig.json (226 bytes) CREATE my-test/sdk/typedoc.json (289 bytes) CREATE my-test/sdk/.vscode/settings.json (613 bytes) CREATE my-test/sdk/configs/tsconfig.test.json (496 bytes) CREATE my-test/sdk/src/index.ts (77 bytes) CREATE my-test/sdk/src/api/fixtures.jest.ts (123 bytes) CREATE my-test/sdk/src/api/index.ts (17 bytes) CREATE my-test/sdk/src/fixtures/jest/index.ts (41 bytes) CREATE my-test/sdk/src/fixtures/jest/package.json (353 bytes) CREATE my-test/sdk/src/helpers/index.ts (17 bytes) CREATE my-test/sdk/src/helpers/package.json (314 bytes) CREATE my-test/sdk/src/models/enums.ts (93 bytes) CREATE my-test/sdk/src/models/index.ts (128 bytes) CREATE my-test/sdk/src/models/patterns.ts (102 bytes) CREATE my-test/sdk/src/models/base/enums.ts (97 bytes) CREATE my-test/sdk/src/models/base/index.ts (17 bytes) CREATE my-test/sdk/src/models/base/patterns.ts (100 bytes) CREATE my-test/sdk/src/models/core/enums.ts (48 bytes) CREATE my-test/sdk/src/models/core/index.ts (49 bytes) CREATE my-test/sdk/src/models/core/patterns.ts (51 bytes) CREATE my-test/sdk/src/models/custom/enums.ts (50 bytes) CREATE my-test/sdk/src/models/custom/index.ts (17 bytes) CREATE my-test/sdk/src/models/custom/patterns.ts (53 bytes) CREATE my-test/sdk/src/spec/api-mock.ts (123 bytes) CREATE my-test/sdk/src/spec/index.ts (103 bytes) CREATE my-test/sdk/src/spec/operation-adapter.ts (16 bytes) CREATE my-test/sdk/src/spec/package.json (293 bytes) CREATE my-test/sdk/src/spec/mock-factory/index.ts (49 bytes) CREATE my-test/sdk/testing/tsconfig.spec.json (448 bytes) CREATE my-test/sdk/tsconfigs/tsconfig.jest.json (319 bytes) CREATE my-test/sdk/tsconfigs/tsconfig.source.json (242 bytes) CREATE my-test/sdk/tsconfigs/esm2020/tsconfig.jest.json (357 bytes) CREATE my-test/sdk/tsconfigs/esm2020/tsconfig.json (127 bytes) CREATE my-test/sdk/tsconfigs/esm2020/tsconfig.source.json (287 bytes) CREATE my-test/sdk/.eslintignore (132 bytes) CREATE my-test/sdk/.eslintrc.js (1075 bytes) CREATE my-test/sdk/.gitignore (613 bytes) CREATE my-test/sdk/openapitools.json (409 bytes) CREATE my-test/sdk/package.json (3992 bytes) , \"6.6.0\" - Installing packages (npm)... npm ERR! code ETARGET npm ERR! notarget No matching version found for @ama-sdk/core@~999.0.0. npm ERR! notarget In most cases you or one of your dependencies are requesting npm ERR! notarget a package version that doesn't exist.· npm ERR! A complete log of this run can be found in: /home/runner/work/otter/otter/.cache/test-app/npm-cache/_logs/2024-03-13T12_49_51_407Z-debug-0.log ✖ Package install failed, see above. The Schematic workflow failed. Se

Check failure on line 68 in packages/@ama-sdk/create/src/index.it.spec.ts

View workflow job for this annotation

GitHub Actions / it-tests / it-tests (ubuntu-latest, yarn1, o3r-project-with-app)

Create new sdk command › should generate an empty SDK ready to be used

expect(received).not.toThrow() Error name: "Error" Error message: "Command failed: yarn create @ama-sdk typescript @my-test/sdk STDERR: warning package.json: No license field warning @ama-sdk/create > @ama-sdk/schematics > sway > swagger-methods@1.0.8: This package is no longer being maintained. warning @ama-sdk/create > @ama-sdk/schematics > sway > z-schema > core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js. warning @ama-sdk/create > @ama-sdk/schematics > sway > json-schema-faker > json-schema-ref-parser@6.1.0: Please switch to @apidevtools/json-schema-ref-parser warning @ama-sdk/create > @ama-sdk/schematics > sway > json-refs > path-loader > superagent@7.1.6: Please downgrade to v7.1.5 if you need IE/ActiveXObject support OR upgrade to v8.0.0 as we no longer support IE and published an incorrect patch version (see https://github.com/visionmedia/superagent/issues/1731) warning \"@ama-sdk/create > @ama-sdk/core@999.0.0\" has unmet peer dependency \"chokidar@^3.5.2\". warning \"@ama-sdk/create > @ama-sdk/core@999.0.0\" has unmet peer dependency \"globby@^11.1.0\". warning \"@ama-sdk/create > @o3r/schematics@999.0.0\" has unmet peer dependency \"type-fest@^4.10.2\". Error: Unknown argument: @my-test/sdk error Command failed. Exit code: 1 Command: /usr/local/bin/create Arguments: typescript @my-test/sdk Directory: /home/runner/work/otter/it-tests/test-sdk Output:·· OUTPUT: ,yarn create v1.22.22 [1/4] Resolving packages... [2/4] Fetching packages... [3/4] Linking dependencies... [4/4] Building fresh packages... success Installed \"@ama-sdk/create@999.0.0\" with binaries: - create·· &BPPPB & &BPGB& #Y7!!!!!J# &#BGP5YYJJ??????????JJYY5PG#& P7!!!!7JG #!!!!!!!!!7Y5J?7!!!!!!!!!!!!!!!!!!!!!!!!!!!7?JPB5!!!!!!!!!G #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!~5 BJ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!?5 &?!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!7B G?!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!75& #J!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!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!!!!!!!!!!!!!!!!!!!!!!7JG& #PYJ?7!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!77?YPB& &BPPB &Y7JYYYJ7!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!7?YYYJ??B #?!!!!?P B7!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Check failure on line 68 in packages/@ama-sdk/create/src/index.it.spec.ts

View workflow job for this annotation

GitHub Actions / it-tests / it-tests (windows-latest, yarn, o3r-project-with-app)

Create new sdk command › should generate an empty SDK ready to be used

expect(received).not.toThrow() Error name: "Error" Error message: "Command failed: npm create @ama-sdk typescript @my-test/sdk STDERR: \"6.6.0\" - Installing packages (npm)... npm ERR! code ETARGET npm ERR! notarget No matching version found for @ama-sdk/core@~999.0.0. npm ERR! notarget In most cases you or one of your dependencies are requesting npm ERR! notarget a package version that doesn't exist.· npm ERR! A complete log of this run can be found in: D:\\a\\otter\\otter\\.cache\\test-app\\npm-cache\\_logs\\2024-03-13T12_54_34_123Z-debug-0.log ✖ Package install failed, see above. The Schematic workflow failed. See above. npm ERR! code 1 npm ERR! path D:\\a\\otter\\it-tests\\test-sdk npm ERR! command failed npm ERR! command C:\\Windows\\system32\\cmd.exe /d /s /c create typescript @my-test/sdk· npm ERR! A complete log of this run can be found in: D:\\a\\otter\\otter\\.cache\\test-app\\npm-cache\\_logs\\2024-03-13T12_54_31_793Z-debug-0.log· OUTPUT: ,CREATE my-test/sdk/.commitlintrc.json (847 bytes) CREATE my-test/sdk/.editorconfig (221 bytes) CREATE my-test/sdk/.openapi-generator-ignore (91 bytes) CREATE my-test/sdk/.renovaterc.json (1955 bytes) CREATE my-test/sdk/.swcrc (345 bytes) CREATE my-test/sdk/.versionrc.json (119 bytes) CREATE my-test/sdk/CONTRIBUTING.md (126 bytes) CREATE my-test/sdk/jest.config.js (763 bytes) CREATE my-test/sdk/readme.md (7363 bytes) CREATE my-test/sdk/tsconfig.build.json (568 bytes) CREATE my-test/sdk/tsconfig.doc.json (374 bytes) CREATE my-test/sdk/tsconfig.json (240 bytes) CREATE my-test/sdk/typedoc.json (301 bytes) CREATE my-test/sdk/.vscode/settings.json (636 bytes) CREATE my-test/sdk/configs/tsconfig.test.json (517 bytes) CREATE my-test/sdk/src/index.ts (81 bytes) CREATE my-test/sdk/src/api/fixtures.jest.ts (125 bytes) CREATE my-test/sdk/src/api/index.ts (18 bytes) CREATE my-test/sdk/src/fixtures/jest/index.ts (42 bytes) CREATE my-test/sdk/src/fixtures/jest/package.json (363 bytes) CREATE my-test/sdk/src/helpers/index.ts (18 bytes) CREATE my-test/sdk/src/helpers/package.json (324 bytes) CREATE my-test/sdk/src/models/enums.ts (97 bytes) CREATE my-test/sdk/src/models/index.ts (134 bytes) CREATE my-test/sdk/src/models/patterns.ts (106 bytes) CREATE my-test/sdk/src/models/base/enums.ts (99 bytes) CREATE my-test/sdk/src/models/base/index.ts (18 bytes) CREATE my-test/sdk/src/models/base/patterns.ts (102 bytes) CREATE my-test/sdk/src/models/core/enums.ts (50 bytes) CREATE my-test/sdk/src/models/core/index.ts (51 bytes) CREATE my-test/sdk/src/models/core/patterns.ts (53 bytes) CREATE my-test/sdk/src/models/custom/enums.ts (52 bytes) CREATE my-test/sdk/src/models/custom/index.ts (18 bytes) CREATE my-test/sdk/src/models/custom/patterns.ts (55 bytes) CREATE my-test/sdk/src/spec/api-mock.ts (125 bytes) CREATE my-test/sdk/src/spec/index.ts (106 bytes) CREATE my-test/sdk/src/spec/operation-adapter.ts (17 bytes) CREATE my-test/sdk/src/spec/package.json (303 bytes) CREATE my-test/sdk/src/spec/mock-factory/index.ts (51 bytes) CREATE my-test/sdk/testing/tsconfig.spec.json (471 bytes) CREATE my-test/sdk/tsconfigs/tsconfig.jest.json (339 bytes) CREATE my-test/sdk/tsconfigs/tsconfig.source.json (255 bytes) CREATE my-test/sdk/tsconfigs/esm2020/tsconfig.jest.json (373 bytes) CREATE my-test/sdk/tsconfigs/esm2020/tsconfig.json (137 bytes) CREATE my-test/sdk/tsconfigs/esm2020/tsconfig.source.json (298 bytes) CREATE my-test/sdk/.eslintignore (141 bytes) CREATE my-test/sdk/.eslintrc.js (1125 bytes) CREATE my-test/sdk/.gitignore (658 bytes) CREATE my-test/sdk/openapitools.json (424 bytes) CREATE my-test/sdk/package.json (4111 bytes) , \"6.6.0\" - Installing packages (npm)... npm ERR! code ETARGET npm ERR! notarget No matching version found for @ama-sdk/core@~999.0.0. npm ERR! notarget In most cases you or one of your dependencies are requesting npm ERR! notarget a package version that doesn't exist.· npm ERR! A complete log of this run can be found in: D:\\a\\otter\\otter\\.cache\\test-app\\npm-cache\\_logs\\2024-03-13T12_54_34_123Z-debug-0.log ✖ Package install failed, see above. The Schematic workflow
expect(() => packageManagerRun({ script: 'build' }, { ...execAppOptions, cwd: sdkPackagePath })).not.toThrow();
expect(() =>
packageManagerExec({
script: 'schematics',
args: ['@ama-sdk/schematics:typescript-core', '--spec-path', path.join(path.relative(sdkPackagePath, sdkFolderPath), 'swagger-spec.yml')]
}, { ...execAppOptions, cwd: sdkPackagePath })
).not.toThrow();
expect(() => packageManagerRun({script: 'build'}, { ...execAppOptions, cwd: sdkPackagePath })).not.toThrow();
expect(() => packageManagerRun({script: 'doc:generate'}, { ...execAppOptions, cwd: sdkPackagePath })).not.toThrow();
expect(() => packageManagerRun({ script: 'build' }, { ...execAppOptions, cwd: sdkPackagePath })).not.toThrow();
expect(() => packageManagerRun({ script: 'doc:generate' }, { ...execAppOptions, cwd: sdkPackagePath })).not.toThrow();
});

test('should fail when there is an error', () => {
expect(() =>
packageManagerCreate({
script: '@ama-sdk',
args: ['typescript', sdkPackageName, '--package-manager', packageManager, '--spec-path','./missing-file.yml']
}, execAppOptions)
args: ['typescript', sdkPackageName, '--package-manager', packageManager, '--spec-path', './missing-file.yml']
}, execAppOptions, !isYarn1Enforced() ? 'npm' : undefined)
).toThrow();
});

test('should use pinned versions when --exact-o3r-version is used', () => {
expect(() =>
packageManagerCreate({
script: `@ama-sdk@${o3rVersion}`,
script: `@ama-sdk`,
args: ['typescript', sdkPackageName, '--exact-o3r-version', '--package-manager', packageManager, '--spec-path', path.join(sdkFolderPath, 'swagger-spec.yml')]
}, execAppOptions)
}, execAppOptions, !isYarn1Enforced() ? 'npm' : undefined)
).not.toThrow();

Check failure on line 95 in packages/@ama-sdk/create/src/index.it.spec.ts

View workflow job for this annotation

GitHub Actions / it-tests / it-tests (ubuntu-latest, yarn1, o3r-project-with-app)

Create new sdk command › should use pinned versions when --exact-o3r-version is used

expect(received).not.toThrow() Error name: "Error" Error message: "Command failed: yarn create @ama-sdk typescript @my-test/sdk --exact-o3r-version --package-manager yarn --spec-path /home/runner/work/otter/it-tests/test-sdk/swagger-spec.yml STDERR: warning package.json: No license field warning \"@ama-sdk/create > @ama-sdk/core@999.0.0\" has unmet peer dependency \"chokidar@^3.5.2\". warning \"@ama-sdk/create > @ama-sdk/core@999.0.0\" has unmet peer dependency \"globby@^11.1.0\". warning \"@ama-sdk/create > @o3r/schematics@999.0.0\" has unmet peer dependency \"type-fest@^4.10.2\". Error: Unknown argument: @my-test/sdk error Command failed. Exit code: 1 Command: /usr/local/bin/create Arguments: typescript @my-test/sdk --exact-o3r-version --package-manager yarn --spec-path /home/runner/work/otter/it-tests/test-sdk/swagger-spec.yml Directory: /home/runner/work/otter/it-tests/test-sdk Output:·· OUTPUT: ,yarn create v1.22.22 [1/4] Resolving packages... [2/4] Fetching packages... [3/4] Linking dependencies... [4/4] Building fresh packages... success Installed \"@ama-sdk/create@999.0.0\" with binaries: - create·· &BPPPB & &BPGB& #Y7!!!!!J# &#BGP5YYJJ??????????JJYY5PG#& P7!!!!7JG #!!!!!!!!!7Y5J?7!!!!!!!!!!!!!!!!!!!!!!!!!!!7?JPB5!!!!!!!!!G #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!~5 BJ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!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7!!!!!!!!!!P#7!!!!!!!!!!!!!!!!!7YPY!!!!!!B P!!!!!!!5#!!!!!!!7YGG5?7!!!!!!!!!!!!!!G#7!!!!!!!!!!P&7!!!!!!!!!!!!!!?YPBP?
expect(() => packageManagerRun({script: 'build'}, { ...execAppOptions, cwd: sdkPackagePath })).not.toThrow();
const packageJson = JSON.parse(fs.readFileSync(path.join(sdkPackagePath, 'package.json'), 'utf-8'));
Expand Down
5 changes: 3 additions & 2 deletions packages/@o3r/create/src/index.it.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
getDefaultExecSyncOptions,
getPackageManager,
isYarn1Enforced,
type PackageManagerConfig,
packageManagerCreate,
packageManagerExec,
Expand Down Expand Up @@ -40,7 +41,7 @@ describe('Create new otter project command', () => {
await fs.mkdir(inAppPath, { recursive: true });
setPackagerManagerConfig(packageManagerConfig, execInAppOptions);

expect(() => packageManagerCreate({ script: `@o3r@${o3rVersion}`, args: [workspaceProjectName, ...createOptions] }, execWorkspaceOptions, 'npm')).not.toThrow();
expect(() => packageManagerCreate({ script: `@o3r`, args: [workspaceProjectName, ...createOptions] }, execWorkspaceOptions, !isYarn1Enforced() ? 'npm' : undefined)).not.toThrow();
expect(existsSync(path.join(inAppPath, 'angular.json'))).toBe(true);
expect(existsSync(path.join(inAppPath, 'package.json'))).toBe(true);
expect(() => packageManagerInstall(execInAppOptions)).not.toThrow();
Expand All @@ -62,7 +63,7 @@ describe('Create new otter project command', () => {
await fs.mkdir(inAppPath, { recursive: true });
setPackagerManagerConfig(packageManagerConfig, execInAppOptions);

expect(() => packageManagerCreate({ script: `@o3r@${o3rVersion}`, args: [workspaceProjectName, ...createOptions] }, execWorkspaceOptions, 'npm')).not.toThrow();
expect(() => packageManagerCreate({ script: `@o3r`, args: [workspaceProjectName, ...createOptions] }, execWorkspaceOptions, !isYarn1Enforced() ? 'npm' : undefined)).not.toThrow();
expect(existsSync(path.join(inAppPath, 'angular.json'))).toBe(true);
expect(existsSync(path.join(inAppPath, 'package.json'))).toBe(true);
expect(() => packageManagerInstall(execInAppOptions)).not.toThrow();
Expand Down
6 changes: 3 additions & 3 deletions packages/@o3r/create/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,14 @@ const prepareWorkspace = (relativeDirectory = '.', projectPackageManager = 'npm'
cwd
}));
};

const isYarn1 = packageManager === 'yarn' && argv['yarn-version']?.split('.')[0] === '1';
const addOtterFramework = (relativeDirectory = '.', projectPackageManager = 'npm') => {
const cwd = resolve(process.cwd(), relativeDirectory);
const runner = process.platform === 'win32' ? `${projectPackageManager}.cmd` : projectPackageManager;
const options = schematicsCliOptions
.flat();

exitProcessIfErrorInSpawnSync(3, spawnSync(runner, ['exec', 'ng', 'add', `@o3r/core@${exactO3rVersion ? '' : '~'}${version}`, ...(projectPackageManager === 'npm' ? ['--'] : []), ...options], {
exitProcessIfErrorInSpawnSync(3, spawnSync(runner, [isYarn1 ? 'run' : 'exec', 'ng', 'add', `@o3r/core@${exactO3rVersion ? '' : '~'}${version}`,
...((projectPackageManager === 'npm' || isYarn1) ? ['--'] : []), ...options], {
stdio: 'inherit',
cwd,
env: exactO3rVersion && projectPackageManager === 'npm' ? {
Expand Down
6 changes: 3 additions & 3 deletions packages/@o3r/telemetry/src/environment/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ import { execSync } from 'node:child_process';
import * as path from 'node:path';

/** Support NPM package managers */
type SupportedPackageManagers = 'npm' | 'yarn';
type SupportedPackageManagers = 'npm' | 'yarn' | 'yarn1';

/**
* Determine if the given packager manager is supported
* @param name Name of the package manager
*/
function isSupportedPackageManager(name?: any): name is SupportedPackageManagers {
return name === 'yarn' || name === 'npm';
return ['yarn', 'yarn1', 'npm'].includes(name);
}

/**
* Get package manager used
*/
function getPackageManager() {
if (isSupportedPackageManager(process.env?.ENFORCED_PACKAGE_MANAGER)) {
return process.env.ENFORCED_PACKAGE_MANAGER;
return (process.env.ENFORCED_PACKAGE_MANAGE === 'npm') ? 'npm' : 'yarn';
}
return (process.env?.npm_execpath?.includes('yarn') && 'yarn') || 'npm';
}
Expand Down
10 changes: 5 additions & 5 deletions packages/@o3r/test-helpers/src/prepare-test-env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statS
import * as path from 'node:path';
import type { PackageJson } from 'type-fest';
import { createTestEnvironmentBlank } from './test-environments/create-test-environment-blank';
import { createWithLock, getPackageManager, type Logger, packageManagerInstall, setPackagerManagerConfig, setupGit } from './utilities/index';
import { createWithLock, getVersionedPackageManager, isYarn1Enforced, type Logger, packageManagerInstall, setPackagerManagerConfig, setupGit } from './utilities/index';
import { createTestEnvironmentOtterProjectWithApp } from './test-environments/create-test-environment-otter-project';
import { O3rCliError } from '@o3r/schematics';

Expand All @@ -15,8 +15,7 @@ export type PrepareTestEnvType = 'blank' | 'o3r-project-with-app';

/**
* Retrieve the version used by yarn and setup at root level
* @param rootFolderPath: path to the folder where to take the configuration from
* @param rootFolderPath
* @param rootFolderPath path to the folder where to take the configuration from
*/
export function getYarnVersionFromRoot(rootFolderPath: string) {
const o3rPackageJson: PackageJson & { generatorDependencies?: Record<string, string> } =
Expand Down Expand Up @@ -49,7 +48,8 @@ export async function prepareTestEnv(folderName: string, options?: PrepareTestEn
const cacheFolderPath = path.resolve(globalFolderPath, 'cache');

JSON.parse(readFileSync(path.join(rootFolderPath, 'packages', '@o3r', 'core', 'package.json')).toString());
const yarnVersion: string = yarnVersionParam || getYarnVersionFromRoot(rootFolderPath);
const yarn1Version = execSync('npm view yarn version', { encoding: 'utf8' }).trim();
const yarnVersion: string = yarnVersionParam || (isYarn1Enforced() && yarn1Version) || getYarnVersionFromRoot(rootFolderPath);
const execAppOptions: ExecSyncOptions = {
cwd: workspacePath,
stdio: 'inherit',
Expand Down Expand Up @@ -108,7 +108,7 @@ export async function prepareTestEnv(folderName: string, options?: PrepareTestEn
let isInWorkspace = false;
let untouchedProject: undefined | string;
let untouchedProjectPath: undefined | string;
const appDirectory = `${type}-${getPackageManager()}`;
const appDirectory = `${type}-${getVersionedPackageManager()}`;
switch (type) {
case 'blank': {
await createTestEnvironmentBlank({
Expand Down
68 changes: 57 additions & 11 deletions packages/@o3r/test-helpers/src/utilities/package-manager.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { execFileSync, ExecSyncOptions } from 'node:child_process';
import { existsSync, rmSync } from 'node:fs';
import { appendFileSync, existsSync, readFileSync, rmSync } from 'node:fs';
import { join } from 'node:path';
import { performance } from 'node:perf_hooks';

Expand Down Expand Up @@ -30,6 +30,15 @@ const PACKAGE_MANAGERS_CMD = {
run: ['yarn', 'run'],
workspaceExec: ['yarn', 'workspace'],
workspaceRun: ['yarn', 'workspace']
},
yarn1: {
add: ['yarn', 'add'],
create: ['yarn', 'create'],
exec: ['yarn', 'run'],
install: ['yarn', 'install'],
run: ['yarn', 'run'],
workspaceExec: ['yarn', 'workspace'],
workspaceRun: ['yarn', 'workspace']
}
};

Expand All @@ -41,14 +50,30 @@ type CommandArguments = {
};

/**
* Get the package manager to be used for the tests by reading environment variable ENFORCED_PACKAGE_MANAGER
* Get the package manager with its version to be used for the tests by reading environment variable ENFORCED_PACKAGE_MANAGER
* 'yarn', 'yarn1', 'npm'
*/
export function getPackageManager() {
export function getVersionedPackageManager() {
return (process.env.ENFORCED_PACKAGE_MANAGER && process.env.ENFORCED_PACKAGE_MANAGER in PACKAGE_MANAGERS_CMD) ?
process.env.ENFORCED_PACKAGE_MANAGER as keyof typeof PACKAGE_MANAGERS_CMD :
'yarn';
}

/**
* Get the package manager to be used for the tests based on env ENFORCED_PACKAGE_MANAGER
* 'yarn', 'npm'
*/
export function getPackageManager() {
return getVersionedPackageManager() === 'npm' ? 'npm' : 'yarn';
}

/**
* is Yarn 1 enforced
*/
export function isYarn1Enforced() {
return process.env.ENFORCED_PACKAGE_MANAGER === 'yarn1';
}

/**
* Need to add additional dashes when running command like exec on npm
* Convert `npm exec test --param` to `npm exec test -- --param`
Expand Down Expand Up @@ -90,7 +115,7 @@ function execCmd(args: string[], execOptions: ExecSyncOptions) {
* @param options
*/
export function packageManagerAdd(packages: string, options: ExecSyncOptions) {
return execCmd([...PACKAGE_MANAGERS_CMD[getPackageManager()].add, packages], options);
return execCmd([...PACKAGE_MANAGERS_CMD[getVersionedPackageManager()].add, packages], options);
}

/**
Expand All @@ -101,7 +126,7 @@ export function packageManagerAdd(packages: string, options: ExecSyncOptions) {
*/
export function packageManagerCreate(command: CommandArguments, options: ExecSyncOptions, packageManagerOverride?: keyof typeof PACKAGE_MANAGERS_CMD) {
const { script, args } = command;
const packageManager = packageManagerOverride || getPackageManager();
const packageManager = packageManagerOverride || getVersionedPackageManager();
return execCmd([...PACKAGE_MANAGERS_CMD[packageManager].create, script, ...addDashesForNpmCommand(args, packageManager)], options);
}

Expand All @@ -112,7 +137,7 @@ export function packageManagerCreate(command: CommandArguments, options: ExecSyn
*/
export function packageManagerExec(command: CommandArguments, options: ExecSyncOptions) {
const { script, args } = command;
return execCmd([...PACKAGE_MANAGERS_CMD[getPackageManager()].exec, script, ...addDashesForNpmCommand(args)], options);
return execCmd([...PACKAGE_MANAGERS_CMD[getVersionedPackageManager()].exec, script, ...addDashesForNpmCommand(args)], options);
}

/**
Expand All @@ -123,7 +148,7 @@ export function packageManagerExec(command: CommandArguments, options: ExecSyncO
*/
export function packageManagerWorkspaceExec(workspaceProjectName: string, command: CommandArguments, options: ExecSyncOptions) {
const { script, args } = command;
return execCmd([...PACKAGE_MANAGERS_CMD[getPackageManager()].workspaceExec, workspaceProjectName, script, ...addDashesForNpmCommand(args)], options);
return execCmd([...PACKAGE_MANAGERS_CMD[getVersionedPackageManager()].workspaceExec, workspaceProjectName, script, ...addDashesForNpmCommand(args)], options);
}

/**
Expand All @@ -142,7 +167,7 @@ export function packageManagerExecOnProject(projectName: string, isInWorkspace:
* @param options
*/
export function packageManagerInstall(options: ExecSyncOptions) {
return execCmd(PACKAGE_MANAGERS_CMD[getPackageManager()].install, options);
return execCmd(PACKAGE_MANAGERS_CMD[getVersionedPackageManager()].install, options);
}

/**
Expand All @@ -152,7 +177,7 @@ export function packageManagerInstall(options: ExecSyncOptions) {
*/
export function packageManagerRun(command: CommandArguments, options: ExecSyncOptions) {
const { script, args } = command;
return execCmd([...PACKAGE_MANAGERS_CMD[getPackageManager()].run, script, ...addDashesForNpmCommand(args)], options);
return execCmd([...PACKAGE_MANAGERS_CMD[getVersionedPackageManager()].run, script, ...addDashesForNpmCommand(args)], options);
}

/**
Expand All @@ -163,7 +188,7 @@ export function packageManagerRun(command: CommandArguments, options: ExecSyncOp
*/
export function packageManagerWorkspaceRun(workspaceProjectName: string, command: CommandArguments, options: ExecSyncOptions) {
const { script, args } = command;
return execCmd([...PACKAGE_MANAGERS_CMD[getPackageManager()].workspaceRun, workspaceProjectName, script, ...addDashesForNpmCommand(args)], options);
return execCmd([...PACKAGE_MANAGERS_CMD[getVersionedPackageManager()].workspaceRun, workspaceProjectName, script, ...addDashesForNpmCommand(args)], options);
}

/**
Expand Down Expand Up @@ -209,7 +234,7 @@ export function setPackagerManagerConfig(options: PackageManagerConfig, execAppO

const packageJsonPath = join(execOptions.cwd as string, 'package.json');
const shouldCleanPackageJson = !existsSync(packageJsonPath);
switch (getPackageManager()) {
switch (getVersionedPackageManager()) {
case 'yarn': {
// Set yarn version
if (options.yarnVersion) {
Expand All @@ -231,6 +256,27 @@ export function setPackagerManagerConfig(options: PackageManagerConfig, execAppO
execFileSync('yarn', ['config', 'set', 'unsafeHttpWhitelist', '127.0.0.1'], execOptions);
break;
}
case 'yarn1': {
if (options.yarnVersion) {
execFileSync('yarn', ['set', 'version', options.yarnVersion], execOptions);
execFileSync('yarn', ['config', 'set', '@ama-sdk:registry', options.registry], execOptions);
execFileSync('yarn', ['config', 'set', '@ama-terasu:registry', options.registry], execOptions);
execFileSync('yarn', ['config', 'set', '@o3r:registry', options.registry], execOptions);
execFileSync('yarn', ['config', 'set', 'unsafeHttpWhitelist', '127.0.0.1'], execOptions);
}
const ignoreRootCheckConfig = '--add.ignore-workspace-root-check';
const yarnRcPath = join(execOptions.cwd as string, '.yarnrc');

if (existsSync(yarnRcPath)) {
const content = readFileSync(yarnRcPath, { encoding: 'utf8' });
if (!content.includes(ignoreRootCheckConfig)) {
appendFileSync(yarnRcPath, `\n${ignoreRootCheckConfig} true`);
}
} else {
console.warn(`File not found at '${yarnRcPath}'.`);
}
break;
}
}

execFileSync('npm', ['config', 'set', 'audit=false', '-L=project'], execOptions);
Expand Down

0 comments on commit f03bba0

Please sign in to comment.