aspect-build / aspect-build/bazel-examples

[Bug]: build fail when test file name contains capital letter

Open
#268 1 comment 0 reactions 0 assignees View on GitHub
bug need: repro
Dominant language
Starlark
Stars
149
Forks
87
PR merge metrics
No merged PRs in 30d

Description

### What happened?

The build fails when adding a test file with capital letter in the file name. E.g. I added a test file named Other.test.ts under next.js/apps/alpha/pages. The file just contain some dummy test case as below.

```
// Other.test.ts
import { render, screen } from '@testing-library/react';
import Home from './index';

describe('Other', () => {
it('should fail', () => {
expect(true).toBe(true);
});
});
```
When run the bazel build on specs, it runs into the following error.
```
➜ next.js git:(main) ✗ bazel build //apps/alpha/pages:specs
INFO: Analyzed target //apps/alpha/pages:specs (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: /Users/xzdev/Sandbox/bazel-examples/next.js/apps/alpha/pages/BUILD.bazel:32:11: output 'apps/alpha/pages/Other.test.js' was not created
ERROR: /Users/xzdev/Sandbox/bazel-examples/next.js/apps/alpha/pages/BUILD.bazel:32:11: output 'apps/alpha/pages/Other.test.d.ts' was not created
ERROR: /Users/xzdev/Sandbox/bazel-examples/next.js/apps/alpha/pages/BUILD.bazel:32:11: Transpiling & type-checking TypeScript project @//apps/alpha/pages:specs [tsc -p tsconfig.json] failed: not all outputs were created or valid
Target //apps/alpha/pages:specs failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 2.112s, Critical Path: 1.14s
INFO: 2 processes: 1 internal, 1 worker.
FAILED: Build did NOT complete successfully
```

### Version

Development (host) and target OS/architectures:

Output of `bazel --version`: aspect 5.3.4

Version of the Aspect rules, or other relevant rules from your
`WORKSPACE` or `MODULE.bazel` file:

```
http_archive(
name = "aspect_rules_js",
sha256 = "dcd1567d4a93a8634ec0b888b371a60b93c18d980f77dace02eb176531a71fcf",
strip_prefix = "rules_js-1.26.0",
url = "https://github.com/aspect-build/rules_js/releases/download/v1.26.0/rules_js-v1.26.0.tar.gz",
)

http_archive(
name = "aspect_rules_ts",
sha256 = "ace5b609603d9b5b875d56c9c07182357c4ee495030f40dcefb10d443ba8c208",
strip_prefix = "rules_ts-1.4.0",
url = "https://github.com/aspect-build/rules_ts/releases/download/v1.4.0/rules_ts-v1.4.0.tar.gz",
)

http_archive(
name = "aspect_rules_jest",
sha256 = "52dc08fd252add240124ef7ccc46df3a505121758dfb96578a3d5f2ebb4c2b40",
strip_prefix = "rules_jest-0.18.1",
url = "https://github.com/aspect-build/rules_jest/releases/download/v0.18.1/rules_jest-v0.18.1.tar.gz",
)
```

Language(s) and/or frameworks involved: TypeScript

### How to reproduce

```shell
Add a dummy test file with capital letter. Make sure the file is also added to the BUILD file `specs` src. Run the bazel build on the specs and the error shows.
```

### Any other information?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with next.js/apps/alpha/pages/BUILD.bazel and its specs src entries, then reproduce with `bazel build //apps/alpha/pages:specs` using a capitalized test filename such as Other.test.ts. Check how the TypeScript build using tsconfig.json maps source names to the reported outputs. Done means the specs target builds successfully and creates valid outputs for the capitalized test file.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.