Skip to content

Commit ae888b7

Browse files
committed
updated test coverage stuff
1 parent 348013f commit ae888b7

File tree

8 files changed

+88
-44
lines changed

8 files changed

+88
-44
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,6 @@ ignored/
6060

6161
# Build output
6262
node_modules/
63-
dist/
63+
dist/
64+
scripts/
65+
test/junit.xml

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Development files
22
src/
33
test/
4+
scripts/
45
examples/
56
docs/
67
.github/

CONTRIBUTING.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This guide will help you contribute to the LuaTS project.
77

88
### Prerequisites
99

10-
- [Bun](https://bun.sh/) (preferred) or Node.js
10+
- [Bun](https://bun.sh/) (required for full development experience)
1111
- Git
1212

1313
### Setting Up the Development Environment
@@ -21,12 +21,10 @@ This guide will help you contribute to the LuaTS project.
2121
3. Install dependencies:
2222
```bash
2323
bun install
24-
# or npm install
2524
```
2625
4. Build the project:
2726
```bash
2827
bun run build
29-
# or npm run build
3028
```
3129

3230
## Development Workflow
@@ -35,7 +33,6 @@ This guide will help you contribute to the LuaTS project.
3533

3634
```bash
3735
bun run dev
38-
# or npm run dev
3936
```
4037

4138
This will run the project in watch mode, automatically recompiling when files change.
@@ -44,44 +41,41 @@ This will run the project in watch mode, automatically recompiling when files ch
4441

4542
```bash
4643
bun test
47-
# or npm test
4844
```
4945

50-
To run tests in watch mode:
46+
To run tests with coverage:
5147

5248
```bash
53-
bun test --watch
54-
# or npm run test:watch
49+
bun test --coverage
5550
```
5651

5752
To run a specific test file:
5853

5954
```bash
6055
bun test test/features.test.ts
61-
# or npm run test:specific
6256
```
6357

58+
> **Note:**
59+
> LuaTS is developed and tested primarily with Bun. Node.js is not officially supported for development or testing.
60+
6461
### Linting and Formatting
6562

6663
To lint the code:
6764

6865
```bash
6966
bun run lint
70-
# or npm run lint
7167
```
7268

7369
To fix linting issues automatically:
7470

7571
```bash
7672
bun run lint:fix
77-
# or npm run lint:fix
7873
```
7974

8075
To format the code with Prettier:
8176

8277
```bash
8378
bun run format
84-
# or npm run format
8579
```
8680

8781
## Project Structure
@@ -180,3 +174,8 @@ LuaTS follows [Semantic Versioning](https://semver.org/):
180174
## License
181175

182176
By contributing to LuaTS, you agree that your contributions will be licensed under the project's [MIT License](https://github.com/codemeapixel/luats/blob/main/LICENSE).
177+
- For feature requests, describe the problem you're trying to solve
178+
179+
## License
180+
181+
By contributing to LuaTS, you agree that your contributions will be licensed under the project's [MIT License](https://github.com/codemeapixel/luats/blob/main/LICENSE).

bun.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/contributing.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ This guide will help you contribute to the LuaTS project.
2222

2323
### Prerequisites
2424

25-
- [Bun](https://bun.sh/) (preferred) or Node.js
25+
- [Bun](https://bun.sh/) (required for full development experience)
2626
- Git
2727

2828
### Setting Up the Development Environment
@@ -36,12 +36,10 @@ This guide will help you contribute to the LuaTS project.
3636
3. Install dependencies:
3737
```bash
3838
bun install
39-
# or npm install
4039
```
4140
4. Build the project:
4241
```bash
4342
bun run build
44-
# or npm run build
4543
```
4644

4745
## Development Workflow
@@ -50,7 +48,6 @@ This guide will help you contribute to the LuaTS project.
5048

5149
```bash
5250
bun run dev
53-
# or npm run dev
5451
```
5552

5653
This will run the project in watch mode, automatically recompiling when files change.
@@ -59,44 +56,41 @@ This will run the project in watch mode, automatically recompiling when files ch
5956

6057
```bash
6158
bun test
62-
# or npm test
6359
```
6460

65-
To run tests in watch mode:
61+
To run tests with coverage:
6662

6763
```bash
68-
bun test --watch
69-
# or npm run test:watch
64+
bun test --coverage
7065
```
7166

7267
To run a specific test file:
7368

7469
```bash
7570
bun test test/features.test.ts
76-
# or npm run test:specific
7771
```
7872

73+
> **Note:**
74+
> LuaTS is developed and tested primarily with Bun. Node.js is not officially supported for development or testing.
75+
7976
### Linting and Formatting
8077

8178
To lint the code:
8279

8380
```bash
8481
bun run lint
85-
# or npm run lint
8682
```
8783

8884
To fix linting issues automatically:
8985

9086
```bash
9187
bun run lint:fix
92-
# or npm run lint:fix
9388
```
9489

9590
To format the code with Prettier:
9691

9792
```bash
9893
bun run format
99-
# or npm run format
10094
```
10195

10296
## Project Structure
@@ -194,4 +188,10 @@ LuaTS follows [Semantic Versioning](https://semver.org/):
194188

195189
## License
196190

191+
By contributing to LuaTS, you agree that your contributions will be licensed under the project's [MIT License](https://github.com/codemeapixel/luats/blob/main/LICENSE).
192+
- Environment details (OS, Node.js version, etc.)
193+
- For feature requests, describe the problem you're trying to solve
194+
195+
## License
196+
197197
By contributing to LuaTS, you agree that your contributions will be licensed under the project's [MIT License](https://github.com/codemeapixel/luats/blob/main/LICENSE).

docs/index.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,6 @@ console.log(tsCode);
6060
// }
6161
```
6262

63-
## Test & Coverage Reporting
64-
65-
LuaTS supports Bun's built-in test runner. For coverage, run:
66-
67-
```bash
68-
bun test --coverage
69-
```
70-
71-
This generates `test/lcov.info` for coverage reporting.
72-
For test pass/fail reporting, use the CLI output or a compatible reporter.
73-
7463
## License
7564

7665
LuaTS is distributed under the [MIT license](https://github.com/codemeapixel/luats/blob/main/LICENSE).

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@
5656
"lint": "eslint src/**/*.ts",
5757
"lint:fix": "eslint src/**/*.ts --fix",
5858
"format": "prettier --write src/**/*.ts",
59-
"prepublishOnly": "bun run build"
59+
"prepublishOnly": "bun run build",
60+
"test:report": "bun run ./scripts/test-report.ts",
61+
"test:coverage": "bun test --reporter=junit --reporter-outfile=./test/junit.xml"
6062
},
6163
"keywords": [
6264
"lua",
@@ -82,6 +84,7 @@
8284
"@typescript-eslint/parser": "^6.0.0",
8385
"eslint": "^8.0.0",
8486
"prettier": "^3.0.0",
87+
"xml2js": "^0.6.2",
8588
"typescript": "^5.0.0"
8689
},
8790
"dependencies": {

test/README.md

Lines changed: 50 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,6 @@ This directory contains the comprehensive test suite for the Luats library. The
1111
- **plugins.test.ts**: Plugin system tests
1212
- **snapshots.test.ts**: Snapshot testing for type generation
1313

14-
## Test Status
15-
16-
<!-- TEST_RESULTS_START -->
17-
-**Passing:** Most core and feature tests
18-
-**Failing:** See [FAILING_TESTS.md](../FAILING_TESTS.md) for details on failing and incomplete tests.
19-
<!-- TEST_RESULTS_END -->
20-
2114
## Test Coverage
2215

2316
The test suite aims to provide comprehensive coverage of the Luats codebase. You can run the tests with coverage reports using:
@@ -88,3 +81,53 @@ Use the debug scripts in this directory for troubleshooting:
8881
- `debug/test-hanging.ts`: Tests for parser edge cases
8982
- `debug/test-multiple.ts`: Tests for multiple type definitions
9083
- `debug/test-demo-structure.ts`: Tests for the demo code structure
84+
85+
<!-- TEST_RESULTS_START -->
86+
## Test Results
87+
88+
| Test Name | Status |
89+
|-----------|--------|
90+
| test\index.test.ts > Parse simple Lua code | ✅ Pass |
91+
| test\index.test.ts > Parse Luau with type annotations | ✅ Pass |
92+
| test\index.test.ts > Format Lua code | ✅ Pass |
93+
| test\index.test.ts > Generate TypeScript types from Luau | ✅ Pass |
94+
| test\index.test.ts > Analyze code with errors | ✅ Pass |
95+
| test\index.test.ts > Complex Luau parsing | ✅ Pass |
96+
| test\features.test.ts > Parse simple Lua code | ✅ Pass |
97+
| test\features.test.ts > Format Lua code | ✅ Pass |
98+
| test\features.test.ts > Analyze code with errors | ✅ Pass |
99+
| test\features.test.ts > Parse Luau with type annotations | ✅ Pass |
100+
| test\features.test.ts > Parse complex nested types | ✅ Pass |
101+
| test\features.test.ts > Generate TypeScript interfaces from Luau | ✅ Pass |
102+
| test\features.test.ts > Convert optional types | ✅ Pass |
103+
| test\features.test.ts > Convert array types | ✅ Pass |
104+
| test\features.test.ts > Convert record types | ✅ Pass |
105+
| test\features.test.ts > Convert function types | ✅ Pass |
106+
| test\features.test.ts > Convert method types | ✅ Pass |
107+
| test\features.test.ts > Convert union types | ✅ Pass |
108+
| test\features.test.ts > Preserve single-line comments | ❌ Fail |
109+
| test\features.test.ts > Preserve multi-line comments | ❌ Fail |
110+
| test\features.test.ts > Handle syntax errors | ❌ Fail |
111+
| test\features.test.ts > Handle type errors | ✅ Pass |
112+
| test\features.test.ts > Apply plugin transforms | ✅ Pass |
113+
| test\types.test.ts > Convert nested complex types | ✅ Pass |
114+
| test\types.test.ts > Convert array of custom types | ✅ Pass |
115+
| test\types.test.ts > Convert optional nested types | ✅ Pass |
116+
| test\types.test.ts > Convert union types with object literals | ❌ Fail |
117+
| test\types.test.ts > Convert function with multiple parameters | ✅ Pass |
118+
| test\types.test.ts > Handle recursive types | ✅ Pass |
119+
| test\types.test.ts > Convert generic types | ✅ Pass |
120+
| test\types.test.ts > Convert indexed access types | ✅ Pass |
121+
| test\types.test.ts > Use unknown instead of any | ❌ Fail |
122+
| test\types.test.ts > Prefix interface names | ❌ Fail |
123+
| test\types.test.ts > Generate semicolons based on option | ❌ Fail |
124+
| test\snapshots.test.ts > Basic types snapshot | ✅ Pass |
125+
| test\snapshots.test.ts > Game types snapshot | ❌ Fail |
126+
| test\plugins.test.ts > Plugin can transform types | ✅ Pass |
127+
| test\plugins.test.ts > Can use plugin object directly | ✅ Pass |
128+
| test\cli.test.ts > Convert a single file | ❌ Fail |
129+
| test\cli.test.ts > Convert a directory | ❌ Fail |
130+
| test\cli.test.ts > Validate a file | ❌ Fail |
131+
| test\cli.test.ts > Use config file | ❌ Fail |
132+
| **Total** | 30 / 42 passed |
133+
<!-- TEST_RESULTS_END -->

0 commit comments

Comments
 (0)