You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Migrate tests to Jest
* Fix formatting of some code literals
* Update contributing docs
* Load ts-node in the fork call in watchmode test
* Change test directory in configs
* Revisit toThrowExactError matcher
* Use toThrowExactError on TSTLErrors in tests
* Increase timeout for watchmode test since it may fail sometimes
* Execute TypeScript's Opganize Imports command
* Split assignments tests to improve parallel testing performance
* Add skipLibCheck flag to tests
* Inline lualib by default in tests
* Remove test-fast script
* Remove ignoreDiagnostics option from transpileAndExecute
* Remove @ts-check from jest config file
* Add (%p) to set size test name
* Format some code literals
* Revert formatting changes in characterEscapeSequence translation test
* Add pretest script to build lualib
* Improve performance of build_lualib script
* Re-enable type checking for build-lualib script
* Use jest's snapshot testing for translation tests
* Use regular --watch flag instead of --watchAll in contributing docs
* Sort transformation test fixture names
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+17-38Lines changed: 17 additions & 38 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,67 +14,46 @@ To get familiar with the project structure, here is a short overview of each dir
14
14
*`src/targets/`
15
15
- Version-specific transpiler overrides for the different Lua targets. The main transpiler transpiles Lua 5.0, each target-specific transpiler extends the transpiler of the version before it, so the 5.3 inherits 5.2 which inherits 5.1 which inherits 5.0. LuaJIT is based on 5.2 so inherits from the 5.2 transpiler.
16
16
**Compiler.ts* - Main entry point of the transpiler, this is what interfaces with the TypeScript compiler API.
17
-
**Transpiler.ts* - Main transpiler code, transforms a TypeScript AST to a Lua string.
17
+
**LuaTransformer.ts* - Main transpiler code, transforms a TypeScript AST to a Lua AST.
18
+
**LuaPrinter.ts* - Transforms a Lua AST to a string.
18
19
**TSHelper.ts* - Helper methods used during the transpilation process.
19
20
-`test/`
20
21
* This directory contains all testing code for the transpiler.
21
-
*`test/src/`
22
-
- Contains all extra source and utility used to run tests.
23
22
*`test/unit/`
24
23
- Unit/Functional tests for the transpiler. Tests in here are grouped by functionality they are testing. Generally each of these tests uses the transpiler to transpile some TypeScript to Lua, then executes it using the Fengari Lua VM. Assertion is done on the result of the lua code.
25
24
*`test/translation/`
26
25
-**[Obsolete]** Contains tests that only check the transpiled Lua String. We prefer adding unit/functional tests over translation tests. This directory will probably be removed at some point.
27
26
28
27
## Running Tests
29
-
The tests for this project can be executed using the standard `npm test`. This runs all tests (can take a while!).
28
+
The tests for this project can be executed using the standard `npm test`. This runs all tests.
30
29
31
-
### Testing while developing
32
-
Due to the time required to run all tests, it is impractical to run every test while developing part of the transpiler. To speed up the test run you can import `FocusTest` or `FocusTests` from Alsatian. If a class is decorated with `@FocusTests`, all other test classes will be ignored. Similarly, if any test method is decorated with `@FocusTest`, only `@FocusTest` methods will be run during `npm test`.
30
+
Due to the time required to run all tests, it is impractical to run every test while developing part of the transpiler. To speed up the test run you can:
When submitting a pull request with new functionality, we require some functional (transpile and execute Lua) to be added, to ensure the new functionality works as expected, and will continue to work that way.
73
50
74
51
Translation tests are discouraged as in most cases as we do not really care about the exact Lua output, as long as executing it results in the correct result (which is tested by functional tests).
75
52
76
53
## Coding Conventions
77
-
Most coding conventions are enforced by the ts-lint configuration. The test process will fail if code does not pass the linter. Some extra conventions worth mentioning:
54
+
Most coding conventions are enforced by the TSLint and Prettier. You can check your code locally by running `npm run lint`. The CI build will fail if your code does not pass the linter. For better experience, you can install extensions for your code editor for [TSLint](https://palantir.github.io/tslint/usage/third-party-tools/) and [Prettier](https://prettier.io/docs/en/editors.html).
55
+
56
+
Some extra conventions worth mentioning:
78
57
* Do not abbreviate variable names. The exception here are inline lambda arguments, if it is obvious what the argument is you can abbreviate to the first letter, e.g: `statements.filter(s => ts.VariableStatement(s))`
79
58
* Readability of code is more important than the amount of space it takes. If extra line breaks make your code more readable, add them.
0 commit comments