-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
92 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 [email protected]", 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 | ||
): | ||
|
Oops, something went wrong.