How to use the @angular/cli/utilities/get-dependent-files.getImportClauses function in @angular/cli

To help you get started, we’ve selected a few @angular/cli examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github angular / angular-cli / tests / acceptance / module-resolver.spec.ts View on Github external
.then((tsFile: ts.SourceFile) => {
          let contentsBaz = dependentFilesUtils.getImportClauses(tsFile);
          let barExpectedContent = path.normalize('../bar/bar.component');
          let fooBarExpectedContent =
            `.${path.sep}qux${path.sep}quux${path.sep}foobar${path.sep}foobar.component`;
          expect(contentsBaz[0].specifierText).toBe(barExpectedContent);
          expect(contentsBaz[1].specifierText).toBe(fooBarExpectedContent);
        })
        .then(done, done.fail);
github angular / angular-cli / tests / acceptance / module-resolver.spec.ts View on Github external
.then((tsFileFooQux: ts.SourceFile) => {
          let contentsFooQux = dependentFilesUtils.getImportClauses(tsFileFooQux);
          let fooQuxExpectedContent = path.normalize('../../../../foo/foobar.component');
          expect(contentsFooQux[0].specifierText).toBe(fooQuxExpectedContent);
        })
        .then(() => dependentFilesUtils.createTsSourceFile(bazFile))
github angular / angular-cli / tests / acceptance / module-resolver.spec.ts View on Github external
.then((tsFileBaz: ts.SourceFile) => {
          let contentsBaz = dependentFilesUtils.getImportClauses(tsFileBaz);
          let bazExpectedContent = path.normalize('../../foo/foobar.component');
          expect(contentsBaz[1].specifierText).toBe(bazExpectedContent);
        })
        .then(() => resolver.resolveOwnImports())
github angular / angular-cli / tests / acceptance / get-dependent-files.spec.ts View on Github external
.then((tsFile: ts.SourceFile) => {
          let contents = dependentFilesUtils.getImportClauses(tsFile);
          let expectedContents = [{
            specifierText: '../bar.component',
            pos: 13,
            end: 32
          }];
          expect(contents).toEqual(expectedContents);
        })
        .then(done, done.fail);
github angular / angular-cli / tests / acceptance / module-resolver.spec.ts View on Github external
.then((tsFileFooBar: ts.SourceFile) => {
          let contentsFooBar = dependentFilesUtils.getImportClauses(tsFileFooBar);
          let fooExpectedContent = `.${path.sep}foo.component`;
          let fooQuxExpectedContent = path.normalize('../foo-baz/qux/quux/fooqux.component');
          expect(contentsFooBar[0].specifierText).toBe(fooExpectedContent);
          expect(contentsFooBar[1].specifierText).toBe(fooQuxExpectedContent);
        })
        .then(done, done.fail);
github angular / angular-cli / tests / acceptance / module-resolver.spec.ts View on Github external
.then((tsFileFoo: ts.SourceFile) => {
          let contentsFoo = dependentFilesUtils.getImportClauses(tsFileFoo);
          let bazExpectedContent = path.normalize('../foo-baz/baz.component');
          expect(contentsFoo[0].specifierText).toBe(bazExpectedContent);
        })
        .then(() => resolver.resolveOwnImports())
github angular / angular-cli / tests / acceptance / module-resolver.spec.ts View on Github external
.then((tsFile: ts.SourceFile) => {
          let contents = dependentFilesUtils.getImportClauses(tsFile);
          let fooExpectedContent = path.normalize('../foo/foo.component');
          expect(contents[0].specifierText).toBe(fooExpectedContent);
        })
        .then(done, done.fail);
github angular / angular-cli / tests / acceptance / module-resolver.spec.ts View on Github external
.then((tsFileBar: ts.SourceFile) => {
          let contentsBar = dependentFilesUtils.getImportClauses(tsFileBar);
          let bazExpectedContent = path.normalize('../foo-baz/baz.component');
          expect(contentsBar[0].specifierText).toBe(bazExpectedContent);
        })
        .then(() => dependentFilesUtils.createTsSourceFile(fooFile))