Skip to content

Commit 044ff46

Browse files
committed
fix transpile unit tests
1 parent 79c4dc6 commit 044ff46

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

tests/cases/unittests/transpile.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,21 +120,21 @@ var x = 0;`,
120120
test(`var x = 0;`,
121121
{
122122
options: { compilerOptions: { module: ModuleKind.AMD } },
123-
expectedOutput: `define(["require", "exports"], function (require, exports) {\r\n var x = 0;\r\n});\r\n`
123+
expectedOutput: `define(["require", "exports"], function (require, exports) {\r\n "use strict";\r\n var x = 0;\r\n});\r\n`
124124
});
125125
});
126126

127127
it("Uses correct newLine character", () => {
128128
test(`var x = 0;`,
129129
{
130130
options: { compilerOptions: { module: ModuleKind.CommonJS, newLine: NewLineKind.LineFeed } },
131-
expectedOutput: `var x = 0;\n`
131+
expectedOutput: `"use strict";\nvar x = 0;\n`
132132
});
133133
});
134134

135135
it("Sets module name", () => {
136136
let output =
137-
`System.register("NamedModule", [], function(exports_1) {\n var x;\n` +
137+
`System.register("NamedModule", [], function(exports_1) {\n "use strict";\n var x;\n` +
138138
` return {\n` +
139139
` setters:[],\n` +
140140
` execute: function() {\n` +
@@ -150,7 +150,7 @@ var x = 0;`,
150150
});
151151

152152
it("No extra errors for file without extension", () => {
153-
test(`var x = 0;`, { options: { compilerOptions: { module: ModuleKind.CommonJS }, fileName: "file" } });
153+
test(`"use strict";\r\nvar x = 0;`, { options: { compilerOptions: { module: ModuleKind.CommonJS }, fileName: "file" } });
154154
});
155155

156156
it("Rename dependencies - System", () => {
@@ -160,6 +160,7 @@ var x = 0;`,
160160
`use(foo);`
161161
let output =
162162
`System.register(["SomeOtherName"], function(exports_1) {\n` +
163+
` "use strict";\n` +
163164
` var SomeName_1;\n` +
164165
` return {\n` +
165166
` setters:[\n` +
@@ -186,6 +187,7 @@ var x = 0;`,
186187
`use(foo);`
187188
let output =
188189
`define(["require", "exports", "SomeOtherName"], function (require, exports, SomeName_1) {\n` +
190+
` "use strict";\n` +
189191
` use(SomeName_1.foo);\n` +
190192
`});\n`;
191193

@@ -210,6 +212,7 @@ var x = 0;`,
210212
` define(["require", "exports", "SomeOtherName"], factory);\n` +
211213
` }\n` +
212214
`})(function (require, exports) {\n` +
215+
` "use strict";\n` +
213216
` var SomeName_1 = require("SomeOtherName");\n` +
214217
` use(SomeName_1.foo);\n` +
215218
`});\n`;
@@ -237,6 +240,7 @@ var x = 0;`,
237240
`}\n` +
238241
`export {MyClass}; \n`
239242
let output =
243+
`"use strict";\n` +
240244
`var db_1 = require(\'./db\');\n` +
241245
`function someDecorator(target) {\n` +
242246
` return target;\n` +
@@ -272,12 +276,12 @@ var x = 0;`,
272276
});
273277

274278
it("Supports backslashes in file name", () => {
275-
test("var x", { expectedOutput: "var x;\r\n", options: { fileName: "a\\b.ts" }});
279+
test("var x", { expectedOutput: `"use strict";\r\nvar x;\r\n`, options: { fileName: "a\\b.ts" }});
276280
});
277281

278282
it("transpile file as 'tsx' if 'jsx' is specified", () => {
279283
let input = `var x = <div/>`;
280-
let output = `var x = React.createElement("div", null);\n`;
284+
let output = `"use strict";\nvar x = React.createElement("div", null);\n`;
281285
test(input, {
282286
expectedOutput: output,
283287
options: { compilerOptions: { jsx: JsxEmit.React, newLine: NewLineKind.LineFeed } }

0 commit comments

Comments
 (0)