Skip to content
This repository was archived by the owner on Oct 14, 2020. It is now read-only.

Commit 1c71c58

Browse files
authored
Merge pull request #525 from OverZealous/bug/cannot_run_typescript_karma_node_version_error
Fix to enable running TS/Karma with a version
2 parents aeb1d5d + cbbe921 commit 1c71c58

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

documentation/environments/node.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ The solution, test fixture and optional setup/preloaded code are all combined in
5454

5555
## TypeScript
5656

57-
Typescript 2.4 is supported. Only the Mocha test framework is available for testing.
57+
Typescript 2.4 is supported. The Mocha test framework and Karma+Mocha are available for testing.
5858

5959
The following typings are available:
6060

lib/runners/typescript.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,11 @@ function prepareKarma(opts, interfaceType, runCode, fail) {
156156
},
157157
};
158158

159-
runKarma(opts, runCode, fail, interfaceType, config);
159+
const nodeOpts = Object.assign({}, opts);
160+
// run on the default node version
161+
delete nodeOpts.languageVersion;
162+
163+
runKarma(nodeOpts, runCode, fail, interfaceType, config);
160164
}
161165

162166
function _tsc(opts) {

test/runners/typescript_spec.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ describe('typescript runner', function() {
120120
it('basic test', function(done) {
121121
runner.run({
122122
language: 'typescript',
123+
languageVersion: '2.4',
123124
code: 'export var a = {b: 2};',
124125
fixture: `\
125126
/// <reference path="/runner/typings/mocha/index.d.ts" />
@@ -142,6 +143,7 @@ describe('typescript runner', function() {
142143
it('handle successes', function(done) {
143144
runner.run({
144145
language: 'typescript',
146+
languageVersion: '2.4',
145147
code: `\
146148
import 'core-js';
147149
import { Component } from "@angular/core";
@@ -222,6 +224,7 @@ describe('typescript runner', function() {
222224
it('handles failure', function(done) {
223225
runner.run({
224226
language: 'typescript',
227+
languageVersion: '2.4',
225228
code: `\
226229
import 'core-js';
227230
import { Component } from "@angular/core";
@@ -300,6 +303,7 @@ describe('typescript runner', function() {
300303
it('basic test', function(done) {
301304
runner.run({
302305
language: 'typescript',
306+
languageVersion: '2.4',
303307
code: 'export var a = {b: 2};',
304308
fixture: `\
305309
/// <reference path="/runner/typings/mocha/index.d.ts" />
@@ -322,6 +326,7 @@ describe('typescript runner', function() {
322326
it('handle successes', function(done) {
323327
runner.run({
324328
language: 'typescript',
329+
languageVersion: '2.4',
325330
code: `\
326331
import 'core-js';
327332
import { Component } from "@angular/core";
@@ -402,6 +407,7 @@ describe('typescript runner', function() {
402407
it('handles failure', function(done) {
403408
runner.run({
404409
language: 'typescript',
410+
languageVersion: '2.4',
405411
code: `\
406412
import 'core-js';
407413
import { Component } from "@angular/core";

0 commit comments

Comments
 (0)