From ce073a3664820462fc4a2411966ddddf4b70bad9 Mon Sep 17 00:00:00 2001 From: Haresh Nasit Date: Mon, 21 Oct 2024 16:22:00 -0700 Subject: [PATCH 1/2] feat: Add nodejs22.x support --- .github/workflows/build.yml | 4 +- aws_lambda_builders/validator.py | 1 + .../workflows/nodejs_npm/test_nodejs_npm.py | 50 ++++++++++--------- .../test_nodejs_npm_with_esbuild.py | 46 ++++++++--------- 4 files changed, 52 insertions(+), 49 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d18d33bda..2d0f997f2 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 @@ -133,7 +133,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/validator.py b/aws_lambda_builders/validator.py index 641bef650..0bd6e7583 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/tests/integration/workflows/nodejs_npm/test_nodejs_npm.py b/tests/integration/workflows/nodejs_npm/test_nodejs_npm.py index d27f8a2d6..5db252913 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,14 @@ 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"), - ("nodejs16.x", "package-lock-and-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 +171,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 +186,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 +204,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 +234,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 +255,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 +282,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 +311,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 +351,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 +380,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 +415,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 +448,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 +504,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 +527,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 +574,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 +599,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 +628,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 +656,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 +711,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 +743,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 81f832da4..4a759f13b 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") From ca58813aa7d9cc8b0d4e5d6580daf36287a12f21 Mon Sep 17 00:00:00 2001 From: Haresh Nasit Date: Mon, 21 Oct 2024 16:25:06 -0700 Subject: [PATCH 2/2] Add missing comma to integ test --- tests/integration/workflows/nodejs_npm/test_nodejs_npm.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/integration/workflows/nodejs_npm/test_nodejs_npm.py b/tests/integration/workflows/nodejs_npm/test_nodejs_npm.py index 5db252913..bfb7f0ecb 100644 --- a/tests/integration/workflows/nodejs_npm/test_nodejs_npm.py +++ b/tests/integration/workflows/nodejs_npm/test_nodejs_npm.py @@ -141,7 +141,8 @@ def test_builds_project_with_npmrc(self, runtime): ("nodejs16.x", "shrinkwrap"), ("nodejs18.x", "shrinkwrap"), ("nodejs20.x", "shrinkwrap"), - ("nodejs22.x", "shrinkwrap")("nodejs16.x", "package-lock-and-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"),