ancient-vegetable-10556
11/14/2023, 6:41 PMancient-vegetable-10556
11/14/2023, 6:42 PMtest script in the package.json. pants peek shows the _node_test_script field being registered correctly, but pants test :: doesn't appear to run anythingbroad-processor-92400
11/14/2023, 7:49 PMancient-vegetable-10556
11/14/2023, 7:49 PMworried-painter-31382
11/14/2023, 8:48 PMadhoc_tools goodies.
I'm also worried about the reports of processes becoming sad because a file was open / written to / already existed between parallell runs of npm, e.g https://github.com/pantsbuild/pants/issues/20062. Not really related the JS backend work per se, but will probably be a wart showing up there as well.ancient-vegetable-10556
11/14/2023, 10:04 PMpackage.json. Is that doable at the moment?ancient-vegetable-10556
11/14/2023, 10:09 PMancient-vegetable-10556
11/14/2023, 10:21 PMI’m similar to you, with a typescript code base. Should we have a goal of getting testing working? And then going from there?I think that would be a useful goal in the medium term. My immediate want is to get Pants integrated into our CI more generally (we have codegen from a Django codebase that I'd prefer to have Pants transparently drop into the build process), but actually useful test running will be useful
ancient-vegetable-10556
11/14/2023, 10:22 PMbroad-processor-92400
11/15/2023, 12:25 AMexport ... from ... so I'm happy to take that one on, and I imagine it'll be a good way for me to start poking at some of the moving parts here. I've assigned #19819 to myself, hope that's okay.ancient-vegetable-10556
11/15/2023, 12:26 AMbroad-processor-92400
11/15/2023, 12:30 AMancient-vegetable-10556
11/15/2023, 12:33 AMtest script defined in package.json?ancient-vegetable-10556
11/15/2023, 12:40 AMancient-vegetable-10556
11/15/2023, 12:40 AMworried-painter-31382
11/15/2023, 6:26 AMnode_test_script build symbol, pants defaults to guessing the "test" script is what you want. Pants has a requirement here that the script should accept file paths as variadic args. Coverage reports and "batching" is supportedworried-painter-31382
11/15/2023, 6:34 AMfresh-cat-90827
11/15/2023, 10:35 AMts_source and ts_test. I was able to use the JS parser OOTB with a couple of rules like this
@rule("Generic rule to infer dependencies of TypeScript targets.")
async def infer_typescript_dependencies(
request_wrapper: RequestWrapper,
) -> InferredTypeScriptDependencies:
"""Infer dependencies for TypeScript targets."""
and
metadata = await _prepare_inference_metadata(request_wrapper.request.field_set.address)
import_strings = await Get(
NativeParsedJavascriptDependencies,
NativeDependenciesRequest(sources.snapshot.digest, metadata),
)
The TS code is separate in our repo, so it was well contained and easy to reason about. I only had to add the mapping, what Tobias mentioned before:
path_mapping_digest = await Get(Digest, PathGlobs(["our-ts-code-dir/tsconfig.base.json"]))fresh-cat-90827
11/15/2023, 10:36 AMancient-vegetable-10556
11/15/2023, 1:59 PMfresh-cat-90827
11/17/2023, 4:59 PMts_source and ts_test targets? If so, then of course I could work on the feature - I'll need to clean it up first to remove all the company specific code that doesn't make sense elsewhere. If you can please be patient with me, I'll let you know when I have something. If you'd be able to review and help that would be awesome of course, many thanks for the offer!ancient-vegetable-10556
11/17/2023, 5:22 PM