Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def run(self, args, cwd=None):
"target",
"format",
"main_fields",
"sources_content",
]

# Multi-value types (--external:axios --external:aws-sdk)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import json
import os
import shutil
import tempfile
Expand Down Expand Up @@ -414,6 +415,29 @@ 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([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.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"}

self.builder.build(
source_dir,
self.artifacts_dir,
self.scratch_dir,
os.path.join(source_dir, "package.json"),
runtime=runtime,
options=options,
experimental_flags=[],
executable_search_paths=[self.binpath],
)

expected_files = {"included.js", "included.js.map"}
output_files = set(os.listdir(self.artifacts_dir))
with open(Path(self.artifacts_dir, "included.js.map")) as f:
sourcemap = json.load(f)
self.assertNotIn("sourcesContent", sourcemap)
self.assertEqual(expected_files, output_files)

@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",)])
def test_esbuild_can_build_in_source(self, runtime):
options = {"entry_points": ["included.js"]}
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/workflows/nodejs_npm_esbuild/test_esbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ def test_builds_args_from_config(self, osutils_mock):
bundler_config = {
"minify": True,
"sourcemap": False,
"sources_content": "false",
"format": "esm",
"target": "node14",
"loader": [".proto=text", ".json=js"],
Expand All @@ -216,6 +217,7 @@ def test_builds_args_from_config(self, osutils_mock):
"--target=node14",
"--format=esm",
"--main-fields=module,main",
"--sources-content=false",
"--external:aws-sdk",
"--external:axios",
"--loader:.proto=text",
Expand Down