PageRenderTime 44ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/Tour of Heroes/node_modules/typescript/CONTRIBUTING.md

https://gitlab.com/courses-online/Angular2
Markdown | 191 lines | 124 code | 67 blank | 0 comment | 0 complexity | 21402f634124202c824a5c116dadbcef MD5 | raw file
  1. # Instructions for Logging Issues
  2. ## 1. Read the FAQ
  3. Please [read the FAQ](https://github.com/Microsoft/TypeScript/wiki/FAQ) before logging new issues, even if you think you have found a bug.
  4. Issues that ask questions answered in the FAQ will be closed without elaboration.
  5. ## 2. Search for Duplicates
  6. [Search the existing issues](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93&q=is%3Aissue) before logging a new one.
  7. ## 3. Do you have a question?
  8. The issue tracker is for **issues**, in other words, bugs and suggestions.
  9. If you have a *question*, please use [Stack Overflow](http://stackoverflow.com/questions/tagged/typescript), [Gitter](https://gitter.im/Microsoft/TypeScript), your favorite search engine, or other resources.
  10. Due to increased traffic, we can no longer answer questions in the issue tracker.
  11. ## 4. Did you find a bug?
  12. When logging a bug, please be sure to include the following:
  13. * What version of TypeScript you're using (run `tsc --v`)
  14. * If at all possible, an *isolated* way to reproduce the behavior
  15. * The behavior you expect to see, and the actual behavior
  16. You can try out the nightly build of TypeScript (`npm install typescript@next`) to see if the bug has already been fixed.
  17. ## 5. Do you have a suggestion?
  18. We also accept suggestions in the issue tracker.
  19. Be sure to [check the FAQ](https://github.com/Microsoft/TypeScript/wiki/FAQ) and [search](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93&q=is%3Aissue) first.
  20. In general, things we find useful when reviewing suggestions are:
  21. * A description of the problem you're trying to solve
  22. * An overview of the suggested solution
  23. * Examples of how the suggestion would work in various places
  24. * Code examples showing e.g. "this would be an error, this wouldn't"
  25. * Code examples showing the generated JavaScript (if applicable)
  26. * If relevant, precedent in other languages can be useful for establishing context and expected behavior
  27. # Instructions for Contributing Code
  28. ## Code of Conduct
  29. This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
  30. ## Contributing bug fixes
  31. TypeScript is currently accepting contributions in the form of bug fixes. A bug must have an issue tracking it in the issue tracker that has been approved ("Milestone == Community") by the TypeScript team. Your pull request should include a link to the bug that you are fixing. If you've submitted a PR for a bug, please post a comment in the bug to avoid duplication of effort.
  32. ## Contributing features
  33. Features (things that add new or improved functionality to TypeScript) may be accepted, but will need to first be approved (marked as "Milestone == Community" by a TypeScript coordinator with the message "Approved") in the suggestion issue. Features with language design impact, or that are adequately satisfied with external tools, will not be accepted.
  34. Design changes will not be accepted at this time. If you have a design change proposal, please log a suggestion issue.
  35. ## Legal
  36. You will need to complete a Contributor License Agreement (CLA). Briefly, this agreement testifies that you are granting us permission to use the submitted change according to the terms of the project's license, and that the work being submitted is under appropriate copyright.
  37. Please submit a Contributor License Agreement (CLA) before submitting a pull request. You may visit https://cla.microsoft.com to sign digitally. Alternatively, download the agreement ([Microsoft Contribution License Agreement.docx](https://www.codeplex.com/Download?ProjectName=typescript&DownloadId=822190) or [Microsoft Contribution License Agreement.pdf](https://www.codeplex.com/Download?ProjectName=typescript&DownloadId=921298)), sign, scan, and email it back to <cla@microsoft.com>. Be sure to include your github user name along with the agreement. Once we have received the signed CLA, we'll review the request.
  38. ## Housekeeping
  39. Your pull request should:
  40. * Include a description of what your change intends to do
  41. * Be a child commit of a reasonably recent commit in the **master** branch
  42. * Requests need not be a single commit, but should be a linear sequence of commits (i.e. no merge commits in your PR)
  43. * It is desirable, but not necessary, for the tests to pass at each commit
  44. * Have clear commit messages
  45. * e.g. "Refactor feature", "Fix issue", "Add tests for issue"
  46. * Include adequate tests
  47. * At least one test should fail in the absence of your non-test code changes. If your PR does not match this criteria, please specify why
  48. * Tests should include reasonable permutations of the target fix/change
  49. * Include baseline changes with your change
  50. * All changed code must have 100% code coverage
  51. * Follow the code conventions described in [Coding guidelines](https://github.com/Microsoft/TypeScript/wiki/Coding-guidelines)
  52. * To avoid line ending issues, set `autocrlf = input` and `whitespace = cr-at-eol` in your git configuration
  53. ## Contributing `lib.d.ts` fixes
  54. The library sources are in: [src/lib](https://github.com/Microsoft/TypeScript/tree/master/src/lib)
  55. Library files in `built/local/` are updated by running
  56. ```Shell
  57. jake
  58. ```
  59. The files in `lib/` are used to bootstrap compilation and usually do not need to be updated.
  60. #### `src/lib/dom.generated.d.ts` and `src/lib/webworker.generated.d.ts`
  61. These two files represent the DOM typings and are auto-generated. To make any modifications to them, please submit a PR to https://github.com/Microsoft/TSJS-lib-generator
  62. ## Running the Tests
  63. To run all tests, invoke the `runtests-parallel` target using jake:
  64. ```Shell
  65. jake runtests-parallel
  66. ```
  67. This run will all tests; to run only a specific subset of tests, use:
  68. ```Shell
  69. jake runtests tests=<regex>
  70. ```
  71. e.g. to run all compiler baseline tests:
  72. ```Shell
  73. jake runtests tests=compiler
  74. ```
  75. or to run a specific test: `tests\cases\compiler\2dArrays.ts`
  76. ```Shell
  77. jake runtests tests=2dArrays
  78. ```
  79. ## Debugging the tests
  80. To debug the tests, invoke the `runtests-browser` task from jake.
  81. You will probably only want to debug one test at a time:
  82. ```Shell
  83. jake runtests-browser tests=2dArrays
  84. ```
  85. You can specify which browser to use for debugging. Currently Chrome and IE are supported:
  86. ```Shell
  87. jake runtests-browser tests=2dArrays browser=chrome
  88. ```
  89. You can debug with VS Code or Node instead with `jake runtests debug=true`:
  90. ```Shell
  91. jake runtests tests=2dArrays debug=true
  92. ```
  93. ## Adding a Test
  94. To add a new test case, simply place a `.ts` file in `tests\cases\compiler` containing code that exemplifies the bugfix or change you are making.
  95. These files support metadata tags in the format `// @metaDataName: value`.
  96. The supported names and values are the same as those supported in the compiler itself, with the addition of the `fileName` flag.
  97. `fileName` tags delimit sections of a file to be used as separate compilation units.
  98. They are useful for tests relating to modules.
  99. See below for examples.
  100. **Note** that if you have a test corresponding to a specific spec compliance item, you can place it in `tests\cases\conformance` in an appropriately-named subfolder.
  101. **Note** that filenames here must be distinct from all other compiler testcase names, so you may have to work a bit to find a unique name if it's something common.
  102. ### Tests for multiple files
  103. When one needs to test for scenarios which require multiple files, it is useful to use the `fileName` metadata tag as such:
  104. ```TypeScript
  105. // @fileName: file1.ts
  106. export function f() {
  107. }
  108. // @fileName: file2.ts
  109. import { f as g } from "file1";
  110. var x = g();
  111. ```
  112. One can also write a project test, but it is slightly more involved.
  113. ## Managing the Baselines
  114. Compiler testcases generate baselines that track the emitted `.js`, the errors produced by the compiler, and the type of each expression in the file. Additionally, some testcases opt in to baselining the source map output.
  115. When a change in the baselines is detected, the test will fail. To inspect changes vs the expected baselines, use
  116. ```Shell
  117. jake diff
  118. ```
  119. After verifying that the changes in the baselines are correct, run
  120. ```Shell
  121. jake baseline-accept
  122. ```
  123. to establish the new baselines as the desired behavior. This will change the files in `tests\baselines\reference`, which should be included as part of your commit. It's important to carefully validate changes in the baselines.
  124. **Note** that `baseline-accept` should only be run after a full test run! Accepting baselines after running a subset of tests will delete baseline files for the tests that didn't run.