Skip to content

Validate discrepancies in project tests #133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mhegazy opened this issue Jul 17, 2014 · 6 comments
Closed

Validate discrepancies in project tests #133

mhegazy opened this issue Jul 17, 2014 · 6 comments
Assignees
Labels
Bug A bug in TypeScript By Design Deprecated - use "Working as Intended" or "Design Limitation" instead

Comments

@mhegazy
Copy link
Contributor

mhegazy commented Jul 17, 2014

We need to investigate the differences noted in the tests below. Sheetal is currently refactoring these test suites significantly and then we should ensure any differences get appropriate bugs/fixes:

(new test case is prettyname.js from scenario (by eliminating the non digit and non alphabetical characters and making it pascal when joining such things)

tests.push({
                scenario: 'non-relative'
                , projectRoot: 'tests/cases/projects/non-relative'
                , inputFiles: ['consume.ts']
                , collectedFiles: ['consume.ts', 'decl.ts', 'lib/foo/a.ts', 'lib/foo/b.ts', 'lib/bar/a.ts']  //(highlighted file is imported in a.ts but the import isn’t used, so earlier we didn’t generate b.js now we do.

                , outputFiles: ['consume.js', 'decl.js', 'lib/bar/a.js', 'lib/foo/a.js']
                , baselineCheck: true
                , baselineFiles: ['base-consume', 'base-decl', 'lib/bar/base-a', 'lib/foo/base-a']   
                , path: 'cases/projects/non-relative/'
                , skipRun: true
            });

tests.push({
                scenario: 'baseline 2'
                , projectRoot: 'tests/cases/projects/baseline'
                , inputFiles: ['dont_emit.ts']
                , collectedFiles: ['dont_emit.ts', 'decl.ts'] // same as above
                , outputFiles: ['dont_emit.js']
                , baselineCheck: true
                , baselineFiles: ['base-dont-emit']
                , path: 'cases/projects/baseline/'
            });

tests.push({
                scenario: 'nested declare'
                , projectRoot: 'tests/cases/projects/NestedDeclare'
                , inputFiles: ['consume.ts']
                , collectedFiles: ['consume.ts']
                , outputFiles: <string[]>[] // File only with the ambient declares – shouldn’t emit anything -– earlier it didn’t.
                , skipRun: true
            });


  tests.push({
                scenario: 'nested local module - with recursive typecheck'
                , projectRoot: 'tests/cases/projects/NestedLocalModule-WithRecursiveTypecheck'
                , inputFiles: ['test1.ts']
                , collectedFiles: ['test1.ts', 'test2.ts']// test2.ts is not picked up and we don’t see the error below, but we do see error that cant find module.
                , outputFiles: <string[]>[] // test1.js is generated (earlier it wasn’t)
                , skipRun: true
                , negative: true
                , errors: [
                    TypeScript.Environment.absolutePath(Harness.userSpecifiedroot + "tests/cases/projects/NestedLocalModule-WithRecursiveTypecheck/test2.ts") + "(5,5): error TS2136: Import declarations in an internal module cannot reference an external module.",
                    TypeScript.Environment.absolutePath(Harness.userSpecifiedroot + "tests/cases/projects/NestedLocalModule-WithRecursiveTypecheck/test1.ts") + "(3,2): error TS2136: Import declarations in an internal module cannot reference an external module."
                ]
            });


  tests.push({
                scenario: 'nested local module - simple case'
                , projectRoot: 'tests/cases/projects/NestedLocalModule-SimpleCase'
                , inputFiles: ['test1.ts']
                , collectedFiles: ['test1.ts', 'test2.ts']
                , outputFiles: <string[]>[] // Same
                , skipRun: true
                , negative: true
                , errors: [
                    TypeScript.Environment.absolutePath(Harness.userSpecifiedroot + "tests/cases/projects/NestedLocalModule-SimpleCase/test1.ts") + "(2,2): error TS2136: Import declarations in an internal module cannot reference an external module.",
                ]
            });

            tests.push({ // Not sure what this test case is for and if matters, the order of sourcefiles is b.ts and a.js and the files are generated in same order.
                scenario: "module merging ordering 2"
                , projectRoot: 'tests/cases/projects/moduleMergeOrder'
                , inputFiles: ['b.ts', 'a.ts']
                , collectedFiles: ['a.ts', 'b.ts']
                , outputFiles: ['a.js']
                , skipRun: true
            });

    tests.push({
                scenario: "declarations_CascadingImports"
                , projectRoot: 'tests/cases/projects/declarations_CascadingImports'
                , inputFiles: ['useModule.ts']
                , collectedFiles: ['useModule.ts', 'm4.ts'] // Alias resolution error code looks like : declare module "quotedm1" {
    import m4 = require("m4");                     
    export class v {
        public c: m4.d;
    }
}

                , outputFiles: ['m4.js']
                , declareFiles: ['m4.d.ts', 'useModule.d.ts']
                , skipRun: true
            });


            tests.push({
                scenario: "Visibility of type used across modules - 2"
                , projectRoot: 'tests/cases/projects/InvalidReferences'
                , inputFiles: ['main.ts']
                , collectedFiles: ['main.ts']
                , outputFiles: ['main.js']
                , verifyEmitFiles: false
                , skipRun: true
                , negative: true
                , errors: [
                    TypeScript.Environment.absolutePath(Harness.userSpecifiedroot + 'tests/cases/projects/InvalidReferences/main.ts') + '(1,1): error TS5006: A file cannot have a reference to itself.' // The below error is missing
,
                    TypeScript.Environment.absolutePath(Harness.userSpecifiedroot + 'tests/cases/projects/InvalidReferences/main.ts') + '(2,1): error TS5007: Cannot resolve referenced file: \'nonExistingFile1.ts\'.',
                    TypeScript.Environment.absolutePath(Harness.userSpecifiedroot + 'tests/cases/projects/InvalidReferences/main.ts') + '(3,1): error TS5007: Cannot resolve referenced file: \'nonExistingFile2.ts\'.']
            });


tests.push({
                scenario: "outputdir_module_subfolder: specify outputFile"
                , projectRoot: 'tests/cases/projects/outputdir_module_subfolder'
                , inputFiles: ['test.ts']
                , collectedFiles: ['test.ts', 'ref/m1.ts']
                , outputFiles: ['ref/m1.js', 'test.js']  earlier we didn’t emit bin\test.js because other two were modules, but now we have empty bin\test.js
                , declareFiles: ['ref/m1.d.ts', 'test.d.ts'] 
                , verifyEmitFiles: true
                , outputOption: 'bin/test.js'
                , skipRun: true
            });

       tests.push({
                scenario: "outputdir_module_multifolder: specify outputFile"
                , projectRoot: 'tests/cases/projects/outputdir_module_multifolder'
                , inputFiles: ['test.ts']
                , collectedFiles: ['test.ts', 'ref/m1.ts', '../outputdir_module_multifolder_ref/m2.ts']
                , outputOption: 'bin/test.js'
                , outputFiles: ['ref/m1.js', '../outputdir_module_multifolder_ref/m2.js', 'test.js']  same as above
                , declareFiles: ['ref/m1.d.ts', '../outputdir_module_multifolder_ref/m2.d.ts', 'test.d.ts']
                , verifyEmitFiles: true
                , verifyFileNamesOnly: true
                , skipRun: true
            });
@mhegazy mhegazy added this to the TypeScript 1.1 milestone Jul 17, 2014
@vladima vladima assigned billti, mhegazy and danquirk and unassigned danquirk, billti and mhegazy Jul 22, 2014
@mhegazy mhegazy assigned sheetalkamat and unassigned danquirk Aug 11, 2014
@sheetalkamat
Copy link
Member

Scenarios :
'non-relative'
'baseline 2'
is by design, Earlier project testcase didn't check the collected and generated files correctly, this one checks. verified exact compilation using tsc with old and new compiler and results match

@sheetalkamat
Copy link
Member

'nested declare' testcase is by design and behaves same in both the compilers. Again incorrect check in old project test case runner compared to new one

@sheetalkamat
Copy link
Member

'nested local module - with recursive typecheck'
'nested local module - simple case'

Both these are better behaviours since External module alias declaration is not allowed in any other scope than global the program creation does not pick test2.ts since the alias for it is declared inside another module. Hence the difference but new compiler behavior is more accurate.

@sheetalkamat
Copy link
Member

"module merging ordering 2" the order in new compiler is correct

@sheetalkamat
Copy link
Member

"declarations_CascadingImports" does not give any error and the generated .d.ts files are correct

@sheetalkamat
Copy link
Member

Filed bug #568 for "Visibility of type used across modules - 2"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript By Design Deprecated - use "Working as Intended" or "Design Limitation" instead
Projects
None yet
Development

No branches or pull requests

4 participants