Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

CI failure on TypeScript 1.6 Beta #634

Closed
Kuniwak opened this issue Sep 3, 2015 · 4 comments
Closed

CI failure on TypeScript 1.6 Beta #634

Kuniwak opened this issue Sep 3, 2015 · 4 comments

Comments

@Kuniwak
Copy link
Contributor

Kuniwak commented Sep 3, 2015

CI started to fail since TypeScript 1.6 Beta was released.

I found 2 problems, and now I'm stuck.

Problem1: Strict object literal assignment checking

Since TypeScript 1.6 Beta, extra fields are prohibited.
And tslint have the extra field getIsScriptOpen on src/language/languageServiceHost.ts.

$ npm test
...

Running "ts:core" (ts) task
Compiling...
Cleared fast compile cache for target: core
Fast compile will not work when --out is specified. Ignoring fast compilation
WARNING: TypeScript does not allow external modules to be concatenated with --out. Any exported code may be truncated.  See TypeScript issue #1544 for more details.
Using tsc v1.6.0-beta
path/to/tslint/src/language/languageServiceHost.ts(19,15): error TS2322: Type '{ getCompilationSettings: () => CompilerOptions; getCurrentDirectory: () => string; getDefaultLib...' is not assignable to type 'LanguageServiceHost'.
  Object literal may only specify known properties, and 'getScriptIsOpen' does not exist in type 'LanguageServiceHost'.

>> 1 non-emit-preventing type warning
>> Error: tsc return code: 2
Warning: Task "ts:core" failed. Use --force to continue.

Aborted due to warnings.
npm ERR! Test failed.  See above for more details.

I surveyed who using the getScriptIsOpen, but not found from tslint and typescript.
So, I tried to remove the getScriptIsOpen:

diff --git a/src/language/languageServiceHost.ts b/src/language/languageServiceHost.ts
index c7a42ca..81a930e 100644
--- a/src/language/languageServiceHost.ts
+++ b/src/language/languageServiceHost.ts
@@ -21,7 +21,6 @@ module Lint {
             getCurrentDirectory: () => "",
             getDefaultLibFileName: () => "lib.d.ts",
             getScriptFileNames: () => [fileName],
-            getScriptIsOpen: () => true,
             getScriptSnapshot: () => {
                 return {
                     getChangeRange: (oldSnapshot) => undefined,

And got the next problem.

Problem 2: Missing TypeScript modules

I know not why, TypeScript modules are not included in compiled sources (I confirmed bin/tslint-cli.js and build/tslint-tests.js) since TypeScript 1.6.0 Beta.
So, the variable ts became to be not found, and we got the following ReferenceError:

$ npm test
...

Running "ts:test" (ts) task
Compiling...
Cleared fast compile cache for target: test
Fast compile will not work when --out is specified. Ignoring fast compilation
Using tsc v1.6.0-beta



TypeScript compilation complete: 1.78s for 69 typescript files

Running "tslint:test" (tslint) task
>> 63 files lint free.

Running "concat:test" (concat) task
File build/tslint-tests.js created.

Running "mochaTest:test" (mochaTest) task


  External Formatter
    ✓ formats failures
    ✓ returns undefined for unresolvable module
...
    ✓ enforces whitespace around the => token
    ✓ enforces whitespace around typecasts


  177 passing (599ms)


Running "run:test" (run) task
Checking tslint binary
path/to/tslint/bin/tslint-cli.js:1430
global.ts = ts;
            ^
ReferenceError: ts is not defined
    at Object.<anonymous> (path/to/tslint/bin/tslint-cli.js:1430:13)
    at Module._compile (module.js:430:26)
    at Object.Module._extensions..js (module.js:448:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (path/to/tslint/bin/tslint:3:1)
    at Module._compile (module.js:430:26)
    at Object.Module._extensions..js (module.js:448:10)
path/to/tslint/bin/tslint-cli.js:1430
global.ts = ts;
            ^
ReferenceError: ts is not defined
    at Object.<anonymous> (path/to/tslint/bin/tslint-cli.js:1430:13)
    at Module._compile (module.js:430:26)
    at Object.Module._extensions..js (module.js:448:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (path/to/tslint/bin/tslint:3:1)
    at Module._compile (module.js:430:26)
    at Object.Module._extensions..js (module.js:448:10)
tslint with a good file did not exit correctly: expected 0 got 1
path/to/tslint/bin/tslint-cli.js:1430
global.ts = ts;
            ^
ReferenceError: ts is not defined
    at Object.<anonymous> (path/to/tslint/bin/tslint-cli.js:1430:13)
    at Module._compile (module.js:430:26)
    at Object.Module._extensions..js (module.js:448:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (path/to/tslint/bin/tslint:3:1)
    at Module._compile (module.js:430:26)
    at Object.Module._extensions..js (module.js:448:10)
tslint with valid arguments did not exit correctly: expected 0 got 1
path/to/tslint/bin/tslint-cli.js:1430
global.ts = ts;
            ^
ReferenceError: ts is not defined
    at Object.<anonymous> (path/to/tslint/bin/tslint-cli.js:1430:13)
    at Module._compile (module.js:430:26)
    at Object.Module._extensions..js (module.js:448:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (path/to/tslint/bin/tslint:3:1)
    at Module._compile (module.js:430:26)
    at Object.Module._extensions..js (module.js:448:10)
Failed 2 tests
Warning: non-zero exit code 1 Use --force to continue.

Aborted due to warnings.
npm ERR! Test failed.  See above for more details.

So I try to the following code:

diff --git a/src/tslint.ts b/src/tslint.ts
index ab8f61e..03653a5 100644
--- a/src/tslint.ts
+++ b/src/tslint.ts
@@ -106,7 +106,7 @@ module Lint {

 // add the Lint and TypeScript modules to global for pluggable formatters/rules
 global.Lint = Lint;
-global.ts = ts;
+global.ts = require("typescript");

 // export Lint.Linter as the API interface for this module
 module.exports = Lint.Linter;

Then, compiled successfully done, but I got 103 tests failing.

Related #611

@adidahiya
Copy link
Contributor

I'll be releasing tslint 2.5.0-beta today which will support TS 1.6.0-beta. We've started work on this upgrade already on the 'next' branch of this repo, feel free to check out the changes there.

@Kuniwak
Copy link
Contributor Author

Kuniwak commented Sep 3, 2015

Thanks, @adidahiya.

I have 2 questions.

  1. Should I test my PR on TS 1.6 Beta?
  2. Is there anything else I should do?

@adidahiya
Copy link
Contributor

TSLint v2.5.0-beta has been released and the master branch now uses TS 1.6.0-beta. I left a comment on your PR for next steps.

@Kuniwak
Copy link
Contributor Author

Kuniwak commented Sep 3, 2015

Thanks, @adidahiya!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants