diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 763ff55a..2a1e9ad0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -100,7 +100,7 @@ jobs: python-version: ${{ matrix.python }} - uses: actions/setup-node@v4 with: - node-version: 20 + node-version: 22 - if: ${{ matrix.npm }} run: npm install -g npm@${{ matrix.npm }} - run: npm --version @@ -134,7 +134,7 @@ jobs: python-version: ${{ matrix.python }} - uses: actions/setup-node@v4 with: - node-version: 20 + node-version: 22 - if: ${{ matrix.npm }} run: npm install -g npm@${{ matrix.npm }} - run: npm --version diff --git a/aws_lambda_builders/__init__.py b/aws_lambda_builders/__init__.py index 60a00624..6c3c410f 100644 --- a/aws_lambda_builders/__init__.py +++ b/aws_lambda_builders/__init__.py @@ -5,5 +5,5 @@ # Changing version will trigger a new release! # Please make the version change as the last step of your development. -__version__ = "1.51.0" +__version__ = "1.52.0" RPC_PROTOCOL_VERSION = "0.3" diff --git a/aws_lambda_builders/validator.py b/aws_lambda_builders/validator.py index adee8d7e..d66f7293 100644 --- a/aws_lambda_builders/validator.py +++ b/aws_lambda_builders/validator.py @@ -13,6 +13,7 @@ "nodejs16.x": [ARM64, X86_64], "nodejs18.x": [ARM64, X86_64], "nodejs20.x": [ARM64, X86_64], + "nodejs22.x": [ARM64, X86_64], "python3.8": [ARM64, X86_64], "python3.9": [ARM64, X86_64], "python3.10": [ARM64, X86_64], diff --git a/aws_lambda_builders/workflows/java_gradle/gradle_validator.py b/aws_lambda_builders/workflows/java_gradle/gradle_validator.py index 2972e75b..5107b9c2 100644 --- a/aws_lambda_builders/workflows/java_gradle/gradle_validator.py +++ b/aws_lambda_builders/workflows/java_gradle/gradle_validator.py @@ -83,5 +83,5 @@ def _get_jvm_string(self, gradle_path): for line in stdout.splitlines(): l_dec = decode(line) - if l_dec.startswith("JVM"): + if "JVM" in l_dec: return l_dec diff --git a/requirements/dev.txt b/requirements/dev.txt index 69661214..e74301d2 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1,7 +1,8 @@ -coverage==7.6.4; python_version>="3.9" +coverage==7.6.7; python_version>="3.9" coverage==7.6.1; python_version<"3.9" flake8==3.8.4 -pytest-cov==5.0.0 +pytest-cov==6.0.0; python_version>="3.9" +pytest-cov==5.0.0; python_version<"3.9" # Test requirements pytest>=6.1.1 @@ -11,4 +12,4 @@ pyelftools~=0.31 # Used to verify the generated Go binary architecture in integr # formatter black==24.10.0; python_version>="3.9" black==24.8.0; python_version<"3.9" -ruff==0.7.1 +ruff==0.7.4 diff --git a/tests/integration/workflows/nodejs_npm/test_nodejs_npm.py b/tests/integration/workflows/nodejs_npm/test_nodejs_npm.py index d27f8a2d..bfb7f0ec 100644 --- a/tests/integration/workflows/nodejs_npm/test_nodejs_npm.py +++ b/tests/integration/workflows/nodejs_npm/test_nodejs_npm.py @@ -41,7 +41,7 @@ def tearDown(self): shutil.rmtree(self.dependencies_dir) shutil.rmtree(self.temp_dir) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_builds_project_without_dependencies(self, runtime): source_dir = os.path.join(self.TEST_DATA_FOLDER, "no-deps") @@ -75,7 +75,7 @@ def test_builds_project_without_manifest(self, runtime): mock_warning.assert_called_once_with("package.json file not found. Continuing the build without dependencies.") self.assertEqual(expected_files, output_files) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_builds_project_and_excludes_hidden_aws_sam(self, runtime): source_dir = os.path.join(self.TEST_DATA_FOLDER, "excluded-files") @@ -91,7 +91,7 @@ def test_builds_project_and_excludes_hidden_aws_sam(self, runtime): output_files = set(os.listdir(self.artifacts_dir)) self.assertEqual(expected_files, output_files) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_builds_project_with_remote_dependencies(self, runtime): source_dir = os.path.join(self.TEST_DATA_FOLDER, "npm-deps") @@ -111,7 +111,7 @@ def test_builds_project_with_remote_dependencies(self, runtime): output_modules = set(os.listdir(os.path.join(self.artifacts_dir, "node_modules"))) self.assertEqual(expected_modules, output_modules) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_builds_project_with_npmrc(self, runtime): source_dir = os.path.join(self.TEST_DATA_FOLDER, "npmrc") @@ -137,12 +137,15 @@ def test_builds_project_with_npmrc(self, runtime): ("nodejs16.x", "package-lock"), ("nodejs18.x", "package-lock"), ("nodejs20.x", "package-lock"), + ("nodejs22.x", "package-lock"), ("nodejs16.x", "shrinkwrap"), ("nodejs18.x", "shrinkwrap"), ("nodejs20.x", "shrinkwrap"), + ("nodejs22.x", "shrinkwrap"), ("nodejs16.x", "package-lock-and-shrinkwrap"), ("nodejs18.x", "package-lock-and-shrinkwrap"), ("nodejs20.x", "package-lock-and-shrinkwrap"), + ("nodejs22.x", "package-lock-and-shrinkwrap"), ] ) def test_builds_project_with_lockfile(self, runtime, dir_name): @@ -169,7 +172,7 @@ def test_builds_project_with_lockfile(self, runtime, dir_name): self.assertEqual(expected_files, output_files) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_fails_if_npm_cannot_resolve_dependencies(self, runtime): source_dir = os.path.join(self.TEST_DATA_FOLDER, "broken-deps") @@ -184,7 +187,7 @@ def test_fails_if_npm_cannot_resolve_dependencies(self, runtime): self.assertIn("No matching version found for aws-sdk@2.997.999", str(ctx.exception)) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_builds_project_with_remote_dependencies_without_download_dependencies_with_dependencies_dir(self, runtime): source_dir = os.path.join(self.TEST_DATA_FOLDER, "npm-deps") @@ -202,7 +205,7 @@ def test_builds_project_with_remote_dependencies_without_download_dependencies_w output_files = set(os.listdir(self.artifacts_dir)) self.assertEqual(expected_files, output_files) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_builds_project_with_remote_dependencies_with_download_dependencies_and_dependencies_dir(self, runtime): source_dir = os.path.join(self.TEST_DATA_FOLDER, "npm-deps") @@ -232,7 +235,7 @@ def test_builds_project_with_remote_dependencies_with_download_dependencies_and_ output_dependencies_files = set(os.listdir(os.path.join(self.dependencies_dir))) self.assertNotIn(expected_dependencies_files, output_dependencies_files) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_builds_project_with_remote_dependencies_without_download_dependencies_without_dependencies_dir( self, runtime ): @@ -253,7 +256,7 @@ def test_builds_project_with_remote_dependencies_without_download_dependencies_w output_files = set(os.listdir(self.artifacts_dir)) self.assertEqual(expected_files, output_files) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_builds_project_without_combine_dependencies(self, runtime): source_dir = os.path.join(self.TEST_DATA_FOLDER, "npm-deps") @@ -280,7 +283,7 @@ def test_builds_project_without_combine_dependencies(self, runtime): output_dependencies_files = set(os.listdir(os.path.join(self.dependencies_dir))) self.assertNotIn(expected_dependencies_files, output_dependencies_files) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_build_in_source_with_download_dependencies(self, runtime): source_dir = os.path.join(self.temp_testdata_dir, "npm-deps") @@ -309,7 +312,7 @@ def test_build_in_source_with_download_dependencies(self, runtime): output_files = set(os.listdir(self.artifacts_dir)) self.assertEqual(expected_files, output_files) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_build_in_source_with_removed_dependencies(self, runtime): # run a build with default requirements and confirm dependencies are downloaded source_dir = os.path.join(self.temp_testdata_dir, "npm-deps") @@ -349,7 +352,7 @@ def test_build_in_source_with_removed_dependencies(self, runtime): self.assertIn(".package-lock.json", set(os.listdir(source_node_modules))) self.assertNotIn("minimal-request-promise", set(os.listdir(source_node_modules))) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_build_in_source_with_download_dependencies_local_dependency(self, runtime): source_dir = os.path.join(self.temp_testdata_dir, "with-local-dependency") @@ -378,7 +381,7 @@ def test_build_in_source_with_download_dependencies_local_dependency(self, runti output_files = set(os.listdir(self.artifacts_dir)) self.assertEqual(expected_files, output_files) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_build_in_source_with_download_dependencies_and_dependencies_dir(self, runtime): source_dir = os.path.join(self.temp_testdata_dir, "npm-deps") @@ -413,7 +416,7 @@ def test_build_in_source_with_download_dependencies_and_dependencies_dir(self, r output_files = set(os.listdir(self.artifacts_dir)) self.assertEqual(expected_files, output_files) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_build_in_source_with_download_dependencies_and_dependencies_dir_without_combine_dependencies( self, runtime ): @@ -446,7 +449,7 @@ def test_build_in_source_with_download_dependencies_and_dependencies_dir_without output_files = set(os.listdir(self.artifacts_dir)) self.assertEqual(expected_files, output_files) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_build_in_source_reuse_saved_dependencies_dir(self, runtime): source_dir = os.path.join(self.temp_testdata_dir, "npm-deps") @@ -502,7 +505,7 @@ def test_build_in_source_reuse_saved_dependencies_dir(self, runtime): output_files = set(os.listdir(self.artifacts_dir)) self.assertEqual(expected_files, output_files) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_builds_project_with_manifest_outside_root(self, runtime): base_dir = os.path.join(self.temp_testdata_dir, "manifest-outside-root") source_dir = os.path.join(base_dir, "src") @@ -525,7 +528,7 @@ def test_builds_project_with_manifest_outside_root(self, runtime): output_modules = set(os.listdir(os.path.join(self.artifacts_dir, "node_modules"))) self.assertEqual(expected_modules, output_modules) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_builds_project_with_manifest_outside_root_with_reuse_saved_dependencies_dir(self, runtime): base_dir = os.path.join(self.temp_testdata_dir, "manifest-outside-root") source_dir = os.path.join(base_dir, "src") @@ -572,7 +575,7 @@ def test_builds_project_with_manifest_outside_root_with_reuse_saved_dependencies output_modules = set(os.listdir(os.path.join(self.artifacts_dir, "node_modules"))) self.assertEqual(expected_modules, output_modules) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_builds_project_with_manifest_outside_root_with_dependencies_dir_and_not_combine(self, runtime): base_dir = os.path.join(self.temp_testdata_dir, "manifest-outside-root") source_dir = os.path.join(base_dir, "src") @@ -597,7 +600,7 @@ def test_builds_project_with_manifest_outside_root_with_dependencies_dir_and_not dependencies_dir_modules = set(os.listdir(os.path.join(self.dependencies_dir, "node_modules"))) self.assertEqual(expected_modules, dependencies_dir_modules) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_builds_project_with_manifest_outside_root_with_dependencies_dir_and_combine(self, runtime): base_dir = os.path.join(self.temp_testdata_dir, "manifest-outside-root") source_dir = os.path.join(base_dir, "src") @@ -626,7 +629,7 @@ def test_builds_project_with_manifest_outside_root_with_dependencies_dir_and_com dependencies_dir_modules = set(os.listdir(os.path.join(self.dependencies_dir, "node_modules"))) self.assertEqual(expected_modules, dependencies_dir_modules) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_builds_project_with_manifest_outside_root_and_local_dependencies(self, runtime): base_dir = os.path.join(self.temp_testdata_dir, "manifest-outside-root-with-local-dependency") source_dir = os.path.join(base_dir, "src") @@ -654,7 +657,7 @@ def test_builds_project_with_manifest_outside_root_and_local_dependencies(self, source_modules = set(os.listdir(os.path.join(source_dir, "node_modules"))) self.assertTrue(all(expected_module in source_modules for expected_module in expected_modules)) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_builds_project_with_manifest_outside_root_and_local_dependencies_with_reuse_saved_dependencies_dir( self, runtime ): @@ -709,7 +712,7 @@ def test_builds_project_with_manifest_outside_root_and_local_dependencies_with_r source_modules = set(os.listdir(os.path.join(source_dir, "node_modules"))) self.assertTrue(all(expected_module in source_modules for expected_module in expected_modules)) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_builds_project_with_manifest_outside_root_and_local_dependencies_with_dependencies_dir_and_not_combine( self, runtime ): @@ -741,7 +744,7 @@ def test_builds_project_with_manifest_outside_root_and_local_dependencies_with_d source_modules = set(os.listdir(os.path.join(source_dir, "node_modules"))) self.assertTrue(all(expected_module in source_modules for expected_module in expected_modules)) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_builds_project_with_manifest_outside_root_and_local_dependencies_with_dependencies_dir_and_combine( self, runtime ): diff --git a/tests/integration/workflows/nodejs_npm_esbuild/test_nodejs_npm_with_esbuild.py b/tests/integration/workflows/nodejs_npm_esbuild/test_nodejs_npm_with_esbuild.py index 81f832da..4a759f13 100644 --- a/tests/integration/workflows/nodejs_npm_esbuild/test_nodejs_npm_with_esbuild.py +++ b/tests/integration/workflows/nodejs_npm_esbuild/test_nodejs_npm_with_esbuild.py @@ -52,7 +52,7 @@ def tearDown(self): if os.path.exists(source_dependencies): shutil.rmtree(source_dependencies) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_builds_javascript_project_with_dependencies(self, runtime): source_dir = os.path.join(self.TEST_DATA_FOLDER, "with-deps-esbuild") @@ -73,7 +73,7 @@ def test_builds_javascript_project_with_dependencies(self, runtime): output_files = set(os.listdir(self.artifacts_dir)) self.assertEqual(expected_files, output_files) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_builds_javascript_project_with_multiple_entrypoints(self, runtime): source_dir = os.path.join(self.TEST_DATA_FOLDER, "with-deps-esbuild-multiple-entrypoints") @@ -94,7 +94,7 @@ def test_builds_javascript_project_with_multiple_entrypoints(self, runtime): output_files = set(os.listdir(self.artifacts_dir)) self.assertEqual(expected_files, output_files) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_builds_typescript_projects(self, runtime): source_dir = os.path.join(self.TEST_DATA_FOLDER, "with-deps-esbuild-typescript") @@ -115,7 +115,7 @@ def test_builds_typescript_projects(self, runtime): output_files = set(os.listdir(self.artifacts_dir)) self.assertEqual(expected_files, output_files) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_builds_with_external_esbuild(self, runtime): source_dir = os.path.join(self.TEST_DATA_FOLDER, "no-deps-esbuild") options = {"entry_points": ["included.js"]} @@ -135,7 +135,7 @@ def test_builds_with_external_esbuild(self, runtime): output_files = set(os.listdir(self.artifacts_dir)) self.assertEqual(expected_files, output_files) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_no_options_passed_to_esbuild(self, runtime): source_dir = os.path.join(self.TEST_DATA_FOLDER, "with-deps-esbuild") @@ -152,7 +152,7 @@ def test_no_options_passed_to_esbuild(self, runtime): self.assertEqual(str(context.exception), "NodejsNpmEsbuildBuilder:EsbuildBundle - entry_points not set ({})") - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_bundle_with_implicit_file_types(self, runtime): source_dir = os.path.join(self.TEST_DATA_FOLDER, "implicit-file-types") @@ -173,7 +173,7 @@ def test_bundle_with_implicit_file_types(self, runtime): output_files = set(os.listdir(self.artifacts_dir)) self.assertEqual(expected_files, output_files) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_bundles_project_without_dependencies(self, runtime): source_dir = os.path.join(self.TEST_DATA_FOLDER, "no-package-esbuild") options = {"entry_points": ["included"]} @@ -199,7 +199,7 @@ def test_bundles_project_without_dependencies(self, runtime): output_files = set(os.listdir(self.artifacts_dir)) self.assertEqual(expected_files, output_files) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_builds_project_with_remote_dependencies_without_download_dependencies_with_dependencies_dir(self, runtime): source_dir = os.path.join(self.TEST_DATA_FOLDER, "with-deps-no-node_modules") options = {"entry_points": ["included.js"]} @@ -227,7 +227,7 @@ def test_builds_project_with_remote_dependencies_without_download_dependencies_w output_files = set(os.listdir(self.artifacts_dir)) self.assertEqual(expected_files, output_files) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_builds_project_with_remote_dependencies_with_download_dependencies_and_dependencies_dir(self, runtime): source_dir = os.path.join(self.TEST_DATA_FOLDER, "with-deps-no-node_modules") options = {"entry_points": ["included.js"]} @@ -257,7 +257,7 @@ def test_builds_project_with_remote_dependencies_with_download_dependencies_and_ output_dependencies_files = set(os.listdir(os.path.join(self.dependencies_dir))) self.assertNotIn(expected_dependencies_files, output_dependencies_files) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_builds_project_with_remote_dependencies_without_download_dependencies_without_dependencies_dir( self, runtime ): @@ -282,7 +282,7 @@ def test_builds_project_with_remote_dependencies_without_download_dependencies_w "dependencies directory was not provided and downloading dependencies is disabled.", ) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_builds_project_without_combine_dependencies(self, runtime): source_dir = os.path.join(self.TEST_DATA_FOLDER, "with-deps-no-node_modules") options = {"entry_points": ["included.js"]} @@ -313,7 +313,7 @@ def test_builds_project_without_combine_dependencies(self, runtime): output_dependencies_files = set(os.listdir(os.path.join(self.dependencies_dir))) self.assertNotIn(expected_dependencies_files, output_dependencies_files) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_builds_javascript_project_with_external(self, runtime): source_dir = os.path.join(self.TEST_DATA_FOLDER, "with-deps-esbuild-externals") @@ -338,7 +338,7 @@ def test_builds_javascript_project_with_external(self, runtime): # Check that the module has been require() instead of bundled self.assertIn('require("minimal-request-promise")', js_file) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_builds_javascript_project_with_loader(self, runtime): osutils = OSUtils() source_dir = os.path.join(self.TEST_DATA_FOLDER, "no-deps-esbuild-loader") @@ -380,7 +380,7 @@ def test_builds_javascript_project_with_loader(self, runtime): ), ) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_includes_sourcemap_if_requested(self, runtime): source_dir = os.path.join(self.TEST_DATA_FOLDER, "with-deps-esbuild") @@ -401,7 +401,7 @@ def test_includes_sourcemap_if_requested(self, runtime): output_files = set(os.listdir(self.artifacts_dir)) self.assertEqual(expected_files, output_files) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_esbuild_produces_mjs_output_files(self, runtime): source_dir = os.path.join(self.TEST_DATA_FOLDER, "with-deps-esbuild") options = {"entry_points": ["included.js"], "sourcemap": True, "out_extension": [".js=.mjs"]} @@ -421,7 +421,7 @@ def test_esbuild_produces_mjs_output_files(self, runtime): output_files = set(os.listdir(self.artifacts_dir)) self.assertEqual(expected_files, output_files) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_esbuild_produces_sourcemap_without_source_contents(self, runtime): source_dir = os.path.join(self.TEST_DATA_FOLDER, "with-deps-esbuild") options = {"entry_points": ["included.js"], "sourcemap": True, "sources_content": "false"} @@ -444,7 +444,7 @@ def test_esbuild_produces_sourcemap_without_source_contents(self, runtime): self.assertNotIn("sourcesContent", sourcemap) self.assertEqual(expected_files, output_files) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_esbuild_can_build_in_source(self, runtime): options = {"entry_points": ["included.js"]} @@ -470,7 +470,7 @@ def test_esbuild_can_build_in_source(self, runtime): output_files = set(os.listdir(self.artifacts_dir)) self.assertEqual(expected_files, output_files) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_esbuild_can_build_in_source_with_local_dependency(self, runtime): self.source_dir = os.path.join(self.TEST_DATA_FOLDER, "with-local-dependency") @@ -498,7 +498,7 @@ def test_esbuild_can_build_in_source_with_local_dependency(self, runtime): output_files = set(os.listdir(self.artifacts_dir)) self.assertEqual(expected_files, output_files) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_builds_javascript_project_ignoring_relevant_flags(self, runtime): source_dir = os.path.join(self.TEST_DATA_FOLDER, "with-deps-esbuild") @@ -519,7 +519,7 @@ def test_builds_javascript_project_ignoring_relevant_flags(self, runtime): output_files = set(os.listdir(self.artifacts_dir)) self.assertEqual(expected_files, output_files) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_builds_typescript_projects_with_external_manifest(self, runtime): base_dir = os.path.join(self.TEST_DATA_FOLDER, "esbuild-manifest-outside-root") source_dir = os.path.join(base_dir, "src") @@ -541,7 +541,7 @@ def test_builds_typescript_projects_with_external_manifest(self, runtime): output_files = set(os.listdir(self.artifacts_dir)) self.assertEqual(expected_files, output_files) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_builds_typescript_projects_with_external_manifest_with_dependencies_dir_without_combine(self, runtime): base_dir = os.path.join(self.TEST_DATA_FOLDER, "esbuild-manifest-outside-root") source_dir = os.path.join(base_dir, "src") @@ -570,7 +570,7 @@ def test_builds_typescript_projects_with_external_manifest_with_dependencies_dir output_modules = set(os.listdir(os.path.join(self.dependencies_dir, "node_modules"))) self.assertIn(expected_modules, output_modules) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_builds_typescript_projects_with_external_manifest_with_dependencies_dir_with_combine(self, runtime): base_dir = os.path.join(self.TEST_DATA_FOLDER, "esbuild-manifest-outside-root") source_dir = os.path.join(base_dir, "src") @@ -599,7 +599,7 @@ def test_builds_typescript_projects_with_external_manifest_with_dependencies_dir output_modules = set(os.listdir(os.path.join(self.dependencies_dir, "node_modules"))) self.assertIn(expected_modules, output_modules) - @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)]) + @parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)]) def test_builds_typescript_projects_with_external_manifest_and_local_depends(self, runtime): base_dir = os.path.join(self.temp_testdata_dir, "esbuild-manifest-outside-root-with-local-depends") source_dir = os.path.join(base_dir, "src") diff --git a/tests/unit/workflows/java_gradle/test_gradle_validator.py b/tests/unit/workflows/java_gradle/test_gradle_validator.py index 2815b4f6..f51bf5c9 100644 --- a/tests/unit/workflows/java_gradle/test_gradle_validator.py +++ b/tests/unit/workflows/java_gradle/test_gradle_validator.py @@ -78,6 +78,40 @@ def test_emits_warning_when_version_string_not_found(self): validator.validate(runtime_path=self.runtime_path) self.mock_log.warning.assert_called_with(GradleValidator.VERSION_STRING_WARNING, self.runtime_path) + @parameterized.expand( + [ + ("1.8.0", "java8"), + ("11.0.0", "java11"), + ("17.0.0", "java17"), + ("21.0.0", "java21"), + ] + ) + def test_does_not_emit_warning_for_version_string_in_gradle_lt_8_9(self, version, runtime): + version_string = f"JVM: {version}".encode() + self.mock_os_utils.popen.side_effect = [FakePopen(stdout=version_string, returncode=0)] + validator = GradleValidator( + runtime=runtime, architecture=self.architecture, os_utils=self.mock_os_utils, log=self.mock_log + ) + validator.validate(runtime_path=self.runtime_path) + self.mock_log.warning.assert_not_called() + + @parameterized.expand( + [ + ("1.8.0", "java8"), + ("11.0.0", "java11"), + ("17.0.0", "java17"), + ("21.0.0", "java21"), + ] + ) + def test_does_not_emit_warning_for_version_string_in_gradle_ge_8_9(self, version, runtime): + version_string = f"Launcher JVM: {version}".encode() + self.mock_os_utils.popen.side_effect = [FakePopen(stdout=version_string, returncode=0)] + validator = GradleValidator( + runtime=runtime, architecture=self.architecture, os_utils=self.mock_os_utils, log=self.mock_log + ) + validator.validate(runtime_path=self.runtime_path) + self.mock_log.warning.assert_not_called() + @parameterized.expand( [ ("11.0.0", "java11"),