Closed Deepali17 closed 1 year ago
I might have some missing case To debug this, i need your app.component.ts Plz attach your simpified app.component.ts here
@allenhwkim i have tried with simple newly created application and component.
app.component.ts file having default code which generated at the time of application creation nothing new. Please resolve this soon
angular version 15.2.9
I tested with the following code and it works fine
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'ng15';
}
I published slightly modified version 1.5.1, and it works fine I also tested with version 1.5.0, and it also works fine(result attached here).
test/ng15 (main) $ ng version
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 15.2.9
Node: 18.16.0
Package Manager: npm 9.5.1
OS: darwin arm64
Angular: 15.2.9
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1502.9
@angular-devkit/build-angular 15.2.9
@angular-devkit/core 15.2.9
@angular-devkit/schematics 15.2.9
@schematics/angular 15.2.9
rxjs 7.8.1
typescript 4.9.5
test/ng15 (main) $ npm ls ngentest
ng15@0.0.0 /Users/allenkim/projects/test/ng15
└── ngentest@1.5.1
test/ng15 (main) $ ngentest src/app/app.component.ts
// @ts-nocheck
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { Pipe, PipeTransform, Injectable, CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA, Directive, Input, Output } from '@angular/core';
import { isPlatformBrowser } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { By } from '@angular/platform-browser';
import { Observable, of as observableOf, throwError } from 'rxjs';
import { Component } from '@angular/core';
import { AppComponent } from './app.component';
@Directive({ selector: '[oneviewPermitted]' })
class OneviewPermittedDirective {
@Input() oneviewPermitted;
}
@Pipe({name: 'translate'})
class TranslatePipe implements PipeTransform {
transform(value) { return value; }
}
@Pipe({name: 'phoneNumber'})
class PhoneNumberPipe implements PipeTransform {
transform(value) { return value; }
}
@Pipe({name: 'safeHtml'})
class SafeHtmlPipe implements PipeTransform {
transform(value) { return value; }
}
describe('AppComponent', () => {
let fixture;
let component;
beforeEach(() => {
TestBed.configureTestingModule({
imports: [ FormsModule, ReactiveFormsModule ],
declarations: [
AppComponent,
TranslatePipe, PhoneNumberPipe, SafeHtmlPipe,
OneviewPermittedDirective
],
schemas: [ CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA ],
providers: [
]
}).overrideComponent(AppComponent, {
}).compileComponents();
fixture = TestBed.createComponent(AppComponent);
component = fixture.debugElement.componentInstance;
});
afterEach(() => {
component.ngOnDestroy = function() {};
fixture.destroy();
});
it('should run #constructor()', async () => {
expect(component).toBeTruthy();
});
});
I also tested with the previous version 1.5.0 and it works fine too
test/ng15 (main) $ npm i ngentest@1.5.0
removed 1 package, changed 1 package, and audited 965 packages in 917ms
106 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
test/ng15 (main) $ npm ls ngentest
ng15@0.0.0 /Users/allenkim/projects/test/ng15
└── ngentest@1.5.0
test/ng15 (main) $ ngentest src/app/app.component.ts
// @ts-nocheck
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { Pipe, PipeTransform, Injectable, CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA, Directive, Input, Output } from '@angular/core';
import { isPlatformBrowser } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { By } from '@angular/platform-browser';
import { Observable, of as observableOf, throwError } from 'rxjs';
import { Component } from '@angular/core';
import { AppComponent } from './app.component';
@Directive({ selector: '[oneviewPermitted]' })
class OneviewPermittedDirective {
@Input() oneviewPermitted;
}
@Pipe({name: 'translate'})
class TranslatePipe implements PipeTransform {
transform(value) { return value; }
}
@Pipe({name: 'phoneNumber'})
class PhoneNumberPipe implements PipeTransform {
transform(value) { return value; }
}
@Pipe({name: 'safeHtml'})
class SafeHtmlPipe implements PipeTransform {
transform(value) { return value; }
}
describe('AppComponent', () => {
let fixture;
let component;
beforeEach(() => {
TestBed.configureTestingModule({
imports: [ FormsModule, ReactiveFormsModule ],
declarations: [
AppComponent,
TranslatePipe, PhoneNumberPipe, SafeHtmlPipe,
OneviewPermittedDirective
],
schemas: [ CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA ],
providers: [
]
}).overrideComponent(AppComponent, {
}).compileComponents();
fixture = TestBed.createComponent(AppComponent);
component = fixture.debugElement.componentInstance;
});
afterEach(() => {
component.ngOnDestroy = function() {};
fixture.destroy();
});
it('should run #constructor()', async () => {
expect(component).toBeTruthy();
});
});
test/ng15 (main) $
@Deepali17 please attach your app.component.ts
.
Closing, but I will l reopen this task when I can generate the error with your app.component.ts.
Have you tried version 1.5.1?
On Sun, Aug 27, 2023 at 1:24 PM Deepali Dhanotia @.***> wrote:
@allenhwkim https://github.com/allenhwkim still I am getting error
angular, node and npm version
[image: IMG_7174] https://user-images.githubusercontent.com/13298040/263544118-4fb3de37-6abc-4cd7-a91a-1a467510f7d1.jpeg
app.component.ts file
[image: IMG_7172] https://user-images.githubusercontent.com/13298040/263544136-912ec540-28ca-4c7d-807c-994d33bf83ba.jpeg
Error
[image: IMG_7173] https://user-images.githubusercontent.com/13298040/263544171-d8539254-b934-4574-89f1-eeb76c1c3876.jpeg
and before above error i was getting error for class, component, directive , pipe template.ts.ejs file so i copied that in src folder from ngentest repo after that its resolved but is it mandatory?
and please help me to resolve can’t read properties of null
or if you can share temporary repo where you tried above code and able to generate so i will cross verify project structure and configuration . I can try your repo at my system
— Reply to this email directly, view it on GitHub https://github.com/allenhwkim/ngentest/issues/65#issuecomment-1694719920, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAK7AJS56EMQBYD7R4GLIKTXXN7F7ANCNFSM6AAAAAA37XX67Q . You are receiving this because you were mentioned.Message ID: @.***>
I have re installed globally ngentest and now able to generate file. Thanks
Getting below error in Angular 15 , using windows "Error. invalid typescript file. e.g., Usage $0 [options]"
Tried from git bash and npm runkit ———————————————————————— from vs code terminal getting below error
PS C: \Users \xy \myNewApp \src \app> gentest app. component.ts -s TypeError: Cannot read properties of null (reading '1°) at run (C: \Users \xyz Appdata\ Roaming \pm \node modules \ngentest \ index. js:149:6) ® at Object. (C: \Users \xyz \AppData\Roaming \npm\node modules \ngentest\index. js:228:3)
at Module.
, compile (node: internal/modules/cjs/loader :1105:14) at Object.Module._extensions..js (node: internal/modules/cjs/loader: 1159:10) at Module. load (node: internal/modules/cjs/loader:981:32) at Function.Module. load (node: internal/modules/cjs/loader:822:12) at Function.executeUserEntryPoint [as runMain] (node: internal/modules/run main: 77:12) at node: internal/main/run main module: 17:47
PS C: \Users \xyz\myNewApp\sre \app› cd • \test\
PS C: \Users \xyz\myNewApp\src\app\test> gentest test.component.ts
• TypeError: Cannot read properties of null (reading
"1°)
at run (C: \users\xyz \AppData\ Roaming \pm \node modules Ingentest \index.
I have installed ngentest module locally and globally both
@allenhwkim could you please help here?