Skip to content

Commit cd59573

Browse files
committed
Merge branch 'master' into genericTypeAliases
Conflicts: src/compiler/checker.ts
2 parents c96eee0 + 29afea3 commit cd59573

File tree

134 files changed

+4149
-219
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+4149
-219
lines changed

CONTRIBUTING.md

Lines changed: 47 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,44 +31,75 @@ Your pull request should:
3131
## Running the Tests
3232
To run all tests, invoke the runtests target using jake:
3333

34-
`jake runtests`
34+
```Shell
35+
jake runtests
36+
```
3537

3638
This run will all tests; to run only a specific subset of tests, use:
3739

38-
`jake runtests tests=<regex>`
40+
```Shell
41+
jake runtests tests=<regex>
42+
```
3943

4044
e.g. to run all compiler baseline tests:
4145

42-
`jake runtests tests=compiler`
46+
```Shell
47+
jake runtests tests=compiler
48+
```
4349

44-
or to run specifc test:tests\cases\compiler\2dArrays.ts
50+
or to run specifc test: `tests\cases\compiler\2dArrays.ts`
4551

46-
`jake runtests tests=2dArrays`
52+
```Shell
53+
jake runtests tests=2dArrays
54+
```
4755

4856
## Adding a Test
49-
To add a new testcase, simply place a .ts file in tests\cases\compiler containing code that exemplifies the bugfix or change you are making.
57+
To add a new testcase, simply place a `.ts` file in `tests\cases\compiler` containing code that exemplifies the bugfix or change you are making.
5058

51-
These files support metadata tags in the format // @name: value . The supported names and values are:
59+
These files support metadata tags in the format `// @metaDataName: value`. The supported names and values are:
5260

53-
* comments, sourcemap, noimplicitany, declaration: true or false (corresponds to the compiler command-line options of the same name)
54-
* target: ES3 or ES5 (same as compiler)
55-
* out, outDir: path (same as compiler)
56-
* module: local, commonjs, or amd (local corresponds to not passing any compiler --module flag)
61+
* `comments`, `sourcemap`, `noimplicitany`, `declaration`: true or false (corresponds to the compiler command-line options of the same name)
62+
* `target`: ES3 or ES5 (same as compiler)
63+
* `out`, outDir: path (same as compiler)
64+
* `module`: local, commonjs, or amd (local corresponds to not passing any compiler --module flag)
65+
* `fileName`: path
66+
* These tags delimit sections of a file to be used as separate compilation units. They are useful for tests relating to modules. See below for examples.
5767

58-
**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.
68+
**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.
5969
**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.
6070

71+
### Tests for multiple files
72+
73+
When one needs to test for scenarios which require multiple files, it is useful to use the `fileName` metadata tag as such:
74+
75+
```TypeScript
76+
// @fileName: file1.ts
77+
export function f() {
78+
}
79+
80+
// @fileName: file2.ts
81+
import { f as g } from "file1";
82+
83+
var x = g();
84+
```
85+
86+
One can also write a project test, but it is slightly more involved.
87+
6188
## Managing the Baselines
62-
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.
89+
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.
6390

6491
When a change in the baselines is detected, the test will fail. To inspect changes vs the expected baselines, use
6592

66-
`jake diff`
93+
```Shell
94+
jake diff
95+
```
6796

6897
After verifying that the changes in the baselines are correct, run
6998

70-
`jake baseline-accept`
99+
```Shell
100+
jake baseline-accept
101+
```
71102

72-
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.
103+
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.
73104

74105
**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.

Jakefile.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ var librarySourceMap = [
149149
{ target: "lib.scriptHost.d.ts", sources: ["importcore.d.ts", "scriptHost.d.ts"], },
150150
{ target: "lib.d.ts", sources: ["core.d.ts", "extensions.d.ts", "intl.d.ts", "dom.generated.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"], },
151151
{ target: "lib.core.es6.d.ts", sources: ["core.d.ts", "es6.d.ts"]},
152-
{ target: "lib.es6.d.ts", sources: ["core.d.ts", "es6.d.ts", "intl.d.ts", "dom.generated.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"]},
152+
{ target: "lib.es6.d.ts", sources: ["core.d.ts", "es6.d.ts", "intl.d.ts", "dom.generated.d.ts", "dom.es6.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"] },
153153
];
154154

155155
var libraryTargets = librarySourceMap.map(function (f) {
@@ -507,7 +507,7 @@ function cleanTestDirs() {
507507
// used to pass data from jake command line directly to run.js
508508
function writeTestConfigFile(tests, testConfigFile) {
509509
console.log('Running test(s): ' + tests);
510-
var testConfigContents = '{\n' + '\ttest: [\'' + tests + '\']\n}';
510+
var testConfigContents = JSON.stringify({ test: [tests]});
511511
fs.writeFileSync('test.config', testConfigContents);
512512
}
513513

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
[![Downloads](http://img.shields.io/npm/dm/TypeScript.svg)](https://npmjs.org/package/typescript)
66

77
# TypeScript
8-
9-
[![Join the chat at https://gitter.im/Microsoft/TypeScript](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Microsoft/TypeScript?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
8+
9+
[![Join the chat at https://gitter.im/Microsoft/TypeScript](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Microsoft/TypeScript?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
1010

1111
[TypeScript](http://www.typescriptlang.org/) is a language for application-scale JavaScript. TypeScript adds optional types, classes, and modules to JavaScript. TypeScript supports tools for large-scale JavaScript applications for any browser, for any host, on any OS. TypeScript compiles to readable, standards-based JavaScript. Try it out at the [playground](http://www.typescriptlang.org/Playground), and stay up to date via [our blog](http://blogs.msdn.com/typescript) and [twitter account](https://twitter.com/typescriptlang).
1212

@@ -31,7 +31,7 @@ There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob
3131

3232
## Building
3333

34-
In order to build the TypeScript compiler, ensure that you have [Git](http://git-scm.com/downloads) and [Node.js](http://nodejs.org/) installed. Note that you need to have autocrlf off as we track whitespace changes (`git config --global core.autocrlf false`).
34+
In order to build the TypeScript compiler, ensure that you have [Git](http://git-scm.com/downloads) and [Node.js](http://nodejs.org/) installed.
3535

3636
Clone a copy of the repo:
3737

bin/tsc

100644100755
File mode changed.

0 commit comments

Comments
 (0)