Skip to content

Commit

Permalink
Change from CompilerOptions numbers to TS enum constants
Browse files Browse the repository at this point in the history
  • Loading branch information
Emil Persson committed Jan 18, 2017
1 parent f910ca8 commit 50495c4
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 41 deletions.
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -28,7 +28,8 @@
"author": "Kulshekhar Kabra <kulshekhar@users.noreply.github.com> (https://github.com/kulshekhar)",
"contributors": [
"Ihor Chulinda <ichulinda@gmail.com> (https://github.com/Igmat)",
"OJ Kwon <kwon.ohjoong@gmail.com> (https://github.com/kwonoj)"
"OJ Kwon <kwon.ohjoong@gmail.com> (https://github.com/kwonoj)",
"Emil Persson <emil.n.persson@gmail.com> (https://github.com/emilniklas)"
],
"license": "MIT",
"bugs": {
Expand Down
23 changes: 12 additions & 11 deletions tests/__tests__/tsconfig-default.spec.ts
@@ -1,5 +1,6 @@
import { } from 'jest';
import { } from 'node';
import * as ts from 'typescript'

jest.mock('path');

Expand All @@ -15,11 +16,11 @@ describe('get default ts config', () => {
const result = getTSConfig();

expect(result).toEqual ({
'target': 2,
'module': 1,
'moduleResolution': 2,
'target': ts.ScriptTarget.ES2015,
'module': ts.ModuleKind.CommonJS,
'moduleResolution': ts.ModuleResolutionKind.NodeJs,
'noEmitOnError': false,
'jsx': 2
'jsx': ts.JsxEmit.React
});
});

Expand All @@ -28,11 +29,11 @@ describe('get default ts config', () => {
const result = getTSConfig();

expect(result).not.toEqual ({
'target': 2,
'module': 1,
'moduleResolution': 2,
'target': ts.ScriptTarget.ES2015,
'module': ts.ModuleKind.CommonJS,
'moduleResolution': ts.ModuleResolutionKind.NodeJs,
'noEmitOnError': true,
'jsx': 2
'jsx': ts.JsxEmit.React
});
});

Expand All @@ -41,8 +42,8 @@ describe('get default ts config', () => {
const result = getTSConfig();

expect(result).not.toEqual ({
'module': 1,
'jsx': 2
'module': ts.ModuleKind.CommonJS,
'jsx': ts.JsxEmit.React
});
});

Expand All @@ -62,4 +63,4 @@ describe('get default ts config', () => {
expect(result).toEqual(resultNullContent);
});

});
});
23 changes: 12 additions & 11 deletions tests/__tests__/tsconfig-inline.spec.ts
@@ -1,5 +1,6 @@
import { } from 'jest';
import { } from 'node';
import * as ts from 'typescript';

jest.mock('path');

Expand All @@ -20,8 +21,8 @@ describe('get inline ts config', () => {
});

expect(result).toEqual ({
'module': 1,
'jsx': 2
'module': ts.ModuleKind.CommonJS,
'jsx': ts.JsxEmit.React
});
});

Expand All @@ -35,11 +36,11 @@ describe('get inline ts config', () => {
});

expect(result).not.toEqual ({
'target': 2,
'module': 1,
'moduleResolution': 2,
'target': ts.ScriptTarget.ES2015,
'module': ts.ModuleKind.CommonJS,
'moduleResolution': ts.ModuleResolutionKind.NodeJs,
'noEmitOnError': false,
'jsx': 2
'jsx': ts.JsxEmit.React
});
});

Expand All @@ -53,12 +54,12 @@ describe('get inline ts config', () => {
});

expect(result).not.toEqual ({
'target': 2,
'module': 1,
'moduleResolution': 2,
'target': ts.ScriptTarget.ES2015,
'module': ts.ModuleKind.CommonJS,
'moduleResolution': ts.ModuleResolutionKind.NodeJs,
'noEmitOnError': true,
'jsx': 2
'jsx': ts.JsxEmit.React
});
});

});
});
37 changes: 19 additions & 18 deletions tests/__tests__/tsconfig-string.spec.ts
@@ -1,5 +1,6 @@
import { } from 'jest';
import { } from 'node';
import * as ts from 'typescript';

jest.mock('path');

Expand All @@ -17,11 +18,11 @@ describe('get ts config from string', () => {
});

expect(result).toEqual ({
'target': 2,
'module': 1,
'moduleResolution': 2,
'target': ts.ScriptTarget.ES2015,
'module': ts.ModuleKind.CommonJS,
'moduleResolution': ts.ModuleResolutionKind.NodeJs,
'noEmitOnError': true,
'jsx': 2
'jsx': ts.JsxEmit.React
});
});

Expand All @@ -32,11 +33,11 @@ describe('get ts config from string', () => {
});

expect(result).not.toEqual ({
'target': 2,
'module': 1,
'moduleResolution': 2,
'target': ts.ScriptTarget.ES2015,
'module': ts.ModuleKind.CommonJS,
'moduleResolution': ts.ModuleResolutionKind.NodeJs,
'noEmitOnError': false,
'jsx': 2
'jsx': ts.JsxEmit.React
});
});

Expand All @@ -47,8 +48,8 @@ describe('get ts config from string', () => {
});

expect(result).not.toEqual ({
'module': 1,
'jsx': 2
'target': ts.ScriptTarget.ES5,
'jsx': ts.JsxEmit.React
});
});

Expand All @@ -59,11 +60,11 @@ describe('get ts config from string', () => {
});

expect(result).toEqual ({
'target': 2,
'module': 1,
'moduleResolution': 2,
'target': ts.ScriptTarget.ES2015,
'module': ts.ModuleKind.CommonJS,
'moduleResolution': ts.ModuleResolutionKind.NodeJs,
'noEmitOnError': true,
'jsx': 2
'jsx': ts.JsxEmit.React
});
});

Expand All @@ -74,11 +75,11 @@ describe('get ts config from string', () => {
});

expect(result).toEqual ({
'target': 1,
'module': 1,
'moduleResolution': 2,
'target': ts.ScriptTarget.ES5,
'module': ts.ModuleKind.CommonJS,
'moduleResolution': ts.ModuleResolutionKind.NodeJs,
'noEmitOnError': true,
'jsx': 2,
'jsx': ts.JsxEmit.React,
'noImplicitAny': true
});
});
Expand Down

0 comments on commit 50495c4

Please sign in to comment.