From 59a578294972242812a14780c3d61c0cac370227 Mon Sep 17 00:00:00 2001 From: nicolatl Date: Tue, 29 Nov 2022 21:04:29 -0500 Subject: [PATCH 1/3] fix(unittests): make unittests pass on Windows per issue #538 fix timeout and macOS-style path assertion blocking test 13 fix cli tests with path.join refactor aws-infrastructure fix to use path.join for consistency fix to make script file path compatible with windows sep fix azure infra test for windows refactor env var set to cross env to work on all platforms refactor env var set to cross-env for all cases --- common/config/rush/pnpm-lock.yaml | 128 +++++++++--------- docs/chapters/02_getting-started.md | 2 +- .../06_testing-booster-applications.md | 2 +- .../cli/test/commands/new/command.test.ts | 3 +- packages/cli/test/commands/new/entity.test.ts | 3 +- .../test/commands/new/event-handler.test.ts | 3 +- packages/cli/test/commands/new/event.test.ts | 3 +- .../cli/test/commands/new/project.test.ts | 69 +++++----- .../cli/test/commands/new/read-model.test.ts | 5 +- .../commands/new/scheduled-command.test.ts | 3 +- packages/cli/test/commands/new/type.test.ts | 3 +- packages/cli/test/services/generator.test.ts | 14 +- .../test/services/project-initializer.test.ts | 37 ++--- .../fixtures/cart-demo/package.json | 2 +- .../package.json | 2 +- .../test/infrastructure/stack-tools.test.ts | 3 +- .../functions/event-handler-functions.test.ts | 5 +- .../functions/graphql-functions.test.ts | 3 +- .../functions/schedules-functions.test.ts | 3 +- .../package.json | 3 +- .../framework-provider-local/package.json | 3 +- 21 files changed, 156 insertions(+), 143 deletions(-) diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 16bb62a97..680d1ef8e 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -8,7 +8,7 @@ importers: ../../packages/application-tester: specifiers: '@boostercloud/eslint-config': workspace:^1.0.0 - '@boostercloud/framework-types': workspace:^1.3.1 + '@boostercloud/framework-types': workspace:^1.3.2 '@effect-ts/core': ^0.60.4 '@types/jsonwebtoken': ^8.5.8 '@types/node': 16.11.7 @@ -78,10 +78,10 @@ importers: ../../packages/cli: specifiers: - '@boostercloud/application-tester': workspace:^1.3.1 + '@boostercloud/application-tester': workspace:^1.3.2 '@boostercloud/eslint-config': workspace:^1.0.0 - '@boostercloud/framework-core': workspace:^1.3.1 - '@boostercloud/framework-types': workspace:^1.3.1 + '@boostercloud/framework-core': workspace:^1.3.2 + '@boostercloud/framework-types': workspace:^1.3.2 '@effect-ts/core': ^0.60.4 '@oclif/command': ^1.8 '@oclif/config': ^1.18 @@ -198,7 +198,7 @@ importers: ../../packages/framework-common-helpers: specifiers: '@boostercloud/eslint-config': workspace:^1.0.0 - '@boostercloud/framework-types': workspace:^1.3.1 + '@boostercloud/framework-types': workspace:^1.3.2 '@effect-ts/core': ^0.60.4 '@types/chai': 4.2.18 '@types/chai-as-promised': 7.1.4 @@ -267,9 +267,9 @@ importers: ../../packages/framework-core: specifiers: '@boostercloud/eslint-config': workspace:^1.0.0 - '@boostercloud/framework-common-helpers': workspace:^1.3.1 - '@boostercloud/framework-types': workspace:^1.3.1 - '@boostercloud/metadata-booster': workspace:^1.3.1 + '@boostercloud/framework-common-helpers': workspace:^1.3.2 + '@boostercloud/framework-types': workspace:^1.3.2 + '@boostercloud/metadata-booster': workspace:^1.3.2 '@effect-ts/core': ^0.60.4 '@types/chai': 4.2.18 '@types/chai-as-promised': 7.1.4 @@ -365,21 +365,21 @@ importers: ../../packages/framework-integration-tests: specifiers: - '@boostercloud/application-tester': workspace:^1.3.1 - '@boostercloud/cli': workspace:^1.3.1 + '@boostercloud/application-tester': workspace:^1.3.2 + '@boostercloud/cli': workspace:^1.3.2 '@boostercloud/eslint-config': workspace:^1.0.0 - '@boostercloud/framework-common-helpers': workspace:^1.3.1 - '@boostercloud/framework-core': workspace:^1.3.1 - '@boostercloud/framework-provider-aws': workspace:^1.3.1 - '@boostercloud/framework-provider-aws-infrastructure': workspace:^1.3.1 - '@boostercloud/framework-provider-azure': workspace:^1.3.1 - '@boostercloud/framework-provider-azure-infrastructure': workspace:^1.3.1 - '@boostercloud/framework-provider-kubernetes': workspace:^1.3.1 - '@boostercloud/framework-provider-kubernetes-infrastructure': workspace:^1.3.1 - '@boostercloud/framework-provider-local': workspace:^1.3.1 - '@boostercloud/framework-provider-local-infrastructure': workspace:^1.3.1 - '@boostercloud/framework-types': workspace:^1.3.1 - '@boostercloud/metadata-booster': workspace:^1.3.1 + '@boostercloud/framework-common-helpers': workspace:^1.3.2 + '@boostercloud/framework-core': workspace:^1.3.2 + '@boostercloud/framework-provider-aws': workspace:^1.3.2 + '@boostercloud/framework-provider-aws-infrastructure': workspace:^1.3.2 + '@boostercloud/framework-provider-azure': workspace:^1.3.2 + '@boostercloud/framework-provider-azure-infrastructure': workspace:^1.3.2 + '@boostercloud/framework-provider-kubernetes': workspace:^1.3.2 + '@boostercloud/framework-provider-kubernetes-infrastructure': workspace:^1.3.2 + '@boostercloud/framework-provider-local': workspace:^1.3.2 + '@boostercloud/framework-provider-local-infrastructure': workspace:^1.3.2 + '@boostercloud/framework-types': workspace:^1.3.2 + '@boostercloud/metadata-booster': workspace:^1.3.2 '@effect-ts/core': ^0.60.4 '@kubernetes/client-node': ^0.17.0 '@types/aws-lambda': 8.10.48 @@ -519,8 +519,8 @@ importers: ../../packages/framework-provider-aws: specifiers: '@boostercloud/eslint-config': workspace:^1.0.0 - '@boostercloud/framework-common-helpers': workspace:^1.3.1 - '@boostercloud/framework-types': workspace:^1.3.1 + '@boostercloud/framework-common-helpers': workspace:^1.3.2 + '@boostercloud/framework-types': workspace:^1.3.2 '@effect-ts/core': ^0.60.4 '@types/aws-lambda': 8.10.48 '@types/chai': 4.2.18 @@ -615,9 +615,9 @@ importers: '@aws-cdk/custom-resources': ^1.170.0 '@aws-cdk/cx-api': ^1.170.0 '@boostercloud/eslint-config': workspace:^1.0.0 - '@boostercloud/framework-common-helpers': workspace:^1.3.1 - '@boostercloud/framework-provider-aws': workspace:^1.3.1 - '@boostercloud/framework-types': workspace:^1.3.1 + '@boostercloud/framework-common-helpers': workspace:^1.3.2 + '@boostercloud/framework-provider-aws': workspace:^1.3.2 + '@boostercloud/framework-types': workspace:^1.3.2 '@effect-ts/core': ^0.60.4 '@types/archiver': 5.1.0 '@types/aws-lambda': 8.10.48 @@ -730,8 +730,8 @@ importers: '@azure/functions': ^1.2.2 '@azure/identity': ~2.1.0 '@boostercloud/eslint-config': workspace:^1.0.0 - '@boostercloud/framework-common-helpers': workspace:^1.3.1 - '@boostercloud/framework-types': workspace:^1.3.1 + '@boostercloud/framework-common-helpers': workspace:^1.3.2 + '@boostercloud/framework-types': workspace:^1.3.2 '@effect-ts/core': ^0.60.4 '@types/chai': 4.2.18 '@types/chai-as-promised': 7.1.4 @@ -802,10 +802,10 @@ importers: '@azure/cosmos': ^3.17.0 '@azure/identity': ~2.1.0 '@boostercloud/eslint-config': workspace:^1.0.0 - '@boostercloud/framework-common-helpers': workspace:^1.3.1 - '@boostercloud/framework-core': workspace:^1.3.1 - '@boostercloud/framework-provider-azure': workspace:^1.3.1 - '@boostercloud/framework-types': workspace:^1.3.1 + '@boostercloud/framework-common-helpers': workspace:^1.3.2 + '@boostercloud/framework-core': workspace:^1.3.2 + '@boostercloud/framework-provider-azure': workspace:^1.3.2 + '@boostercloud/framework-types': workspace:^1.3.2 '@cdktf/provider-azurerm': ^0.2.179 '@effect-ts/core': ^0.60.4 '@types/archiver': 5.1.0 @@ -911,8 +911,8 @@ importers: ../../packages/framework-provider-kubernetes: specifiers: '@boostercloud/eslint-config': workspace:^1.0.0 - '@boostercloud/framework-common-helpers': workspace:^1.3.1 - '@boostercloud/framework-types': workspace:^1.3.1 + '@boostercloud/framework-common-helpers': workspace:^1.3.2 + '@boostercloud/framework-types': workspace:^1.3.2 '@effect-ts/core': ^0.60.4 '@types/body-parser': ~1.19.2 '@types/chai': 4.2.18 @@ -990,8 +990,8 @@ importers: ../../packages/framework-provider-kubernetes-infrastructure: specifiers: '@boostercloud/eslint-config': workspace:^1.0.0 - '@boostercloud/framework-common-helpers': workspace:^1.3.1 - '@boostercloud/framework-types': workspace:^1.3.1 + '@boostercloud/framework-common-helpers': workspace:^1.3.2 + '@boostercloud/framework-types': workspace:^1.3.2 '@effect-ts/core': ^0.60.4 '@kubernetes/client-node': ^0.17.0 '@types/archiver': 5.1.0 @@ -1093,8 +1093,8 @@ importers: ../../packages/framework-provider-local: specifiers: '@boostercloud/eslint-config': workspace:^1.0.0 - '@boostercloud/framework-common-helpers': workspace:^1.3.1 - '@boostercloud/framework-types': workspace:^1.3.1 + '@boostercloud/framework-common-helpers': workspace:^1.3.2 + '@boostercloud/framework-types': workspace:^1.3.2 '@effect-ts/core': ^0.60.4 '@types/chai': 4.2.18 '@types/chai-as-promised': 7.1.4 @@ -1110,6 +1110,7 @@ importers: '@typescript-eslint/parser': ^5.0.0 chai: 4.2.0 chai-as-promised: 7.1.1 + cross-env: 7.0.3 eslint: ^8.23.1 eslint-config-prettier: 8.3.0 eslint-plugin-import: ^2.26.0 @@ -1150,6 +1151,7 @@ importers: '@typescript-eslint/parser': 5.41.0_t7ph7dpvh7g5bfovntuojbuu4i chai: 4.2.0 chai-as-promised: 7.1.1_chai@4.2.0 + cross-env: 7.0.3 eslint: 8.26.0 eslint-config-prettier: 8.3.0_eslint@8.26.0 eslint-plugin-import: 2.26.0_eslint@8.26.0 @@ -1170,9 +1172,9 @@ importers: ../../packages/framework-provider-local-infrastructure: specifiers: '@boostercloud/eslint-config': workspace:^1.0.0 - '@boostercloud/framework-common-helpers': workspace:^1.3.1 - '@boostercloud/framework-provider-local': workspace:^1.3.1 - '@boostercloud/framework-types': workspace:^1.3.1 + '@boostercloud/framework-common-helpers': workspace:^1.3.2 + '@boostercloud/framework-provider-local': workspace:^1.3.2 + '@boostercloud/framework-types': workspace:^1.3.2 '@effect-ts/core': ^0.60.4 '@types/chai': 4.2.18 '@types/chai-as-promised': 7.1.4 @@ -1191,6 +1193,7 @@ importers: chai: 4.2.0 chai-as-promised: 7.1.1 cors: 2.8.5 + cross-env: 7.0.3 eslint: ^8.23.1 eslint-config-prettier: 8.3.0 eslint-plugin-import: ^2.26.0 @@ -1238,6 +1241,7 @@ importers: '@typescript-eslint/parser': 5.41.0_t7ph7dpvh7g5bfovntuojbuu4i chai: 4.2.0 chai-as-promised: 7.1.1_chai@4.2.0 + cross-env: 7.0.3 eslint: 8.26.0 eslint-config-prettier: 8.3.0_eslint@8.26.0 eslint-plugin-import: 2.26.0_eslint@8.26.0 @@ -1257,7 +1261,7 @@ importers: ../../packages/framework-types: specifiers: '@boostercloud/eslint-config': workspace:^1.0.0 - '@boostercloud/metadata-booster': workspace:^1.3.1 + '@boostercloud/metadata-booster': workspace:^1.3.2 '@effect-ts/core': ^0.60.4 '@effect-ts/node': ~0.39.0 '@types/chai': 4.2.18 @@ -1442,7 +1446,7 @@ packages: '@aws-cdk/aws-cloudwatch': 1.179.0_2c6t2dpjce4beyfcc37245dnfi '@aws-cdk/aws-cognito': 1.179.0_ub64wnlww7mkqux7siutd2ss54 '@aws-cdk/aws-ec2': 1.179.0_yohwu6y4mqebmx43wrtodhkfpq - '@aws-cdk/aws-elasticloadbalancingv2': 1.179.0_zulwpv4g44wntipzxqpoqpsbmu + '@aws-cdk/aws-elasticloadbalancingv2': 1.179.0_g5dp7u3ju7pdqn23rg6i4cw7im '@aws-cdk/aws-iam': 1.179.0_quico4jh3miscxbbsbvbflyavq '@aws-cdk/aws-lambda': 1.179.0_cv6pey37wfi5ltjwde625jzgym '@aws-cdk/aws-logs': 1.179.0_oa36ahfhbsqihtei6hr4wrq4fq @@ -1547,7 +1551,7 @@ packages: '@aws-cdk/aws-cloudwatch': 1.179.0_2c6t2dpjce4beyfcc37245dnfi '@aws-cdk/aws-ec2': 1.179.0_yohwu6y4mqebmx43wrtodhkfpq '@aws-cdk/aws-elasticloadbalancing': 1.179.0_tleqdp6ulv52grcvepo3y4bda4 - '@aws-cdk/aws-elasticloadbalancingv2': 1.179.0_zulwpv4g44wntipzxqpoqpsbmu + '@aws-cdk/aws-elasticloadbalancingv2': 1.179.0_g5dp7u3ju7pdqn23rg6i4cw7im '@aws-cdk/aws-iam': 1.179.0_quico4jh3miscxbbsbvbflyavq '@aws-cdk/aws-sns': 1.179.0_3efdynahstjsoxyvfdzqn4gn2u '@aws-cdk/core': 1.179.0_wobw5cuxxyp6fekxiie3x626sy @@ -1664,7 +1668,7 @@ packages: '@aws-cdk/aws-codecommit': 1.179.0_aj7opj3oap3gdssa5hz4omfo2y '@aws-cdk/aws-codestarnotifications': 1.179.0_quico4jh3miscxbbsbvbflyavq '@aws-cdk/aws-ec2': 1.179.0_yohwu6y4mqebmx43wrtodhkfpq - '@aws-cdk/aws-ecr': 1.179.0_3efdynahstjsoxyvfdzqn4gn2u + '@aws-cdk/aws-ecr': 1.179.0_q4fmnsxorjylqa2b5el7ij2gni '@aws-cdk/aws-ecr-assets': 1.179.0_aj7opj3oap3gdssa5hz4omfo2y '@aws-cdk/aws-events': 1.179.0_2c6t2dpjce4beyfcc37245dnfi '@aws-cdk/aws-iam': 1.179.0_quico4jh3miscxbbsbvbflyavq @@ -1839,7 +1843,7 @@ packages: constructs: ^3.3.69 dependencies: '@aws-cdk/assets': 1.179.0_bs7morulzjijy5bmj2ufqn7rwy - '@aws-cdk/aws-ecr': 1.179.0_3efdynahstjsoxyvfdzqn4gn2u + '@aws-cdk/aws-ecr': 1.179.0_q4fmnsxorjylqa2b5el7ij2gni '@aws-cdk/aws-iam': 1.179.0_quico4jh3miscxbbsbvbflyavq '@aws-cdk/aws-s3': 1.179.0_3efdynahstjsoxyvfdzqn4gn2u '@aws-cdk/core': 1.179.0_wobw5cuxxyp6fekxiie3x626sy @@ -1849,7 +1853,7 @@ packages: - '@aws-cdk/aws-events' dev: false - /@aws-cdk/aws-ecr/1.179.0_3efdynahstjsoxyvfdzqn4gn2u: + /@aws-cdk/aws-ecr/1.179.0_q4fmnsxorjylqa2b5el7ij2gni: resolution: {integrity: sha512-F/DbIxF1puZozLK8cvlgDPttWfY9g48dsYvGBInpiONWqMTeDTJI6UrZcobpLFRQUnEC3v4+gzPqlmMucsyV0g==} engines: {node: '>= 14.15.0'} peerDependencies: @@ -1860,11 +1864,8 @@ packages: dependencies: '@aws-cdk/aws-events': 1.179.0_2c6t2dpjce4beyfcc37245dnfi '@aws-cdk/aws-iam': 1.179.0_quico4jh3miscxbbsbvbflyavq - '@aws-cdk/aws-kms': 1.179.0_4kf7eosa4r2elcpvgrozaapjtm '@aws-cdk/core': 1.179.0_wobw5cuxxyp6fekxiie3x626sy constructs: 3.4.137 - transitivePeerDependencies: - - '@aws-cdk/cx-api' dev: false /@aws-cdk/aws-ecs/1.179.0_imsvpvaugzuh2jnowstujlpjbe: @@ -1885,20 +1886,20 @@ packages: '@aws-cdk/aws-certificatemanager': 1.179.0_ied5ktv5a27k2pgambwi24nvpq '@aws-cdk/aws-cloudwatch': 1.179.0_2c6t2dpjce4beyfcc37245dnfi '@aws-cdk/aws-ec2': 1.179.0_yohwu6y4mqebmx43wrtodhkfpq - '@aws-cdk/aws-ecr': 1.179.0_3efdynahstjsoxyvfdzqn4gn2u + '@aws-cdk/aws-ecr': 1.179.0_q4fmnsxorjylqa2b5el7ij2gni '@aws-cdk/aws-ecr-assets': 1.179.0_aj7opj3oap3gdssa5hz4omfo2y '@aws-cdk/aws-elasticloadbalancing': 1.179.0_tleqdp6ulv52grcvepo3y4bda4 - '@aws-cdk/aws-elasticloadbalancingv2': 1.179.0_zulwpv4g44wntipzxqpoqpsbmu + '@aws-cdk/aws-elasticloadbalancingv2': 1.179.0_g5dp7u3ju7pdqn23rg6i4cw7im '@aws-cdk/aws-iam': 1.179.0_quico4jh3miscxbbsbvbflyavq '@aws-cdk/aws-kms': 1.179.0_4kf7eosa4r2elcpvgrozaapjtm '@aws-cdk/aws-lambda': 1.179.0_cv6pey37wfi5ltjwde625jzgym '@aws-cdk/aws-logs': 1.179.0_oa36ahfhbsqihtei6hr4wrq4fq '@aws-cdk/aws-route53': 1.179.0_gle6afiiinzopqeyhzkkgv2sgu - '@aws-cdk/aws-route53-targets': 1.179.0_jhijj2vjqtueghhkwucl2jgo2q + '@aws-cdk/aws-route53-targets': 1.179.0_g37lmkweei6jrbm7ewmx3tcp4e '@aws-cdk/aws-s3': 1.179.0_3efdynahstjsoxyvfdzqn4gn2u '@aws-cdk/aws-s3-assets': 1.179.0_oa36ahfhbsqihtei6hr4wrq4fq '@aws-cdk/aws-secretsmanager': 1.179.0_i5c3f5zodvhstwpwdioxz2jvte - '@aws-cdk/aws-servicediscovery': 1.179.0_o6gfujuotbzwe57ovuxahyyeu4 + '@aws-cdk/aws-servicediscovery': 1.179.0_g5dp7u3ju7pdqn23rg6i4cw7im '@aws-cdk/aws-sns': 1.179.0_3efdynahstjsoxyvfdzqn4gn2u '@aws-cdk/aws-sqs': 1.179.0_4kf7eosa4r2elcpvgrozaapjtm '@aws-cdk/aws-ssm': 1.179.0_4kf7eosa4r2elcpvgrozaapjtm @@ -1949,7 +1950,7 @@ packages: constructs: 3.4.137 dev: false - /@aws-cdk/aws-elasticloadbalancingv2/1.179.0_zulwpv4g44wntipzxqpoqpsbmu: + /@aws-cdk/aws-elasticloadbalancingv2/1.179.0_g5dp7u3ju7pdqn23rg6i4cw7im: resolution: {integrity: sha512-4iDEY6amCe1fBfE+p193aiKRQid3UdJBBk9lX8xXEoX/R8JDrQl5KzfQUkscMqqc/6yU7/LjMSsf5NkgzfPlkQ==} engines: {node: '>= 14.15.0'} peerDependencies: @@ -1962,7 +1963,6 @@ packages: dependencies: '@aws-cdk/aws-certificatemanager': 1.179.0_ied5ktv5a27k2pgambwi24nvpq '@aws-cdk/aws-cloudwatch': 1.179.0_2c6t2dpjce4beyfcc37245dnfi - '@aws-cdk/aws-ec2': 1.179.0_yohwu6y4mqebmx43wrtodhkfpq '@aws-cdk/aws-iam': 1.179.0_quico4jh3miscxbbsbvbflyavq '@aws-cdk/aws-lambda': 1.179.0_cv6pey37wfi5ltjwde625jzgym '@aws-cdk/aws-route53': 1.179.0_gle6afiiinzopqeyhzkkgv2sgu @@ -1973,7 +1973,7 @@ packages: '@aws-cdk/region-info': 1.179.0 constructs: 3.4.137 transitivePeerDependencies: - - '@aws-cdk/assets' + - '@aws-cdk/aws-ec2' - '@aws-cdk/aws-logs' - '@aws-cdk/custom-resources' dev: false @@ -2171,7 +2171,7 @@ packages: '@aws-cdk/aws-cloudwatch': 1.179.0_2c6t2dpjce4beyfcc37245dnfi '@aws-cdk/aws-codeguruprofiler': 1.179.0_2c6t2dpjce4beyfcc37245dnfi '@aws-cdk/aws-ec2': 1.179.0_yohwu6y4mqebmx43wrtodhkfpq - '@aws-cdk/aws-ecr': 1.179.0_3efdynahstjsoxyvfdzqn4gn2u + '@aws-cdk/aws-ecr': 1.179.0_q4fmnsxorjylqa2b5el7ij2gni '@aws-cdk/aws-ecr-assets': 1.179.0_aj7opj3oap3gdssa5hz4omfo2y '@aws-cdk/aws-efs': 1.179.0_yohwu6y4mqebmx43wrtodhkfpq '@aws-cdk/aws-events': 1.179.0_2c6t2dpjce4beyfcc37245dnfi @@ -2212,7 +2212,7 @@ packages: - '@aws-cdk/aws-s3' dev: false - /@aws-cdk/aws-route53-targets/1.179.0_jhijj2vjqtueghhkwucl2jgo2q: + /@aws-cdk/aws-route53-targets/1.179.0_g37lmkweei6jrbm7ewmx3tcp4e: resolution: {integrity: sha512-htQzVZi6lHkKphmUKontrXR5hNaIZKotGIKvF98J5c75lBl1lsFax1/cxcrervlW2ruzDjjxKMqY/K3FUn4KUw==} engines: {node: '>= 14.15.0'} peerDependencies: @@ -2229,7 +2229,7 @@ packages: '@aws-cdk/aws-cognito': 1.179.0_ub64wnlww7mkqux7siutd2ss54 '@aws-cdk/aws-ec2': 1.179.0_yohwu6y4mqebmx43wrtodhkfpq '@aws-cdk/aws-elasticloadbalancing': 1.179.0_tleqdp6ulv52grcvepo3y4bda4 - '@aws-cdk/aws-elasticloadbalancingv2': 1.179.0_zulwpv4g44wntipzxqpoqpsbmu + '@aws-cdk/aws-elasticloadbalancingv2': 1.179.0_g5dp7u3ju7pdqn23rg6i4cw7im '@aws-cdk/aws-globalaccelerator': 1.179.0_2mo556wdbtrktktder7csdvslu '@aws-cdk/aws-iam': 1.179.0_quico4jh3miscxbbsbvbflyavq '@aws-cdk/aws-route53': 1.179.0_gle6afiiinzopqeyhzkkgv2sgu @@ -2238,7 +2238,6 @@ packages: '@aws-cdk/region-info': 1.179.0 constructs: 3.4.137 transitivePeerDependencies: - - '@aws-cdk/assets' - '@aws-cdk/aws-lambda' - '@aws-cdk/aws-logs' - '@aws-cdk/custom-resources' @@ -2386,7 +2385,7 @@ packages: constructs: 3.4.137 dev: false - /@aws-cdk/aws-servicediscovery/1.179.0_o6gfujuotbzwe57ovuxahyyeu4: + /@aws-cdk/aws-servicediscovery/1.179.0_g5dp7u3ju7pdqn23rg6i4cw7im: resolution: {integrity: sha512-LRAE3U7gbEi5pTF2sUK0mAPPlkmQXqUtTQqHAvUjq3Oh/BL/yU/KRoFP3Y9XXpkm6iRXFeYSG5gQJtMLDF4gSg==} engines: {node: '>= 14.15.0'} peerDependencies: @@ -2395,12 +2394,11 @@ packages: constructs: ^3.3.69 dependencies: '@aws-cdk/aws-ec2': 1.179.0_yohwu6y4mqebmx43wrtodhkfpq - '@aws-cdk/aws-elasticloadbalancingv2': 1.179.0_zulwpv4g44wntipzxqpoqpsbmu + '@aws-cdk/aws-elasticloadbalancingv2': 1.179.0_g5dp7u3ju7pdqn23rg6i4cw7im '@aws-cdk/aws-route53': 1.179.0_gle6afiiinzopqeyhzkkgv2sgu '@aws-cdk/core': 1.179.0_wobw5cuxxyp6fekxiie3x626sy constructs: 3.4.137 transitivePeerDependencies: - - '@aws-cdk/assets' - '@aws-cdk/aws-iam' - '@aws-cdk/aws-lambda' - '@aws-cdk/aws-logs' diff --git a/docs/chapters/02_getting-started.md b/docs/chapters/02_getting-started.md index 61cdfa0a4..4266d83c4 100644 --- a/docs/chapters/02_getting-started.md +++ b/docs/chapters/02_getting-started.md @@ -233,7 +233,7 @@ and 'production environments – "lint:fix": "eslint --quiet --fix --ext '.js,.ts' **/*.ts", "build": "ttsc -b tsconfig.json", "clean": "rimraf ./dist tsconfig.tsbuildinfo", - "test": "AWS_SDK_LOAD_CONFIG=true BOOSTER_ENV=test nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\"" + "test": "cross-env AWS_SDK_LOAD_CONFIG=true cross-env BOOSTER_ENV=test nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\"" }, ... ``` diff --git a/docs/chapters/06_testing-booster-applications.md b/docs/chapters/06_testing-booster-applications.md index 1996dd05c..09545076a 100644 --- a/docs/chapters/06_testing-booster-applications.md +++ b/docs/chapters/06_testing-booster-applications.md @@ -13,7 +13,7 @@ The only thing that you should add to this line are the `AWS_SDK_LOAD_CONFIG=tru ```typescript "scripts": { - "test": "AWS_SDK_LOAD_CONFIG=true BOOSTER_ENV=test nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\"" + "test": "cross-env AWS_SDK_LOAD_CONFIG=true cross-env BOOSTER_ENV=test nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\"" } ``` diff --git a/packages/cli/test/commands/new/command.test.ts b/packages/cli/test/commands/new/command.test.ts index fa1edf608..5d74ee907 100644 --- a/packages/cli/test/commands/new/command.test.ts +++ b/packages/cli/test/commands/new/command.test.ts @@ -6,12 +6,13 @@ import * as fs from 'fs-extra' import { IConfig } from '@oclif/config' import { expect } from '../../expect' import { template } from '../../../src/services/generator' +import * as path from 'path' describe('new', (): void => { describe('Command', () => { const command = 'ExampleCommand' const commandsRoot = 'src/commands/' - const commandPath = `${commandsRoot}example-command.ts` + const commandPath = path.join(`${commandsRoot}example-command.ts`) const defaultCommandImports = [ { packagePath: '@boostercloud/framework-core', diff --git a/packages/cli/test/commands/new/entity.test.ts b/packages/cli/test/commands/new/entity.test.ts index 2cd59fc14..ea852a4c8 100644 --- a/packages/cli/test/commands/new/entity.test.ts +++ b/packages/cli/test/commands/new/entity.test.ts @@ -6,12 +6,13 @@ import * as fs from 'fs-extra' import { IConfig } from '@oclif/config' import { expect } from '../../expect' import { template } from '../../../src/services/generator' +import * as path from 'path' describe('new', (): void => { describe('Entity', () => { const entityName = 'ExampleEntity' const entitysRoot = 'src/entities/' - const entityPath = `${entitysRoot}example-entity.ts` + const entityPath = path.join(`${entitysRoot}example-entity.ts`) const defaultEntityImports = [ { packagePath: '@boostercloud/framework-core', diff --git a/packages/cli/test/commands/new/event-handler.test.ts b/packages/cli/test/commands/new/event-handler.test.ts index 6d72a8b6f..d25e776fc 100644 --- a/packages/cli/test/commands/new/event-handler.test.ts +++ b/packages/cli/test/commands/new/event-handler.test.ts @@ -6,12 +6,13 @@ import * as fs from 'fs-extra' import { IConfig } from '@oclif/config' import { expect } from '../../expect' import { template } from '../../../src/services/generator' +import * as path from 'path' describe('new', (): void => { describe('Event', () => { const eventHandlerName = 'ExampleEventHandler' const eventHandlersRoot = 'src/event-handlers/' - const eventHandlerPath = `${eventHandlersRoot}example-event-handler.ts` + const eventHandlerPath = path.join(`${eventHandlersRoot}example-event-handler.ts`) const defaultEventHandlerImports = [ { packagePath: '../events/comment-posted', diff --git a/packages/cli/test/commands/new/event.test.ts b/packages/cli/test/commands/new/event.test.ts index 598e4969c..96acafaff 100644 --- a/packages/cli/test/commands/new/event.test.ts +++ b/packages/cli/test/commands/new/event.test.ts @@ -6,12 +6,13 @@ import * as fs from 'fs-extra' import { IConfig } from '@oclif/config' import { expect } from '../../expect' import { template } from '../../../src/services/generator' +import * as path from 'path' describe('new', (): void => { describe('Event', () => { const eventName = 'ExampleEvent' const eventsRoot = 'src/events/' - const eventPath = `${eventsRoot}example-event.ts` + const eventPath = path.join(`${eventsRoot}example-event.ts`) const defaultEventImports = [ { packagePath: '@boostercloud/framework-core', diff --git a/packages/cli/test/commands/new/project.test.ts b/packages/cli/test/commands/new/project.test.ts index 874c8fba6..88dec02c5 100644 --- a/packages/cli/test/commands/new/project.test.ts +++ b/packages/cli/test/commands/new/project.test.ts @@ -8,6 +8,7 @@ import * as Project from '../../../src/commands/new/project' import * as ProjectInitializer from '../../../src/services/project-initializer' import * as packageJson from '../../../src/templates/project/package-json' import * as Mustache from 'mustache' +import * as path from 'path' describe('new', (): void => { describe('project', () => { @@ -17,24 +18,24 @@ describe('new', (): void => { const defaultRepository = 'github.com:boostercloud/booster.git' const expectFilesAndDirectoriesCreated = (projectName: string) => { - expect(fs.mkdirs).to.have.been.calledWithMatch(`${projectName}/src/commands`) - expect(fs.mkdirs).to.have.been.calledWithMatch(`${projectName}/src/events`) - expect(fs.mkdirs).to.have.been.calledWithMatch(`${projectName}/src/entities`) - expect(fs.mkdirs).to.have.been.calledWithMatch(`${projectName}/src/read-models`) - expect(fs.mkdirs).to.have.been.calledWithMatch(`${projectName}/src/config`) - expect(fs.mkdirs).to.have.been.calledWithMatch(`${projectName}/src/common`) - expect(fs.mkdirs).to.have.been.calledWithMatch(`${projectName}/src/event-handlers`) - expect(fs.mkdirs).to.have.been.calledWithMatch(`${projectName}/src/scheduled-commands`) - expect(fs.outputFile).to.have.been.calledWithMatch(`${projectName}/.eslintignore`) - expect(fs.outputFile).to.have.been.calledWithMatch(`${projectName}/.eslintrc.js`) - expect(fs.outputFile).to.have.been.calledWithMatch(`${projectName}/.gitignore`) - expect(fs.outputFile).to.have.been.calledWithMatch(`${projectName}/package.json`) - expect(fs.outputFile).to.have.been.calledWithMatch(`${projectName}/tsconfig.json`) - expect(fs.outputFile).to.have.been.calledWithMatch(`${projectName}/tsconfig.eslint.json`) - expect(fs.outputFile).to.have.been.calledWithMatch(`${projectName}/.prettierrc.yaml`) - expect(fs.outputFile).to.have.been.calledWithMatch(`${projectName}/src/config/config.ts`) - expect(fs.outputFile).to.have.been.calledWithMatch(`${projectName}/src/index.ts`) - expect(fs.outputFile).to.have.been.calledWithMatch(`${projectName}/.mocharc.yml`) + expect(fs.mkdirs).to.have.been.calledWithMatch(path.join(`${projectName}/src/commands`)) + expect(fs.mkdirs).to.have.been.calledWithMatch(path.join(`${projectName}/src/events`)) + expect(fs.mkdirs).to.have.been.calledWithMatch(path.join(`${projectName}/src/entities`)) + expect(fs.mkdirs).to.have.been.calledWithMatch(path.join(`${projectName}/src/read-models`)) + expect(fs.mkdirs).to.have.been.calledWithMatch(path.join(`${projectName}/src/config`)) + expect(fs.mkdirs).to.have.been.calledWithMatch(path.join(`${projectName}/src/common`)) + expect(fs.mkdirs).to.have.been.calledWithMatch(path.join(`${projectName}/src/event-handlers`)) + expect(fs.mkdirs).to.have.been.calledWithMatch(path.join(`${projectName}/src/scheduled-commands`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/.eslintignore`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/.eslintrc.js`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/.gitignore`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/package.json`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/tsconfig.json`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/tsconfig.eslint.json`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/.prettierrc.yaml`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/src/config/config.ts`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/src/index.ts`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/.mocharc.yml`)) } const defaultProjectInitializerConfig = { @@ -106,7 +107,7 @@ describe('new', (): void => { ) const expectedPackageJson = renderPackageJson(defaultProjectInitializerConfig) - expect(fs.outputFile).to.have.been.calledWithMatch(`${projectName}/package.json`,expectedPackageJson) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/package.json`),expectedPackageJson) expect(ProjectInitializer.installDependencies).to.have.been.called }) @@ -119,7 +120,7 @@ describe('new', (): void => { expect(ProjectInitializer.initializeGit).to.have.not.been.called expectFilesAndDirectoriesCreated(projectName) const expectedPackageJson = renderPackageJson(defaultProjectInitializerConfig) - expect(fs.outputFile).to.have.been.calledWithMatch(`${projectName}/package.json`,expectedPackageJson) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/package.json`),expectedPackageJson) }) describe('define homepage', () => { @@ -133,7 +134,7 @@ describe('new', (): void => { expect(ProjectInitializer.installDependencies).to.have.been.called expect(oraLogger.info).to.have.been.calledWithMatch('Project generated!') expectFilesAndDirectoriesCreated(projectName) - expect(fs.outputFile).to.have.been.calledWithMatch(`${projectName}/package.json`,renderPackageJson(config)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/package.json`),renderPackageJson(config)) }) it('with -H', async () => { @@ -146,7 +147,7 @@ describe('new', (): void => { expect(ProjectInitializer.installDependencies).to.have.been.called expect(oraLogger.info).to.have.been.calledWithMatch('Project generated!') expectFilesAndDirectoriesCreated(projectName) - expect(fs.outputFile).to.have.been.calledWithMatch(`${projectName}/package.json`,renderPackageJson(config)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/package.json`),renderPackageJson(config)) }) }) @@ -161,7 +162,7 @@ describe('new', (): void => { expect(ProjectInitializer.installDependencies).to.have.been.called expect(oraLogger.info).to.have.been.calledWithMatch('Project generated!') expectFilesAndDirectoriesCreated(projectName) - expect(fs.outputFile).to.have.been.calledWithMatch(`${projectName}/package.json`,renderPackageJson(config)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/package.json`),renderPackageJson(config)) }) it('with -a', async () => { @@ -174,7 +175,7 @@ describe('new', (): void => { expect(ProjectInitializer.installDependencies).to.have.been.called expect(oraLogger.info).to.have.been.calledWithMatch('Project generated!') expectFilesAndDirectoriesCreated(projectName) - expect(fs.outputFile).to.have.been.calledWithMatch(`${projectName}/package.json`,renderPackageJson(config)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/package.json`),renderPackageJson(config)) }) }) @@ -189,7 +190,7 @@ describe('new', (): void => { expect(ProjectInitializer.installDependencies).to.have.been.called expect(oraLogger.info).to.have.been.calledWithMatch('Project generated!') expectFilesAndDirectoriesCreated(projectName) - expect(fs.outputFile).to.have.been.calledWithMatch(`${projectName}/package.json`,renderPackageJson(config)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/package.json`),renderPackageJson(config)) }) it('with -d', async () => { @@ -202,7 +203,7 @@ describe('new', (): void => { expect(ProjectInitializer.installDependencies).to.have.been.called expect(oraLogger.info).to.have.been.calledWithMatch('Project generated!') expectFilesAndDirectoriesCreated(projectName) - expect(fs.outputFile).to.have.been.calledWithMatch(`${projectName}/package.json`,renderPackageJson(config)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/package.json`),renderPackageJson(config)) }) }) @@ -217,7 +218,7 @@ describe('new', (): void => { expect(ProjectInitializer.installDependencies).to.have.been.called expect(oraLogger.info).to.have.been.calledWithMatch('Project generated!') expectFilesAndDirectoriesCreated(projectName) - expect(fs.outputFile).to.have.been.calledWithMatch(`${projectName}/package.json`,renderPackageJson(config)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/package.json`),renderPackageJson(config)) }) it('with -l', async () => { @@ -230,7 +231,7 @@ describe('new', (): void => { expect(ProjectInitializer.installDependencies).to.have.been.called expect(oraLogger.info).to.have.been.calledWithMatch('Project generated!') expectFilesAndDirectoriesCreated(projectName) - expect(fs.outputFile).to.have.been.calledWithMatch(`${projectName}/package.json`,renderPackageJson(config)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/package.json`),renderPackageJson(config)) }) }) @@ -269,7 +270,7 @@ describe('new', (): void => { expect(ProjectInitializer.installDependencies).to.have.been.called expect(oraLogger.info).to.have.been.calledWithMatch('Project generated!') expectFilesAndDirectoriesCreated(projectName) - expect(fs.outputFile).to.have.been.calledWithMatch(`${projectName}/package.json`,renderPackageJson(config)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/package.json`),renderPackageJson(config)) }) it('with -r', async () => { @@ -282,7 +283,7 @@ describe('new', (): void => { expect(ProjectInitializer.installDependencies).to.have.been.called expect(oraLogger.info).to.have.been.calledWithMatch('Project generated!') expectFilesAndDirectoriesCreated(projectName) - expect(fs.outputFile).to.have.been.calledWithMatch(`${projectName}/package.json`,renderPackageJson(config)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/package.json`),renderPackageJson(config)) }) }) @@ -297,7 +298,7 @@ describe('new', (): void => { expect(ProjectInitializer.installDependencies).to.have.been.called expect(oraLogger.info).to.have.been.calledWithMatch('Project generated!') expectFilesAndDirectoriesCreated(projectName) - expect(fs.outputFile).to.have.been.calledWithMatch(`${projectName}/package.json`,renderPackageJson(config)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/package.json`),renderPackageJson(config)) }) it('with -v', async () => { @@ -310,7 +311,7 @@ describe('new', (): void => { expect(ProjectInitializer.installDependencies).to.have.been.called expect(oraLogger.info).to.have.been.calledWithMatch('Project generated!') expectFilesAndDirectoriesCreated(projectName) - expect(fs.outputFile).to.have.been.calledWithMatch(`${projectName}/package.json`,renderPackageJson(config)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/package.json`),renderPackageJson(config)) }) }) @@ -359,7 +360,7 @@ describe('new', (): void => { it('with empty project name', async () => { replace(console,'error', fake.resolves({})) await new Project.default([], {} as IConfig).run() - expect(fs.mkdirs).to.have.not.been.calledWithMatch(`${projectName}/src`) + expect(fs.mkdirs).to.have.not.been.calledWithMatch(path.join(`${projectName}/src`)) expect(console.error).to.have.been.calledWithMatch(/You haven't provided a project name/) expect(oraLogger.info).to.have.not.been.calledWithMatch('Project generated!') }) @@ -376,7 +377,7 @@ describe('new', (): void => { expect(exceptionThrown).to.be.equal(true) expect(exceptionMessage).to.contain('Unexpected argument: --nonexistingoption') expect(oraLogger.info).to.have.not.been.calledWithMatch('Project generated!') - expect(fs.mkdirs).to.have.not.been.calledWithMatch(`${projectName}/src`) + expect(fs.mkdirs).to.have.not.been.calledWithMatch(path.join(`${projectName}/src`)) }) describe('define homepage badly', () => { diff --git a/packages/cli/test/commands/new/read-model.test.ts b/packages/cli/test/commands/new/read-model.test.ts index 1d3428224..0e5d8b56d 100644 --- a/packages/cli/test/commands/new/read-model.test.ts +++ b/packages/cli/test/commands/new/read-model.test.ts @@ -6,12 +6,13 @@ import * as fs from 'fs-extra' import { IConfig } from '@oclif/config' import { expect } from '../../expect' import { template } from '../../../src/services/generator' +import * as path from 'path' describe('new', (): void => { describe('ReadModel', () => { const readModelName = 'ExampleReadModel' - const readModelsRoot = 'src/read-models/' - const readModelPath = `${readModelsRoot}example-read-model.ts` + const readModelsRoot = path.join('src/read-models/') + const readModelPath = path.join(`${readModelsRoot}example-read-model.ts`) const defaultReadModelImports = [ { packagePath: '@boostercloud/framework-core', diff --git a/packages/cli/test/commands/new/scheduled-command.test.ts b/packages/cli/test/commands/new/scheduled-command.test.ts index 2debde299..be53b269f 100644 --- a/packages/cli/test/commands/new/scheduled-command.test.ts +++ b/packages/cli/test/commands/new/scheduled-command.test.ts @@ -6,11 +6,12 @@ import * as fs from 'fs-extra' import { IConfig } from '@oclif/config' import { expect } from '../../expect' import { template } from '../../../src/services/generator' +import * as path from 'path' describe('new', (): void => { describe('ScheduledCommand', () => { const scheduledCommandName = 'ExampleScheduledCommand' - const scheduledCommandRoot = 'src/scheduled-commands/' + const scheduledCommandRoot = path.join('src/scheduled-commands/') const scheduledCommandPath = `${scheduledCommandRoot}example-scheduled-command.ts` const defaultScheduledCommandImports = [ { diff --git a/packages/cli/test/commands/new/type.test.ts b/packages/cli/test/commands/new/type.test.ts index e0d178878..580be9f6e 100644 --- a/packages/cli/test/commands/new/type.test.ts +++ b/packages/cli/test/commands/new/type.test.ts @@ -6,11 +6,12 @@ import * as fs from 'fs-extra' import { IConfig } from '@oclif/config' import { expect } from '../../expect' import { template } from '../../../src/services/generator' +import * as path from 'path' describe('new', (): void => { describe('Type', () => { const typeName = 'ExampleType' - const typesRoot = 'src/common/' + const typesRoot = path.join('src/common/') const typePath = `${typesRoot}example-type.ts` const defaultTypeImports = [ { diff --git a/packages/cli/test/services/generator.test.ts b/packages/cli/test/services/generator.test.ts index d0bae5650..e09cf077d 100644 --- a/packages/cli/test/services/generator.test.ts +++ b/packages/cli/test/services/generator.test.ts @@ -39,7 +39,7 @@ describe('generate service', (): void => { await generate(target) - expect(fs.outputFile).to.have.been.calledWithMatch('src/commands/new-command.ts', rendered) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join('src/commands/new-command.ts'), rendered) expect(projectChecker.checkResourceExists).to.have.been.called expect(rendered).not.to.contain('-> Custom code in the command!') }) @@ -65,7 +65,7 @@ describe('generate service', (): void => { await generate(target) - expect(fs.outputFile).to.have.been.calledWithMatch('src/entities/new-entity.ts', rendered) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join('src/entities/new-entity.ts'), rendered) expect(projectChecker.checkResourceExists).to.have.been.called expect(rendered).not.to.contain('-> Custom code in the entity!') }) @@ -88,7 +88,7 @@ describe('generate service', (): void => { await generate(target) - expect(fs.outputFile).to.have.been.calledWithMatch('src/event-handlers/new-event-handler.ts', rendered) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join('src/event-handlers/new-event-handler.ts'), rendered) expect(projectChecker.checkResourceExists).to.have.been.called expect(rendered).not.to.contain('-> Custom code in the event handler!') }) @@ -114,7 +114,7 @@ describe('generate service', (): void => { await generate(target) - expect(fs.outputFile).to.have.been.calledWithMatch('src/events/new-event.ts', rendered) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join('src/events/new-event.ts'), rendered) expect(projectChecker.checkResourceExists).to.have.been.called expect(rendered).not.to.contain('-> Custom code in the event!') }) @@ -141,7 +141,7 @@ describe('generate service', (): void => { await generate(target) - expect(fs.outputFile).to.have.been.calledWithMatch('src/read-models/new-read-model.ts', rendered) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join('src/read-models/new-read-model.ts'), rendered) expect(projectChecker.checkResourceExists).to.have.been.called expect(rendered).not.to.contain('-> Custom code in the read model!') }) @@ -163,7 +163,7 @@ describe('generate service', (): void => { await generate(target) - expect(fs.outputFile).to.have.been.calledWithMatch('src/scheduled-commands/new-scheduled-command.ts', rendered) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join('src/scheduled-commands/new-scheduled-command.ts'), rendered) expect(projectChecker.checkResourceExists).to.have.been.called expect(rendered).not.to.contain('-> Custom code in the scheduled command!') }) @@ -189,7 +189,7 @@ describe('generate service', (): void => { await generate(target) - expect(fs.outputFile).to.have.been.calledWithMatch('src/common/new-type.ts', rendered) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join('src/common/new-type.ts'), rendered) expect(projectChecker.checkResourceExists).to.have.been.called expect(rendered).not.to.contain('-> Custom code in the type!') }) diff --git a/packages/cli/test/services/project-initializer.test.ts b/packages/cli/test/services/project-initializer.test.ts index 37fe91130..d8dee2f52 100644 --- a/packages/cli/test/services/project-initializer.test.ts +++ b/packages/cli/test/services/project-initializer.test.ts @@ -11,6 +11,7 @@ import { restore, replace, fake } from 'sinon' import { expect } from '../expect' import { makeTestPackageManager } from './package-manager/test.impl' import * as PackageManager from '../../src/services/package-manager/live.impl' +import * as path from 'path' describe('project initializer', (): void => { beforeEach(() => { @@ -49,14 +50,14 @@ describe('project initializer', (): void => { it('Generate root directory', async () => { await generateRootDirectory(defaultProjectInitializerConfig) - expect(fs.mkdirs).to.have.been.calledWithMatch(`${projectName}/src/commands`) - expect(fs.mkdirs).to.have.been.calledWithMatch(`${projectName}/src/events`) - expect(fs.mkdirs).to.have.been.calledWithMatch(`${projectName}/src/entities`) - expect(fs.mkdirs).to.have.been.calledWithMatch(`${projectName}/src/read-models`) - expect(fs.mkdirs).to.have.been.calledWithMatch(`${projectName}/src/config`) - expect(fs.mkdirs).to.have.been.calledWithMatch(`${projectName}/src/common`) - expect(fs.mkdirs).to.have.been.calledWithMatch(`${projectName}/src/event-handlers`) - expect(fs.mkdirs).to.have.been.calledWithMatch(`${projectName}/src/scheduled-commands`) + expect(fs.mkdirs).to.have.been.calledWithMatch(path.join(`${projectName}/src/commands`)) + expect(fs.mkdirs).to.have.been.calledWithMatch(path.join(`${projectName}/src/events`)) + expect(fs.mkdirs).to.have.been.calledWithMatch(path.join(`${projectName}/src/entities`)) + expect(fs.mkdirs).to.have.been.calledWithMatch(path.join(`${projectName}/src/read-models`)) + expect(fs.mkdirs).to.have.been.calledWithMatch(path.join(`${projectName}/src/config`)) + expect(fs.mkdirs).to.have.been.calledWithMatch(path.join(`${projectName}/src/common`)) + expect(fs.mkdirs).to.have.been.calledWithMatch(path.join(`${projectName}/src/event-handlers`)) + expect(fs.mkdirs).to.have.been.calledWithMatch(path.join(`${projectName}/src/scheduled-commands`)) }) it('install dependencies', async () => { @@ -68,15 +69,15 @@ describe('project initializer', (): void => { it('Generate config files', async () => { await generateConfigFiles(defaultProjectInitializerConfig) - expect(fs.outputFile).to.have.been.calledWithMatch(`${projectName}/.eslintignore`) - expect(fs.outputFile).to.have.been.calledWithMatch(`${projectName}/.eslintrc.js`) - expect(fs.outputFile).to.have.been.calledWithMatch(`${projectName}/.gitignore`) - expect(fs.outputFile).to.have.been.calledWithMatch(`${projectName}/package.json`) - expect(fs.outputFile).to.have.been.calledWithMatch(`${projectName}/tsconfig.json`) - expect(fs.outputFile).to.have.been.calledWithMatch(`${projectName}/tsconfig.eslint.json`) - expect(fs.outputFile).to.have.been.calledWithMatch(`${projectName}/.prettierrc.yaml`) - expect(fs.outputFile).to.have.been.calledWithMatch(`${projectName}/src/config/config.ts`) - expect(fs.outputFile).to.have.been.calledWithMatch(`${projectName}/src/index.ts`) - expect(fs.outputFile).to.have.been.calledWithMatch(`${projectName}/.mocharc.yml`) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/.eslintignore`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/.eslintrc.js`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/.gitignore`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/package.json`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/tsconfig.json`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/tsconfig.eslint.json`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/.prettierrc.yaml`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/src/config/config.ts`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/src/index.ts`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/.mocharc.yml`)) }) }) diff --git a/packages/framework-integration-tests/integration/fixtures/cart-demo/package.json b/packages/framework-integration-tests/integration/fixtures/cart-demo/package.json index 5ed5b7b43..4f63a2c5d 100644 --- a/packages/framework-integration-tests/integration/fixtures/cart-demo/package.json +++ b/packages/framework-integration-tests/integration/fixtures/cart-demo/package.json @@ -38,7 +38,7 @@ "lint:fix": "eslint --quiet --fix --ext '.js,.ts' **/*.ts", "build": "ttsc -b tsconfig.json", "clean": "rimraf ./dist tsconfig.tsbuildinfo", - "test": "AWS_SDK_LOAD_CONFIG=true BOOSTER_ENV=test nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\"" + "test": "cross-env AWS_SDK_LOAD_CONFIG=true cross-env BOOSTER_ENV=test nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\"" }, "types": "lib/index.d.ts" } diff --git a/packages/framework-provider-aws-infrastructure/package.json b/packages/framework-provider-aws-infrastructure/package.json index 4804f4cf6..ccac7d9aa 100644 --- a/packages/framework-provider-aws-infrastructure/package.json +++ b/packages/framework-provider-aws-infrastructure/package.json @@ -59,7 +59,7 @@ "clean": "rimraf ./dist tsconfig.tsbuildinfo", "prepack": "tsc -b tsconfig.json", "test:provider-aws-infrastructure": "npm run test", - "test": "nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\"" + "test": "nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\" --timeout 600000" }, "bugs": { "url": "https://github.com/boostercloud/booster/issues" diff --git a/packages/framework-provider-aws-infrastructure/test/infrastructure/stack-tools.test.ts b/packages/framework-provider-aws-infrastructure/test/infrastructure/stack-tools.test.ts index 990d4d479..2920b5836 100644 --- a/packages/framework-provider-aws-infrastructure/test/infrastructure/stack-tools.test.ts +++ b/packages/framework-provider-aws-infrastructure/test/infrastructure/stack-tools.test.ts @@ -5,6 +5,7 @@ import { fake, mock, replace, restore, spy } from 'sinon' import { expect } from '../expect' import { ApplicationStackBuilder } from '../../src/infrastructure/stacks/application-stack' import { SdkProvider } from 'aws-cdk' +import * as path from 'path' const rewire = require('rewire') const StackTools = rewire('../../src/infrastructure/stack-tools') @@ -161,7 +162,7 @@ describe('the `stack-tools` module', () => { const fun: any = Object.values(stackResources).find((obj: any) => { return obj.Properties.FunctionName == 'testing-app-app-graphql-handler' }) - expect(fun.Properties.Handler).to.equal('dist/index.boosterServeGraphQL') + expect(fun.Properties.Handler).to.equal(path.join('dist/index.boosterServeGraphQL')) }) }) diff --git a/packages/framework-provider-azure-infrastructure/test/infrastructure/functions/event-handler-functions.test.ts b/packages/framework-provider-azure-infrastructure/test/infrastructure/functions/event-handler-functions.test.ts index b3d4a3ed7..a2529fa16 100644 --- a/packages/framework-provider-azure-infrastructure/test/infrastructure/functions/event-handler-functions.test.ts +++ b/packages/framework-provider-azure-infrastructure/test/infrastructure/functions/event-handler-functions.test.ts @@ -2,6 +2,7 @@ import { BoosterConfig } from '@boostercloud/framework-types' import { describe } from 'mocha' import { EventHandlerFunction } from '../../../src/infrastructure/functions/event-handler-function' import { expect } from '../../expect' +import * as path from 'path' describe('Creating event-handler-functions', () => { const config = new BoosterConfig('test') @@ -20,7 +21,7 @@ describe('Creating event-handler-functions', () => { expect(definition.config.bindings[0].databaseName).to.be.equal('new-booster-app-app') expect(definition.config.bindings[0].collectionName).to.be.equal('new-booster-app-app-events-store') expect(definition.config.bindings[0].createLeaseCollectionIfNotExists).to.be.equal('true') - expect(definition.config.scriptFile).to.be.equal('../dist/index.js') + expect(definition.config.scriptFile).to.be.equal(path.join('../dist/index.js')) expect(definition.config.entryPoint).to.be.equal('boosterEventDispatcher') }) -}) +}) \ No newline at end of file diff --git a/packages/framework-provider-azure-infrastructure/test/infrastructure/functions/graphql-functions.test.ts b/packages/framework-provider-azure-infrastructure/test/infrastructure/functions/graphql-functions.test.ts index 658b3b216..58fb0372b 100644 --- a/packages/framework-provider-azure-infrastructure/test/infrastructure/functions/graphql-functions.test.ts +++ b/packages/framework-provider-azure-infrastructure/test/infrastructure/functions/graphql-functions.test.ts @@ -2,6 +2,7 @@ import { BoosterConfig } from '@boostercloud/framework-types' import { describe } from 'mocha' import { GraphqlFunction } from '../../../src/infrastructure/functions/graphql-function' import { expect } from '../../expect' +import * as path from 'path' describe('Creating graphql-functions', () => { const config = new BoosterConfig('test') @@ -21,7 +22,7 @@ describe('Creating graphql-functions', () => { expect(definition.config.bindings[1].type).to.be.equal('http') expect(definition.config.bindings[1].name).to.be.equal('$return') expect(definition.config.bindings[1].direction).to.be.equal('out') - expect(definition.config.scriptFile).to.be.equal('../dist/index.js') + expect(definition.config.scriptFile).to.be.equal(path.join('../dist/index.js')) expect(definition.config.entryPoint).to.be.equal('boosterServeGraphQL') }) }) diff --git a/packages/framework-provider-azure-infrastructure/test/infrastructure/functions/schedules-functions.test.ts b/packages/framework-provider-azure-infrastructure/test/infrastructure/functions/schedules-functions.test.ts index a0550e472..2e01d4fc6 100644 --- a/packages/framework-provider-azure-infrastructure/test/infrastructure/functions/schedules-functions.test.ts +++ b/packages/framework-provider-azure-infrastructure/test/infrastructure/functions/schedules-functions.test.ts @@ -3,6 +3,7 @@ import { expect } from '../../expect' import { describe } from 'mocha' import { ScheduledFunctions } from '../../../src/infrastructure/functions/scheduled-functions' import { ScheduleFunctionDefinition } from '../../../src/infrastructure/types/functionDefinition' +import * as path from 'path' describe('Creating scheduled-functions', () => { describe('without scheduledCommandHandlers', () => { @@ -111,7 +112,7 @@ describe('Creating scheduled-functions', () => { expect(definition.config.bindings[0].name).to.be.equal(scheduleCommandName) expect(definition.config.bindings[0].direction).to.be.equal('in') expect(definition.config.bindings[0].schedule).to.be.equal(nCronTabExpression) - expect(definition.config.scriptFile).to.be.equal('../dist/index.js') + expect(definition.config.scriptFile).to.be.equal(path.join('../dist/index.js')) expect(definition.config.entryPoint).to.be.equal('boosterTriggerScheduledCommand') } diff --git a/packages/framework-provider-local-infrastructure/package.json b/packages/framework-provider-local-infrastructure/package.json index b428a608f..f48db61e5 100644 --- a/packages/framework-provider-local-infrastructure/package.json +++ b/packages/framework-provider-local-infrastructure/package.json @@ -38,7 +38,7 @@ "clean": "rimraf ./dist tsconfig.tsbuildinfo", "prepack": "tsc -b tsconfig.json", "test:provider-local-infrastructure": "npm run test", - "test": "BOOSTER_ENV=test nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\"" + "test": "cross-env BOOSTER_ENV=test nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\"" }, "bugs": { "url": "https://github.com/boostercloud/booster/issues" @@ -61,6 +61,7 @@ "@typescript-eslint/parser": "^5.0.0", "chai": "4.2.0", "chai-as-promised": "7.1.1", + "cross-env": "7.0.3", "eslint": "^8.23.1", "eslint-config-prettier": "8.3.0", "eslint-plugin-import": "^2.26.0", diff --git a/packages/framework-provider-local/package.json b/packages/framework-provider-local/package.json index 4a7c8457e..33305e504 100644 --- a/packages/framework-provider-local/package.json +++ b/packages/framework-provider-local/package.json @@ -35,7 +35,7 @@ "clean": "rimraf ./dist tsconfig.tsbuildinfo", "prepack": "tsc -b tsconfig.json", "test:provider-local": "npm run test", - "test": "BOOSTER_ENV=test nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\"" + "test": "cross-env BOOSTER_ENV=test nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\"" }, "bugs": { "url": "https://github.com/boostercloud/booster/issues" @@ -55,6 +55,7 @@ "@typescript-eslint/parser": "^5.0.0", "chai": "4.2.0", "chai-as-promised": "7.1.1", + "cross-env": "7.0.3", "eslint": "^8.23.1", "eslint-config-prettier": "8.3.0", "eslint-plugin-import": "^2.26.0", From a960e8cc050874f0db53265e01e122f40b9d3e9e Mon Sep 17 00:00:00 2001 From: nicolatl Date: Tue, 13 Dec 2022 16:42:19 -0500 Subject: [PATCH 2/3] refactor path.join to path.normalize where applicable --- .../cli/test/commands/new/command.test.ts | 2 +- packages/cli/test/commands/new/entity.test.ts | 2 +- .../test/commands/new/event-handler.test.ts | 2 +- packages/cli/test/commands/new/event.test.ts | 2 +- .../cli/test/commands/new/project.test.ts | 68 +++++++++---------- .../cli/test/commands/new/read-model.test.ts | 4 +- .../commands/new/scheduled-command.test.ts | 2 +- packages/cli/test/commands/new/type.test.ts | 2 +- packages/cli/test/services/generator.test.ts | 14 ++-- .../test/services/project-initializer.test.ts | 36 +++++----- .../test/infrastructure/stack-tools.test.ts | 2 +- .../functions/event-handler-functions.test.ts | 2 +- .../functions/graphql-functions.test.ts | 2 +- .../functions/schedules-functions.test.ts | 2 +- 14 files changed, 71 insertions(+), 71 deletions(-) diff --git a/packages/cli/test/commands/new/command.test.ts b/packages/cli/test/commands/new/command.test.ts index 5d74ee907..18723801c 100644 --- a/packages/cli/test/commands/new/command.test.ts +++ b/packages/cli/test/commands/new/command.test.ts @@ -12,7 +12,7 @@ describe('new', (): void => { describe('Command', () => { const command = 'ExampleCommand' const commandsRoot = 'src/commands/' - const commandPath = path.join(`${commandsRoot}example-command.ts`) + const commandPath = path.normalize(`${commandsRoot}example-command.ts`) const defaultCommandImports = [ { packagePath: '@boostercloud/framework-core', diff --git a/packages/cli/test/commands/new/entity.test.ts b/packages/cli/test/commands/new/entity.test.ts index ea852a4c8..f2a33fdab 100644 --- a/packages/cli/test/commands/new/entity.test.ts +++ b/packages/cli/test/commands/new/entity.test.ts @@ -12,7 +12,7 @@ describe('new', (): void => { describe('Entity', () => { const entityName = 'ExampleEntity' const entitysRoot = 'src/entities/' - const entityPath = path.join(`${entitysRoot}example-entity.ts`) + const entityPath = path.normalize(`${entitysRoot}example-entity.ts`) const defaultEntityImports = [ { packagePath: '@boostercloud/framework-core', diff --git a/packages/cli/test/commands/new/event-handler.test.ts b/packages/cli/test/commands/new/event-handler.test.ts index d25e776fc..e5e1702d9 100644 --- a/packages/cli/test/commands/new/event-handler.test.ts +++ b/packages/cli/test/commands/new/event-handler.test.ts @@ -12,7 +12,7 @@ describe('new', (): void => { describe('Event', () => { const eventHandlerName = 'ExampleEventHandler' const eventHandlersRoot = 'src/event-handlers/' - const eventHandlerPath = path.join(`${eventHandlersRoot}example-event-handler.ts`) + const eventHandlerPath = path.normalize(`${eventHandlersRoot}example-event-handler.ts`) const defaultEventHandlerImports = [ { packagePath: '../events/comment-posted', diff --git a/packages/cli/test/commands/new/event.test.ts b/packages/cli/test/commands/new/event.test.ts index 96acafaff..126adebf8 100644 --- a/packages/cli/test/commands/new/event.test.ts +++ b/packages/cli/test/commands/new/event.test.ts @@ -12,7 +12,7 @@ describe('new', (): void => { describe('Event', () => { const eventName = 'ExampleEvent' const eventsRoot = 'src/events/' - const eventPath = path.join(`${eventsRoot}example-event.ts`) + const eventPath = path.normalize(`${eventsRoot}example-event.ts`) const defaultEventImports = [ { packagePath: '@boostercloud/framework-core', diff --git a/packages/cli/test/commands/new/project.test.ts b/packages/cli/test/commands/new/project.test.ts index 88dec02c5..da1bdb746 100644 --- a/packages/cli/test/commands/new/project.test.ts +++ b/packages/cli/test/commands/new/project.test.ts @@ -18,24 +18,24 @@ describe('new', (): void => { const defaultRepository = 'github.com:boostercloud/booster.git' const expectFilesAndDirectoriesCreated = (projectName: string) => { - expect(fs.mkdirs).to.have.been.calledWithMatch(path.join(`${projectName}/src/commands`)) - expect(fs.mkdirs).to.have.been.calledWithMatch(path.join(`${projectName}/src/events`)) - expect(fs.mkdirs).to.have.been.calledWithMatch(path.join(`${projectName}/src/entities`)) - expect(fs.mkdirs).to.have.been.calledWithMatch(path.join(`${projectName}/src/read-models`)) - expect(fs.mkdirs).to.have.been.calledWithMatch(path.join(`${projectName}/src/config`)) - expect(fs.mkdirs).to.have.been.calledWithMatch(path.join(`${projectName}/src/common`)) - expect(fs.mkdirs).to.have.been.calledWithMatch(path.join(`${projectName}/src/event-handlers`)) - expect(fs.mkdirs).to.have.been.calledWithMatch(path.join(`${projectName}/src/scheduled-commands`)) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/.eslintignore`)) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/.eslintrc.js`)) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/.gitignore`)) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/package.json`)) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/tsconfig.json`)) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/tsconfig.eslint.json`)) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/.prettierrc.yaml`)) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/src/config/config.ts`)) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/src/index.ts`)) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/.mocharc.yml`)) + expect(fs.mkdirs).to.have.been.calledWithMatch(path.normalize(`${projectName}/src/commands`)) + expect(fs.mkdirs).to.have.been.calledWithMatch(path.normalize(`${projectName}/src/events`)) + expect(fs.mkdirs).to.have.been.calledWithMatch(path.normalize(`${projectName}/src/entities`)) + expect(fs.mkdirs).to.have.been.calledWithMatch(path.normalize(`${projectName}/src/read-models`)) + expect(fs.mkdirs).to.have.been.calledWithMatch(path.normalize(`${projectName}/src/config`)) + expect(fs.mkdirs).to.have.been.calledWithMatch(path.normalize(`${projectName}/src/common`)) + expect(fs.mkdirs).to.have.been.calledWithMatch(path.normalize(`${projectName}/src/event-handlers`)) + expect(fs.mkdirs).to.have.been.calledWithMatch(path.normalize(`${projectName}/src/scheduled-commands`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize(`${projectName}/.eslintignore`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize(`${projectName}/.eslintrc.js`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize(`${projectName}/.gitignore`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize(`${projectName}/package.json`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize(`${projectName}/tsconfig.json`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize(`${projectName}/tsconfig.eslint.json`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize(`${projectName}/.prettierrc.yaml`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize(`${projectName}/src/config/config.ts`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize(`${projectName}/src/index.ts`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize(`${projectName}/.mocharc.yml`)) } const defaultProjectInitializerConfig = { @@ -107,7 +107,7 @@ describe('new', (): void => { ) const expectedPackageJson = renderPackageJson(defaultProjectInitializerConfig) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/package.json`),expectedPackageJson) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize(`${projectName}/package.json`),expectedPackageJson) expect(ProjectInitializer.installDependencies).to.have.been.called }) @@ -120,7 +120,7 @@ describe('new', (): void => { expect(ProjectInitializer.initializeGit).to.have.not.been.called expectFilesAndDirectoriesCreated(projectName) const expectedPackageJson = renderPackageJson(defaultProjectInitializerConfig) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/package.json`),expectedPackageJson) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize(`${projectName}/package.json`),expectedPackageJson) }) describe('define homepage', () => { @@ -134,7 +134,7 @@ describe('new', (): void => { expect(ProjectInitializer.installDependencies).to.have.been.called expect(oraLogger.info).to.have.been.calledWithMatch('Project generated!') expectFilesAndDirectoriesCreated(projectName) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/package.json`),renderPackageJson(config)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize(`${projectName}/package.json`),renderPackageJson(config)) }) it('with -H', async () => { @@ -147,7 +147,7 @@ describe('new', (): void => { expect(ProjectInitializer.installDependencies).to.have.been.called expect(oraLogger.info).to.have.been.calledWithMatch('Project generated!') expectFilesAndDirectoriesCreated(projectName) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/package.json`),renderPackageJson(config)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize(`${projectName}/package.json`),renderPackageJson(config)) }) }) @@ -162,7 +162,7 @@ describe('new', (): void => { expect(ProjectInitializer.installDependencies).to.have.been.called expect(oraLogger.info).to.have.been.calledWithMatch('Project generated!') expectFilesAndDirectoriesCreated(projectName) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/package.json`),renderPackageJson(config)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize(`${projectName}/package.json`),renderPackageJson(config)) }) it('with -a', async () => { @@ -175,7 +175,7 @@ describe('new', (): void => { expect(ProjectInitializer.installDependencies).to.have.been.called expect(oraLogger.info).to.have.been.calledWithMatch('Project generated!') expectFilesAndDirectoriesCreated(projectName) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/package.json`),renderPackageJson(config)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize(`${projectName}/package.json`),renderPackageJson(config)) }) }) @@ -190,7 +190,7 @@ describe('new', (): void => { expect(ProjectInitializer.installDependencies).to.have.been.called expect(oraLogger.info).to.have.been.calledWithMatch('Project generated!') expectFilesAndDirectoriesCreated(projectName) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/package.json`),renderPackageJson(config)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize(`${projectName}/package.json`),renderPackageJson(config)) }) it('with -d', async () => { @@ -203,7 +203,7 @@ describe('new', (): void => { expect(ProjectInitializer.installDependencies).to.have.been.called expect(oraLogger.info).to.have.been.calledWithMatch('Project generated!') expectFilesAndDirectoriesCreated(projectName) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/package.json`),renderPackageJson(config)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize(`${projectName}/package.json`),renderPackageJson(config)) }) }) @@ -218,7 +218,7 @@ describe('new', (): void => { expect(ProjectInitializer.installDependencies).to.have.been.called expect(oraLogger.info).to.have.been.calledWithMatch('Project generated!') expectFilesAndDirectoriesCreated(projectName) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/package.json`),renderPackageJson(config)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize(`${projectName}/package.json`),renderPackageJson(config)) }) it('with -l', async () => { @@ -231,7 +231,7 @@ describe('new', (): void => { expect(ProjectInitializer.installDependencies).to.have.been.called expect(oraLogger.info).to.have.been.calledWithMatch('Project generated!') expectFilesAndDirectoriesCreated(projectName) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/package.json`),renderPackageJson(config)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize(`${projectName}/package.json`),renderPackageJson(config)) }) }) @@ -270,7 +270,7 @@ describe('new', (): void => { expect(ProjectInitializer.installDependencies).to.have.been.called expect(oraLogger.info).to.have.been.calledWithMatch('Project generated!') expectFilesAndDirectoriesCreated(projectName) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/package.json`),renderPackageJson(config)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize(`${projectName}/package.json`),renderPackageJson(config)) }) it('with -r', async () => { @@ -283,7 +283,7 @@ describe('new', (): void => { expect(ProjectInitializer.installDependencies).to.have.been.called expect(oraLogger.info).to.have.been.calledWithMatch('Project generated!') expectFilesAndDirectoriesCreated(projectName) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/package.json`),renderPackageJson(config)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize(`${projectName}/package.json`),renderPackageJson(config)) }) }) @@ -298,7 +298,7 @@ describe('new', (): void => { expect(ProjectInitializer.installDependencies).to.have.been.called expect(oraLogger.info).to.have.been.calledWithMatch('Project generated!') expectFilesAndDirectoriesCreated(projectName) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/package.json`),renderPackageJson(config)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize(`${projectName}/package.json`),renderPackageJson(config)) }) it('with -v', async () => { @@ -311,7 +311,7 @@ describe('new', (): void => { expect(ProjectInitializer.installDependencies).to.have.been.called expect(oraLogger.info).to.have.been.calledWithMatch('Project generated!') expectFilesAndDirectoriesCreated(projectName) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/package.json`),renderPackageJson(config)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize(`${projectName}/package.json`),renderPackageJson(config)) }) }) @@ -360,7 +360,7 @@ describe('new', (): void => { it('with empty project name', async () => { replace(console,'error', fake.resolves({})) await new Project.default([], {} as IConfig).run() - expect(fs.mkdirs).to.have.not.been.calledWithMatch(path.join(`${projectName}/src`)) + expect(fs.mkdirs).to.have.not.been.calledWithMatch(path.normalize(`${projectName}/src`)) expect(console.error).to.have.been.calledWithMatch(/You haven't provided a project name/) expect(oraLogger.info).to.have.not.been.calledWithMatch('Project generated!') }) @@ -377,7 +377,7 @@ describe('new', (): void => { expect(exceptionThrown).to.be.equal(true) expect(exceptionMessage).to.contain('Unexpected argument: --nonexistingoption') expect(oraLogger.info).to.have.not.been.calledWithMatch('Project generated!') - expect(fs.mkdirs).to.have.not.been.calledWithMatch(path.join(`${projectName}/src`)) + expect(fs.mkdirs).to.have.not.been.calledWithMatch(path.normalize(`${projectName}/src`)) }) describe('define homepage badly', () => { diff --git a/packages/cli/test/commands/new/read-model.test.ts b/packages/cli/test/commands/new/read-model.test.ts index 0e5d8b56d..23f04fc0d 100644 --- a/packages/cli/test/commands/new/read-model.test.ts +++ b/packages/cli/test/commands/new/read-model.test.ts @@ -11,8 +11,8 @@ import * as path from 'path' describe('new', (): void => { describe('ReadModel', () => { const readModelName = 'ExampleReadModel' - const readModelsRoot = path.join('src/read-models/') - const readModelPath = path.join(`${readModelsRoot}example-read-model.ts`) + const readModelsRoot = path.normalize('src/read-models/') + const readModelPath = path.normalize(`${readModelsRoot}example-read-model.ts`) const defaultReadModelImports = [ { packagePath: '@boostercloud/framework-core', diff --git a/packages/cli/test/commands/new/scheduled-command.test.ts b/packages/cli/test/commands/new/scheduled-command.test.ts index be53b269f..961babc47 100644 --- a/packages/cli/test/commands/new/scheduled-command.test.ts +++ b/packages/cli/test/commands/new/scheduled-command.test.ts @@ -11,7 +11,7 @@ import * as path from 'path' describe('new', (): void => { describe('ScheduledCommand', () => { const scheduledCommandName = 'ExampleScheduledCommand' - const scheduledCommandRoot = path.join('src/scheduled-commands/') + const scheduledCommandRoot = path.normalize('src/scheduled-commands/') const scheduledCommandPath = `${scheduledCommandRoot}example-scheduled-command.ts` const defaultScheduledCommandImports = [ { diff --git a/packages/cli/test/commands/new/type.test.ts b/packages/cli/test/commands/new/type.test.ts index 580be9f6e..c79f86577 100644 --- a/packages/cli/test/commands/new/type.test.ts +++ b/packages/cli/test/commands/new/type.test.ts @@ -11,7 +11,7 @@ import * as path from 'path' describe('new', (): void => { describe('Type', () => { const typeName = 'ExampleType' - const typesRoot = path.join('src/common/') + const typesRoot = path.normalize('src/common/') const typePath = `${typesRoot}example-type.ts` const defaultTypeImports = [ { diff --git a/packages/cli/test/services/generator.test.ts b/packages/cli/test/services/generator.test.ts index e09cf077d..c9f759667 100644 --- a/packages/cli/test/services/generator.test.ts +++ b/packages/cli/test/services/generator.test.ts @@ -39,7 +39,7 @@ describe('generate service', (): void => { await generate(target) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join('src/commands/new-command.ts'), rendered) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize('src/commands/new-command.ts'), rendered) expect(projectChecker.checkResourceExists).to.have.been.called expect(rendered).not.to.contain('-> Custom code in the command!') }) @@ -65,7 +65,7 @@ describe('generate service', (): void => { await generate(target) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join('src/entities/new-entity.ts'), rendered) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize('src/entities/new-entity.ts'), rendered) expect(projectChecker.checkResourceExists).to.have.been.called expect(rendered).not.to.contain('-> Custom code in the entity!') }) @@ -88,7 +88,7 @@ describe('generate service', (): void => { await generate(target) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join('src/event-handlers/new-event-handler.ts'), rendered) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize('src/event-handlers/new-event-handler.ts'), rendered) expect(projectChecker.checkResourceExists).to.have.been.called expect(rendered).not.to.contain('-> Custom code in the event handler!') }) @@ -114,7 +114,7 @@ describe('generate service', (): void => { await generate(target) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join('src/events/new-event.ts'), rendered) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize('src/events/new-event.ts'), rendered) expect(projectChecker.checkResourceExists).to.have.been.called expect(rendered).not.to.contain('-> Custom code in the event!') }) @@ -141,7 +141,7 @@ describe('generate service', (): void => { await generate(target) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join('src/read-models/new-read-model.ts'), rendered) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize('src/read-models/new-read-model.ts'), rendered) expect(projectChecker.checkResourceExists).to.have.been.called expect(rendered).not.to.contain('-> Custom code in the read model!') }) @@ -163,7 +163,7 @@ describe('generate service', (): void => { await generate(target) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join('src/scheduled-commands/new-scheduled-command.ts'), rendered) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize('src/scheduled-commands/new-scheduled-command.ts'), rendered) expect(projectChecker.checkResourceExists).to.have.been.called expect(rendered).not.to.contain('-> Custom code in the scheduled command!') }) @@ -189,7 +189,7 @@ describe('generate service', (): void => { await generate(target) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join('src/common/new-type.ts'), rendered) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize('src/common/new-type.ts'), rendered) expect(projectChecker.checkResourceExists).to.have.been.called expect(rendered).not.to.contain('-> Custom code in the type!') }) diff --git a/packages/cli/test/services/project-initializer.test.ts b/packages/cli/test/services/project-initializer.test.ts index d8dee2f52..95d2d518d 100644 --- a/packages/cli/test/services/project-initializer.test.ts +++ b/packages/cli/test/services/project-initializer.test.ts @@ -50,14 +50,14 @@ describe('project initializer', (): void => { it('Generate root directory', async () => { await generateRootDirectory(defaultProjectInitializerConfig) - expect(fs.mkdirs).to.have.been.calledWithMatch(path.join(`${projectName}/src/commands`)) - expect(fs.mkdirs).to.have.been.calledWithMatch(path.join(`${projectName}/src/events`)) - expect(fs.mkdirs).to.have.been.calledWithMatch(path.join(`${projectName}/src/entities`)) - expect(fs.mkdirs).to.have.been.calledWithMatch(path.join(`${projectName}/src/read-models`)) - expect(fs.mkdirs).to.have.been.calledWithMatch(path.join(`${projectName}/src/config`)) - expect(fs.mkdirs).to.have.been.calledWithMatch(path.join(`${projectName}/src/common`)) - expect(fs.mkdirs).to.have.been.calledWithMatch(path.join(`${projectName}/src/event-handlers`)) - expect(fs.mkdirs).to.have.been.calledWithMatch(path.join(`${projectName}/src/scheduled-commands`)) + expect(fs.mkdirs).to.have.been.calledWithMatch(path.normalize(`${projectName}/src/commands`)) + expect(fs.mkdirs).to.have.been.calledWithMatch(path.normalize(`${projectName}/src/events`)) + expect(fs.mkdirs).to.have.been.calledWithMatch(path.normalize(`${projectName}/src/entities`)) + expect(fs.mkdirs).to.have.been.calledWithMatch(path.normalize(`${projectName}/src/read-models`)) + expect(fs.mkdirs).to.have.been.calledWithMatch(path.normalize(`${projectName}/src/config`)) + expect(fs.mkdirs).to.have.been.calledWithMatch(path.normalize(`${projectName}/src/common`)) + expect(fs.mkdirs).to.have.been.calledWithMatch(path.normalize(`${projectName}/src/event-handlers`)) + expect(fs.mkdirs).to.have.been.calledWithMatch(path.normalize(`${projectName}/src/scheduled-commands`)) }) it('install dependencies', async () => { @@ -69,15 +69,15 @@ describe('project initializer', (): void => { it('Generate config files', async () => { await generateConfigFiles(defaultProjectInitializerConfig) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/.eslintignore`)) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/.eslintrc.js`)) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/.gitignore`)) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/package.json`)) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/tsconfig.json`)) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/tsconfig.eslint.json`)) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/.prettierrc.yaml`)) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/src/config/config.ts`)) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/src/index.ts`)) - expect(fs.outputFile).to.have.been.calledWithMatch(path.join(`${projectName}/.mocharc.yml`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize(`${projectName}/.eslintignore`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize(`${projectName}/.eslintrc.js`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize(`${projectName}/.gitignore`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize(`${projectName}/package.json`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize(`${projectName}/tsconfig.json`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize(`${projectName}/tsconfig.eslint.json`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize(`${projectName}/.prettierrc.yaml`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize(`${projectName}/src/config/config.ts`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize(`${projectName}/src/index.ts`)) + expect(fs.outputFile).to.have.been.calledWithMatch(path.normalize(`${projectName}/.mocharc.yml`)) }) }) diff --git a/packages/framework-provider-aws-infrastructure/test/infrastructure/stack-tools.test.ts b/packages/framework-provider-aws-infrastructure/test/infrastructure/stack-tools.test.ts index 2920b5836..6e3b98cbe 100644 --- a/packages/framework-provider-aws-infrastructure/test/infrastructure/stack-tools.test.ts +++ b/packages/framework-provider-aws-infrastructure/test/infrastructure/stack-tools.test.ts @@ -162,7 +162,7 @@ describe('the `stack-tools` module', () => { const fun: any = Object.values(stackResources).find((obj: any) => { return obj.Properties.FunctionName == 'testing-app-app-graphql-handler' }) - expect(fun.Properties.Handler).to.equal(path.join('dist/index.boosterServeGraphQL')) + expect(fun.Properties.Handler).to.equal(path.normalize('dist/index.boosterServeGraphQL')) }) }) diff --git a/packages/framework-provider-azure-infrastructure/test/infrastructure/functions/event-handler-functions.test.ts b/packages/framework-provider-azure-infrastructure/test/infrastructure/functions/event-handler-functions.test.ts index a2529fa16..bf3750e89 100644 --- a/packages/framework-provider-azure-infrastructure/test/infrastructure/functions/event-handler-functions.test.ts +++ b/packages/framework-provider-azure-infrastructure/test/infrastructure/functions/event-handler-functions.test.ts @@ -21,7 +21,7 @@ describe('Creating event-handler-functions', () => { expect(definition.config.bindings[0].databaseName).to.be.equal('new-booster-app-app') expect(definition.config.bindings[0].collectionName).to.be.equal('new-booster-app-app-events-store') expect(definition.config.bindings[0].createLeaseCollectionIfNotExists).to.be.equal('true') - expect(definition.config.scriptFile).to.be.equal(path.join('../dist/index.js')) + expect(definition.config.scriptFile).to.be.equal(path.normalize('../dist/index.js')) expect(definition.config.entryPoint).to.be.equal('boosterEventDispatcher') }) }) \ No newline at end of file diff --git a/packages/framework-provider-azure-infrastructure/test/infrastructure/functions/graphql-functions.test.ts b/packages/framework-provider-azure-infrastructure/test/infrastructure/functions/graphql-functions.test.ts index 58fb0372b..2af9f0cfb 100644 --- a/packages/framework-provider-azure-infrastructure/test/infrastructure/functions/graphql-functions.test.ts +++ b/packages/framework-provider-azure-infrastructure/test/infrastructure/functions/graphql-functions.test.ts @@ -22,7 +22,7 @@ describe('Creating graphql-functions', () => { expect(definition.config.bindings[1].type).to.be.equal('http') expect(definition.config.bindings[1].name).to.be.equal('$return') expect(definition.config.bindings[1].direction).to.be.equal('out') - expect(definition.config.scriptFile).to.be.equal(path.join('../dist/index.js')) + expect(definition.config.scriptFile).to.be.equal(path.normalize('../dist/index.js')) expect(definition.config.entryPoint).to.be.equal('boosterServeGraphQL') }) }) diff --git a/packages/framework-provider-azure-infrastructure/test/infrastructure/functions/schedules-functions.test.ts b/packages/framework-provider-azure-infrastructure/test/infrastructure/functions/schedules-functions.test.ts index 2e01d4fc6..79162b7bf 100644 --- a/packages/framework-provider-azure-infrastructure/test/infrastructure/functions/schedules-functions.test.ts +++ b/packages/framework-provider-azure-infrastructure/test/infrastructure/functions/schedules-functions.test.ts @@ -112,7 +112,7 @@ describe('Creating scheduled-functions', () => { expect(definition.config.bindings[0].name).to.be.equal(scheduleCommandName) expect(definition.config.bindings[0].direction).to.be.equal('in') expect(definition.config.bindings[0].schedule).to.be.equal(nCronTabExpression) - expect(definition.config.scriptFile).to.be.equal(path.join('../dist/index.js')) + expect(definition.config.scriptFile).to.be.equal(path.normalize('../dist/index.js')) expect(definition.config.entryPoint).to.be.equal('boosterTriggerScheduledCommand') } From bf71ab67109bc2fa58bdfc878922596f1935a229 Mon Sep 17 00:00:00 2001 From: nicolatl <77587217+nicolatl@users.noreply.github.com> Date: Tue, 13 Dec 2022 16:46:51 -0500 Subject: [PATCH 3/3] perf: undo aws-infrastructure timeout change Co-authored-by: Javier Toledo --- packages/framework-provider-aws-infrastructure/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/framework-provider-aws-infrastructure/package.json b/packages/framework-provider-aws-infrastructure/package.json index ccac7d9aa..4804f4cf6 100644 --- a/packages/framework-provider-aws-infrastructure/package.json +++ b/packages/framework-provider-aws-infrastructure/package.json @@ -59,7 +59,7 @@ "clean": "rimraf ./dist tsconfig.tsbuildinfo", "prepack": "tsc -b tsconfig.json", "test:provider-aws-infrastructure": "npm run test", - "test": "nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\" --timeout 600000" + "test": "nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\"" }, "bugs": { "url": "https://github.com/boostercloud/booster/issues"