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

Commit

Permalink
Fix to enable running TS/Karma with a version
Browse files Browse the repository at this point in the history
- Now the `languageVersion` is not passed into the Karma/Node runner code, so we don't get Node version errors.
- Updated Node docs to mention Karma testing on TS
  • Loading branch information
OverZealous committed Sep 5, 2017
1 parent 8dbafed commit cbbe921
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion documentation/environments/node.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ The solution, test fixture and optional setup/preloaded code are all combined in

## TypeScript

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

The following typings are available:

Expand Down
6 changes: 5 additions & 1 deletion lib/runners/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,11 @@ function prepareKarma(opts, interfaceType, runCode, fail) {
},
};

runKarma(opts, runCode, fail, interfaceType, config);
const nodeOpts = Object.assign({}, opts);
// run on the default node version
delete nodeOpts.languageVersion;

runKarma(nodeOpts, runCode, fail, interfaceType, config);
}

function _tsc(opts) {
Expand Down
6 changes: 6 additions & 0 deletions test/runners/typescript_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ describe('typescript runner', function() {
it('basic test', function(done) {
runner.run({
language: 'typescript',
languageVersion: '2.4',
code: 'export var a = {b: 2};',
fixture: `\
/// <reference path="/runner/typings/mocha/index.d.ts" />
Expand All @@ -142,6 +143,7 @@ describe('typescript runner', function() {
it('handle successes', function(done) {
runner.run({
language: 'typescript',
languageVersion: '2.4',
code: `\
import 'core-js';
import { Component } from "@angular/core";
Expand Down Expand Up @@ -222,6 +224,7 @@ describe('typescript runner', function() {
it('handles failure', function(done) {
runner.run({
language: 'typescript',
languageVersion: '2.4',
code: `\
import 'core-js';
import { Component } from "@angular/core";
Expand Down Expand Up @@ -300,6 +303,7 @@ describe('typescript runner', function() {
it('basic test', function(done) {
runner.run({
language: 'typescript',
languageVersion: '2.4',
code: 'export var a = {b: 2};',
fixture: `\
/// <reference path="/runner/typings/mocha/index.d.ts" />
Expand All @@ -322,6 +326,7 @@ describe('typescript runner', function() {
it('handle successes', function(done) {
runner.run({
language: 'typescript',
languageVersion: '2.4',
code: `\
import 'core-js';
import { Component } from "@angular/core";
Expand Down Expand Up @@ -402,6 +407,7 @@ describe('typescript runner', function() {
it('handles failure', function(done) {
runner.run({
language: 'typescript',
languageVersion: '2.4',
code: `\
import 'core-js';
import { Component } from "@angular/core";
Expand Down

0 comments on commit cbbe921

Please sign in to comment.