-
-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: remove npm_translate_lock(use_starlark_yaml_parser) (#1658)
- Loading branch information
1 parent
aa93b55
commit 87eba91
Showing
12 changed files
with
24 additions
and
1,325 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 |
---|---|---|
|
@@ -6,55 +6,18 @@ load("//npm/private:utils.bzl", "utils") | |
def _parse_empty_lock_test_impl(ctx): | ||
env = unittest.begin(ctx) | ||
|
||
parsed_yaml = utils.parse_pnpm_lock_yaml("") | ||
parsed_json_a = utils.parse_pnpm_lock_json("") | ||
parsed_json_b = utils.parse_pnpm_lock_json("{}") | ||
expected = ({}, {}, {}, None) | ||
|
||
asserts.equals(env, expected, parsed_yaml) | ||
asserts.equals(env, expected, parsed_json_a) | ||
asserts.equals(env, expected, parsed_json_b) | ||
|
||
return unittest.end(env) | ||
|
||
def _parse_merge_conflict_test_impl(ctx): | ||
env = unittest.begin(ctx) | ||
|
||
parsed = utils.parse_pnpm_lock_yaml(""" | ||
importers: | ||
.: | ||
dependencies: | ||
<<<<< HEAD""") | ||
expected = ({}, {}, {}, "expected lockfileVersion key in lockfile") | ||
|
||
asserts.equals(env, expected, parsed) | ||
|
||
return unittest.end(env) | ||
|
||
def _parse_lockfile_v5_test_impl(ctx): | ||
env = unittest.begin(ctx) | ||
|
||
parsed_yaml = utils.parse_pnpm_lock_yaml("""\ | ||
lockfileVersion: 5.4 | ||
specifiers: | ||
'@aspect-test/a': 5.0.0 | ||
dependencies: | ||
'@aspect-test/a': 5.0.0 | ||
packages: | ||
/@aspect-test/a/5.0.0: | ||
resolution: {integrity: sha512-t/lwpVXG/jmxTotGEsmjwuihC2Lvz/Iqt63o78SI3O5XallxtFp5j2WM2M6HwkFiii9I42KdlAF8B3plZMz0Fw==} | ||
hasBin: true | ||
dependencies: | ||
'@aspect-test/b': 5.0.0 | ||
'@aspect-test/c': 1.0.0 | ||
'@aspect-test/d': 2.0.0_@[email protected] | ||
dev: false | ||
""") | ||
|
||
parsed_json = utils.parse_pnpm_lock_json("""\ | ||
{ | ||
"lockfileVersion": 5.4, | ||
|
@@ -109,34 +72,13 @@ packages: | |
None, | ||
) | ||
|
||
asserts.equals(env, expected, parsed_yaml) | ||
asserts.equals(env, expected, parsed_json) | ||
|
||
return unittest.end(env) | ||
|
||
def _parse_lockfile_v6_test_impl(ctx): | ||
env = unittest.begin(ctx) | ||
|
||
parsed_yaml = utils.parse_pnpm_lock_yaml("""\ | ||
lockfileVersion: '6.0' | ||
dependencies: | ||
'@aspect-test/a': | ||
specifier: 5.0.0 | ||
version: 5.0.0 | ||
packages: | ||
/@aspect-test/[email protected]: | ||
resolution: {integrity: sha512-t/lwpVXG/jmxTotGEsmjwuihC2Lvz/Iqt63o78SI3O5XallxtFp5j2WM2M6HwkFiii9I42KdlAF8B3plZMz0Fw==} | ||
hasBin: true | ||
dependencies: | ||
'@aspect-test/b': 5.0.0 | ||
'@aspect-test/c': 1.0.0 | ||
'@aspect-test/d': 2.0.0(@aspect-test/[email protected]) | ||
dev: false | ||
""") | ||
|
||
parsed_json = utils.parse_pnpm_lock_json("""\ | ||
{ | ||
"lockfileVersion": "6.0", | ||
|
@@ -192,21 +134,18 @@ packages: | |
None, | ||
) | ||
|
||
asserts.equals(env, expected, parsed_yaml) | ||
asserts.equals(env, expected, parsed_json) | ||
|
||
return unittest.end(env) | ||
|
||
a_test = unittest.make(_parse_empty_lock_test_impl, attrs = {}) | ||
b_test = unittest.make(_parse_lockfile_v5_test_impl, attrs = {}) | ||
c_test = unittest.make(_parse_lockfile_v6_test_impl, attrs = {}) | ||
d_test = unittest.make(_parse_merge_conflict_test_impl, attrs = {}) | ||
|
||
TESTS = [ | ||
a_test, | ||
b_test, | ||
c_test, | ||
d_test, | ||
] | ||
|
||
def parse_pnpm_lock_tests(name): | ||
|
Oops, something went wrong.