Giter VIP home page Giter VIP logo

ngentest's Introduction

ngentest

Angular6,7,8,9,10,11,12,13,14,15,16 Unit Test Generator For Components, Directive, Services, and Pipes

Install & Run

$ npm install ngentest -D
$ npx ngentest -h          
Usage: index.js <tsFile> [options]

Options:
      --version     Show version number                                [boolean]
  -s, --spec        write the spec file along with source file         [boolean]
  -f, --force       It prints out a new test file, and it does not ask a
                    question when overwrite spec file                  [boolean]
  -v, --verbose     log verbose debug messages                         [boolean]
      --framework   test framework, jest or karma                       [string]
  -c, --config      The configuration file to load options from
                                        [string] [default: "ngentest.config.js"]
  -h                Show help                                          [boolean]

Examples:
  index.js my.component.ts  generate Angular unit test for my.component.ts

$ npx ngentest my.component.ts 
$ npx ngentest my.directive.ts -s # write unit test to my.directive.spec.ts
$ npx ngentest my.directive.ts -c ../ngentest.config.js # use different config file.

To see the source file and generated examples, please take a look at test-examples directory. https://github.com/allenhwkim/ngentest/tree/master/test-examples

Config

You can override configuration by creating a file named as ngentest.config.js in your application directory and running ngentest from that directory. You can also provide a configuration file using -c my.config.js. If you want to use your own config, refer the default config file

  • framework: jest or karma. The default is jest. This value determines how function mock and assert is to be done.

  • outputTemplates: template string for each type. Please specify your own template if you want to override the default template. There are five types;

    • klass: ejs template for an ES6 class without angular decorator.
    • component: ejs template for an Angular component.
    • directive: ejs template for an Angular directive.
    • injectable: ejs template for an Angular service.
    • pipe: ejs template for an Angular pipe.

    e.g.,

    outputTemplates: {
      klass: myKlassTemplate, 
      component: myComponentTemplate,
      directive: myDirectiveTemplate,
      injectable: myInjectableTemplate, 
      pipe: myPipeTemplate 
    }
  • directives: Array of diretive names, necessary for a component test. e.g.,

    directives: ['myDirective']
  • pipes: Array of pipe names, necessary for a component test. e.g.

    pipes: ['translate', 'phoneNumber', 'safeHtml']
  • replacements: There are some codes, which causes error without proper environment. You need to replace these codes. You can specify from value with regular expression and to value with string. e.g.

    replacements: [
      { from: '^\\S+\\.define\\(.*\\);', to: ''}`
    ]
  • providerMocks: When the following class is used in a constructor parameter, create a mock class with the given statements. e.g.

    providerMocks: {
      ElementRef: ['nativeElement = {};'],
      Router: ['navigate() {};'],
      Document: ['querySelector() {};'],
      HttpClient: ['post() {};'],
      TranslateService: ['translate() {};'],
      EncryptionService: [],
    }
module.exports = {
  framework: 'karma', // or 'jest'
  outputTemplates: {
    klass: klassTemplate,  // ejs contents read from file
    component: componentTemplate,
    directive: directiveTemplate,
    injectable: injectableTemplate, 
    pipe: pipeTemplate 
  },
  // necessary directives used for a component test
  directives: [
    // 'myCustomDirective' // my custom directive used over application
  ], 
  // necessary pipes used for a component test
  pipes: [
    'translate', 'phoneNumber', 'safeHtml'
  ],
  // when convert to JS, some codes need to be replaced to work 
  replacements: [ // some 3rd party module causes an error
    { from: '^\\S+\\.define\\(.*\\);', to: ''} // some commands causes error
  ],
  // when constructor param type is as following, create a mock class with this properties
  // e.g. @Injectable() MockElementRef { nativeElement = {}; }
  providerMocks: {
    ElementRef: ['nativeElement = {};'],
    Router: ['navigate() {};'],
    Document: ['querySelector() {};'],
    HttpClient: ['post() {};'],
    TranslateService: ['translate() {};'],
    EncryptionService: [],
  }
}

How It works

  1. Parse a Typescript file and find these info.

    • imports: imports statements info.
    • inputs: @Input statements info.
    • outputs: @Output statements info.
    • component provider: providers info used in @Component decorator.
    • selector: selector info used in @Component or @Directove decorator.
  2. Compile Typescript to Javascript, then parse the Javascript, and get the following info.

    • constructor param data
    • provider mock data
    • accessor tests
    • function tests
  3. build ejs data from #1 and #2, and generate test code.

For Developers:

Directory structure

  • api directory:

    • source code to run this as an API
    • To run local express server, node api/express-server.js
    • api/index.js is a structure used by Vercel
  • ejs-template directory:

    • default EJS templates for unit test generation
  • test directory:

    • All test files including unit test goes here
  • cli.js:

    • used as ngentest command
  • ngentest.config.js:

    • The default configuration file used by cli.js
  • vercel.json:

    • Used to deploy to https://ngentest.vercel.com/api/ngentest

Deployment to Vercel

Whenever main branch is updated, API https://ngentest.vercel.app/api/ngentest will be deployed by following vercel.json.
To see the usage of this API, refer this

To make it sure it does not break any feature

$ npm i

$ npm test
> [email protected] test
> node --test test/*.spec.js && node test/index.js
▶ TypescriptParser
...
▶ Util
...
passed check /Users/allenkim/projects/ngentest/test/test-examples/example.klass.ts
passed check /Users/allenkim/projects/ngentest/test/test-examples/example.component.ts
passed check /Users/allenkim/projects/ngentest/test/test-examples/example2.component.ts
passed check /Users/allenkim/projects/ngentest/test/test-examples/example3.component.ts
passed check /Users/allenkim/projects/ngentest/test/test-examples/example4.component.ts
passed check /Users/allenkim/projects/ngentest/test/test-examples/example5.component.ts
passed check /Users/allenkim/projects/ngentest/test/test-examples/example6.component.ts
passed check /Users/allenkim/projects/ngentest/test/test-examples/example7.component.ts
passed check /Users/allenkim/projects/ngentest/test/test-examples/example8.component.ts
passed check /Users/allenkim/projects/ngentest/test/test-examples/example9.component.ts
passed check /Users/allenkim/projects/ngentest/test/test-examples/exampleX.component.ts
passed check /Users/allenkim/projects/ngentest/test/test-examples/example.directive.ts
passed check /Users/allenkim/projects/ngentest/test/test-examples/example.service.ts
passed check /Users/allenkim/projects/ngentest/test/test-examples/example.pipe.ts
passed check /Users/allenkim/projects/ngentest/test/test-examples/example2.pipe.ts

ngentest's People

Contributors

allenhwkim avatar dependabot[bot] avatar desdevcharan avatar jacobmcgowan avatar mithunsaha19 avatar stamminator avatar tw3 avatar wdunn001 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ngentest's Issues

Invalid data type for services

Hi,

Many times my services inject other services in the constructor. The template assign them as an object '{}' which throws the error Argument of type '{}' is not assignable to parameter of type "serviceName".

Sample service.ts

export class DataService {
     constructor(private http: HttpClient) { }
}

Sample spec file generated

beforeEach(() => {
    service = new DataService({}); // ERROR: Argument of type '{}' is not assignable to parameter of type 'HttpClient'.
// Type '{}' is missing the following properties from type 'HttpClient': handler, request, delete, get, and 6 more.
});

tried to generate test and received error "Cannot read property 'match' of undefined"

(node:12436) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'match' of undefined
at forEach.param (C:\Users\Jason\AppData\Roaming\npm\node_modules\ngentest\src\get-directive-data.js:86:26)
at Array.forEach ()
at getDirectiveData (C:\Users\Jason\AppData\Roaming\npm\node_modules\ngentest\src\get-directive-data.js:53:43)
at parseTypescript.then.tsParsed (C:\Users\Jason\AppData\Roaming\npm\node_modules\ngentest\index.js:44:17)
at process._tickCallback (internal/process/next_tick.js:68:7)
at Function.Module.runMain (internal/modules/cjs/loader.js:834:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
(node:12436) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by
rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:12436) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Explain how to deal with paths and modules

I find hard to know how to run this.

Where do we need to run the command gentest?

How do we deal with modules and lazy loaded modules?

Ok, I didn't do a lot of research, I just created an app, a new component in folder and did this

ng new testing
cd testing
ng g c sample-test/sample

Now, I just don't know how to run the gentest command

Commands gentest sample-test/sample/sample.component.ts, gentest sample.component.ts :

internal/modules/cjs/loader.js:1033
  throw err;
  ^

Error: Cannot find module '/home/user/Desktop/testing/testing/sample-test/sample/sample.component.ts'
......

Command gentest src/app/sample-test/sample/sample.component.ts:

/home/user/Desktop/testing/testing/src/app/sample-test/sample/sample.component.ts:1
import { Component, OnInit } from '@angular/core';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at wrapSafe (internal/modules/cjs/loader.js:1117:16)
    at Module._compile (internal/modules/cjs/loader.js:1165:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1221:10)
    at Module.load (internal/modules/cjs/loader.js:1050:32)
    at Function.Module._load (internal/modules/cjs/loader.js:938:14)
    at Module.require (internal/modules/cjs/loader.js:1090:19)
    at require (internal/modules/cjs/helpers.js:75:18)
    at testFile (/home/santi/.nvm/versions/node/v14.5.0/lib/node_modules/gentest/bin/gentest.js:46:3)
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (/home/santi/.nvm/versions/node/v14.5.0/lib/node_modules/gentest/bin/gentest.js:30:14)

Thanks, I get you don't have to answer me and I can try to solve myself. But I have lots of things to do so I ask to save time.

Typescript-files with lodash

Is there any plan on making gentest to work with typescript files that have lodash imported?
I'm currently getting:

TypeError: Cannot read property 'map' of undefined
    at parsed.imports.forEach.mport (/usr/local/lib/node_modules/ngentest/src/lib/parse-typescript.js:27:39)
    at Array.forEach (<anonymous>)
    at parseTypescript (/usr/local/lib/node_modules/ngentest/src/lib/parse-typescript.js:26:18)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
    at Function.Module.runMain (module.js:678:11)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3

I have lodash imported the following way:

import * as _ from 'lodash';

Reference Error: document is undefined

When I run this command from the directory that contains my .ts file:
$ ngentest link-options.service.ts -s

I get this output:
ReferenceError: document is not defined

at Object. (C:\gitRepos\mdl_common\node_modules\custom-event\index.js:24:23)

at Module._compile (internal/modules/cjs/loader.js:689:30)

at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)

at Module.load (internal/modules/cjs/loader.js:599:32)

at tryModuleLoad (internal/modules/cjs/loader.js:538:12)

at Function.Module._load (internal/modules/cjs/loader.js:530:3)

at Module.require (internal/modules/cjs/loader.js:637:17)

at require (internal/modules/cjs/helpers.js:22:18)

at Object. (C:\gitRepos\mdl_common\node_modules\crossvent\src\crossvent.js:3:19)

at Module._compile (internal/modules/cjs/loader.js:689:30)

I am using the Full Example ngentest.config.js

Invalid typescript file error with latest ngentest version in angular 15

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?

if components refer to class definitions : ngentest fails

If components refer to class definitions and having functions : ngentest fails

eg: Basic Component but we import class definition , then we get error 'cannot find module' . But that is a class definition.

Eg: export class XYZ { .... }

Please let me know how to handle this issue.
Thanks

How to user karma?

Hello,

I have some questions:

  1. Where to place the config file? I have tried in project root and src folder and it didnt work
  2. What should be the format of the file? Just JSON? Or module exports? None of these work
  3. How to set up karma? In readme there should be framework: 'karma' but it does not work.

Error no such file ./node_modules/ngentest/src/templates/default.spec.ts.ejs

Error: ENOENT: no such file or directory, open './node_modules/ngentest/src/templates/default.spec.ts.ejs'
at Object.fs.openSync (fs.js:663:18)
at Object.fs.readFileSync (fs.js:568:33)
at Object.getEjsTemplate (./node_modules/ngentest/src/lib/util.js:26:13)
at parseTypescript.then.tsParsed (./node_modules/ngentest/index.js:28:28)
at
at process._tickCallback (internal/process/next_tick.js:160:7)
at Function.Module.runMain (module.js:703:11)
at startup (bootstrap_node.js:193:16)
at bootstrap_node.js:617:3

Happens in file with 2 export functions as the content of the .ts file.

Hi i am getting following typeError while running the command ngentest.

const tsFile = argv._[0].replace(/.spec.ts$/, '.ts');
^

TypeError: Cannot read property 'replace' of undefined at Object. (C:\Users\20122701\AppData\Roaming\npm\node_modules\ngentest\index.js:43:26)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3) at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
at startup (internal/bootstrap/node.js:283:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)

Please help me,
Thanks in advance.

No Support for Arrow Functions?

we have arrow functions as below

functionName = () => {
// SOME FUNCTION CODE
}

and It doesnt generate the unit tests cases for such methods/functions, anything can be done on this?

gentest vs. ngentest

What is the difference between ngentest and gentest?

Can they be used for different hings? The documentation is not clear on this and could be improved to explain the differences, if there are any. If there are no differneces, why do both commands exist?

Cannot find module '•/ejs-templates/class.template.js'

Hello @allenhwkim ,

I am trying to generate the test file for a seed project for app.component.ts file , I am using default ngentest.config.js .

Operating System : Windows
FrameWork :Jest

But, I am getting below error , Can you please give me hint what I am doing wrong ?

C: \AI\ang-auto-test>ngentest src/app/app.component.ts node: internal/modules/cjs/loader:1080
throw err;
Error: Cannot find module './ejs-templates/class.template.js'
Require stack:
- C: AI ang-auto-test ngentest.config-js
- C: \Users (xxx \AppData \Roaming\npm \node_modules \ngentest\cli.js
at Module. resolveFilename (node: internal/modules/cjs/loader: 1077:15) at Module._load (node: internal/modules/cjs/loader:922:27) at Module-require (node: internal/modules/cjs/loader:1143:19) at require (node: internal/modules/cjs/helpers:121:18)
at Object.‹anonymous> (C:\AI\ang-auto-test\ngentest.config•js:1:23)
at Module,_compile (node: internal/modules/cjs/loader:1256:14) at Module-_extensions.. js (node: internal/modules/cjs/loader:1310:10) at Module.load (node: internal/modules/cjs/loader: 1119:32) at Module._ load (node: internal/modules/cjs/loader: 960:12)
o at Module require (node:internal/modules/cjs/loader:1143:19) {
code: 'MODULE_NOT_FOUND* requireStack: [
*c:\AT\ang-auto-test\\ngentest.config.js',
'C: \User\xxx\ \AppDatal \Roaming\ \npm\ \node_modules|\ngentest||cli.js'

[QUESTION] How to mock properly

Hi, i'm trying to make the library work on a angular project with test in karma framework

  1. gentest seems to search for a ngentest.config.js in the current directory, not in my appdata node module folder.
  2. When i generate the unit test from this class

import { Component, Input } from '@angular/core';
import { FiltreLocalStorageService } from 'src/app/service/filter-local-storage/filter-local-storage.service';
import { FiltreDataService } from 'src/app/service/filtre-data/filtre-data.service';
import { SecurityService } from 'src/app/service/security/security.service';

@component({
selector: 'app-filtre-numero-serie',
templateUrl: './filtre-numero-serie.component.html',
styleUrls: ['./filtre-numero-serie.component.scss']
})
export class FiltreNumeroSerieComponent {

@input() vue: string;

numeroSerie: string = ''
placeholder: string = "Numéro de série"

constructor(private filtreDataService: FiltreDataService,private storageService :FiltreLocalStorageService,private securityService : SecurityService) { }

onKeyEnter(event: any) {
this.filtreDataService.updateFilter(this.vue, { numeroSerie: this.numeroSerie.trim() });
this.securityService.logUserActivityObservable('Vue Borne, utilisation du filtre: matricule valeur ' + this.numeroSerie)
}

getNumeroSerie(){
this.filtreDataService.updateFilter(this.vue, { numeroSerie: this.numeroSerie.trim() });
}

ngOnInit(){
let filtresInStorage = this.storageService.getFiltres(this.vue)
this.numeroSerie = filtresInStorage ? filtresInStorage.numSerie : ''
this.filtreDataService.subscribeToVue(this.vue,(filtreData) => this.numeroSerie = filtreData.numeroSerie)
}

}

I got this test generate

// @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 { FiltreNumeroSerieComponent } from './filtre-numero-serie.component';
import { FiltreDataService } from 'src/app/service/filtre-data/filtre-data.service';
import { FiltreLocalStorageService } from 'src/app/service/filter-local-storage/filter-local-storage.service';
import { SecurityService } from 'src/app/service/security/security.service';

@Injectable()
class MockFiltreDataService {}

@Injectable()
class MockFiltreLocalStorageService {}

@Injectable()
class MockSecurityService {}

@directive({ selector: '[myCustom]' })
class MyCustomDirective {
@input() myCustom;
}

.....

Mock are not generated properly, how can i config that ?

Thanks

Bugs on new versions

Hi there!

I want notice the team that i found two bugs on the last modifications.

  1. tsFilePath is not defined, should be used tsPath instead.
Screenshot 2023-09-04 at 09 47 08
  1. Util.FRAMEWORK never returns 'karma' value. It only returns 'jest' or true. Getter should be static get FRAMEWORK() { return Util.__framework ?? 'jest'; } or something similar.
Screenshot 2023-09-04 at 09 50 13

Thank you and regards,

Daniel.

Type error on get command help

I has received error when trying to get command help to list available params:

$ ngentest --help

/Users/dani/.nvm/versions/node/v10.22.0/lib/node_modules/ngentest/index.js:43
const tsFile = argv._[0].replace(/\.spec\.ts$/, '.ts');
                         ^

TypeError: Cannot read property 'replace' of undefined
    at Object.<anonymous> (/Users/dani/.nvm/versions/node/v10.22.0/lib/node_modules/ngentest/index.js:43:26)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)

Cannot read property 'foreach' of undefined.

I have this error when I try to use ngentest on directives, components ...

TypeError: Cannot read property 'forEach' of undefined
at parseTypescript (C:\Users\ybarbaria\AppData\Roaming\npm\node_modules\ngentest\src\lib\parse-typescript.js:55:20)
at
at process._tickCallback (internal/process/next_tick.js:118:7)
at Function.Module.runMain (module.js:692:11)
at startup (bootstrap_node.js:194:16)
at bootstrap_node.js:666:3

Angular 8.3.25 - Import errors and a mock not found

This is my spec:

// tslint:disable
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, APP_BASE_HREF } 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: [
        { provide: 'APP_BASE_HREF', useValue: APP_BASE_HREF }
      ]
    }).overrideComponent(AppComponent, {

      set: { providers: [{ provide: undefined, useClass: Mockundefined }] }    
    }).compileComponents();
    fixture = TestBed.createComponent(AppComponent);
    component = fixture.debugElement.componentInstance;
  });

  afterEach(() => {
    component.ngOnDestroy = function() {};
    fixture.destroy();
  });

  it('should run #constructor()', async () => {
    expect(component).toBeTruthy();
  });

  it('should run #ngOnInit()', async () => {

    component.ngOnInit();

  });

});

I have problem with line below:
import { Component, APP_BASE_HREF } from '@angular/core';
(APP_BASE_HREF) doesn't exist on @angular/core. I think that is moved to @angular/common

and the line:
set: { providers: [{ provide: undefined, useClass: Mockundefined }] }
"Cannot find name Mockundefined"

This is the component source:

import { Component, ViewEncapsulation, Inject, OnInit } from '@angular/core';
import { APP_BASE_HREF } from '@angular/common';

declare var jQuery: any;
declare var tinyMCE: any;

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss'],
  providers: [{ provide: APP_BASE_HREF, useValue: '/' }],
  encapsulation: ViewEncapsulation.None,
})
export class AppComponent implements OnInit {
  title = 'app';

  constructor(@Inject(APP_BASE_HREF) readonly href: string) { }

  public ngOnInit(): any {
    window['Pace'].on('start' , () => jQuery('.spinner').show());
    window['Pace'].on('done'  , () => jQuery('.spinner').hide());
    tinyMCE.baseURL = `${this.href}assets/js/tiny_mce`;
  }

}

className is not defined

While trying to run ngentest getting the below error,

ReferenceError: ejs:18
    16| <% } -%>
    17|
 >> 18| describe('<%= className %>', () => {
    19|   let fixture;
    20|   let component;
    21|

className is not defined
    at eval (eval at compile (/Users/XXXX/.nvm/versions/node/v9.4.0/lib/node_modules/ngentest/node_modules/ejs/lib/ejs.js:618:12), <anonymous>:30:26)
    at returnedFn (/Users/XXXX/.nvm/versions/node/v9.4.0/lib/node_modules/ngentest/node_modules/ejs/lib/ejs.js:653:17)
    at Object.exports.render (/Users/XXXX/.nvm/versions/node/v9.4.0/lib/node_modules/ngentest/node_modules/ejs/lib/ejs.js:416:37)
    at parseTypescript.then.tsParsed (/Users/XXXX/.nvm/versions/node/v9.4.0/lib/node_modules/ngentest/index.js:46:25)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:160:7)
    at Function.Module.runMain (module.js:703:11)
    at startup (bootstrap_node.js:193:16)
    at bootstrap_node.js:617:3

Generating mock fails

Invalid function argument expression Node {
  type: 'AssignmentExpression',
  start: 18,
  end: 45,
  operator: '=',
  left:
   Node {
     type: 'MemberExpression',
     start: 18,
     end: 37,
     object: Node { type: 'ThisExpression', start: 18, end: 22 },
     property:
      Node { type: 'Identifier', start: 23, end: 37, name: 'componentError' },
     computed: false },
  right:
   Node { type: 'Identifier', start: 40, end: 45, name: 'error' } }
Error: Invalid function argument type, AssignmentExpression
    at node.arguments.map.arg (c:\devsbb\eaio\nodejs\node_modules\ngentest\src\util.js:266:15)
    at Array.map (<anonymous>)
    at Function.getFuncArgNames (c:\devsbb\eaio\nodejs\node_modules\ngentest\src\util.js:242:37)
    at Function.getExprMembers (c:\devsbb\eaio\nodejs\node_modules\ngentest\src\util.js:213:44)
    at Function.getObjectFromExpression (c:\devsbb\eaio\nodejs\node_modules\ngentest\src\util.js:290:30)
    at FuncTestGen.setPropsOrParams (c:\devsbb\eaio\nodejs\node_modules\ngentest\src\func-test-gen.js:241:18)
    at FuncTestGen.setMockData (c:\devsbb\eaio\nodejs\node_modules\ngentest\src\func-test-gen.js:159:12)
    at FuncTestGen.setMockData (c:\devsbb\eaio\nodejs\node_modules\ngentest\src\func-test-gen.js:72:12)
    at FuncTestGen.setMockData (c:\devsbb\eaio\nodejs\node_modules\ngentest\src\func-test-gen.js:152:14)
`


Original code:
`
export class EntitiesListComponent implements OnDestroy {
  entities = this.entityService.Entities;
  componentError: string;

  private componentDestoryed = new Subject();
  private setComponentError = (error: string) => throwError(this.componentError = error);

  constructor(
    private entityService: EntityService,
    private navbarService: NavbarService
  ) {
    this.navbarService.navbarSubtitle.next('Title');
    this.initializeErrors();
  }
`

probably parser issue with:
  private setComponentError = (error: string) => throwError(this.componentError = error);

Framework Options not supported if we use the package directly in our code

As you can see framework options is picked from options only in case of cli.js
image

when we are directly importing the ngentest function and using it the cli does not get called I believe.

Resulting the test generated are always in jest and not in karma.

The proposed solution is to pick framework from options when we are directly importing the ngentest in our code.

I am working on a vscode extesnion using this which already being published at https://marketplace.visualstudio.com/items?itemName=KetanTiwari.ngen-utc-vscode

and here is the code - https://github.com/k3t4ngit/ngen-utc-vscode.

I will raise a pr for the same.

[QUESTION]: how to generate for Karma?

in my project/ngentest.config.js:

const fs = require('fs');
const path = require('path');

module.exports = {
   framework: 'karma',
}

Now in project/app/src/my-component:

ngentest my-component.ts

but one of the lines it is still:

jest.fn().mockReturnValue({

and not

karma.fn().mockReturnValue({

?

I simply change from jest to karma in this case?

How do we fix exported functions?

Hi,

I have a ts file in which I'm exporting some functions directly.
Example -

export function routerTransitionRight() {
  return slideToRight();
}

I'm importing it in my component as

import { routerTransitionLeft } from './list.animations';

When testing for the component I'm getting the error

list_animations_1.routerTransitionRight is not a function

Any way to fix it?

does not work with nrwl nx

I tried to generate a test in a project that uses nrwl and is not able to find modules

Error: Cannot find module '@scwx/utils-alerts'
Require stack:
- 
- /usr/local/lib/node_modules/ngentest/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1080:15)
    at Function.Module._load (internal/modules/cjs/loader.js:923:27)
    at Module.require (internal/modules/cjs/loader.js:1140:19)
    at require (internal/modules/cjs/helpers.js:75:18)
    at Object.<anonymous> (<anonymous>:13:24)
    at Module._compile (internal/modules/cjs/loader.js:1251:30)
    at requireFromString (/usr/local/lib/node_modules/ngentest/node_modules/require-from-string/index.js:28:4)
    at run (/usr/local/lib/node_modules/ngentest/index.js:151:21)
    at Object.<anonymous> (/usr/local/lib/node_modules/ngentest/index.js:220:3)
    at Module._compile (internal/modules/cjs/loader.js:1251:30) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '', '/usr/local/lib/node_modules/ngentest/index.js' ]
}

ReferenceError: HTMLElement is not defined

While running gentest <.ts>

ReferenceError: HTMLElement is not defined

at /home/mari.satheesh/Documents/git_repos/devops/dashboard/buildboard/angular/eng-dashboard/node_modules/@angular/elements/bundles/elements.umd.js:725:7
    at /home/mari.satheesh/Documents/git_repos/devops/dashboard/buildboard/angular/eng-dashboard/node_modules/@angular/elements/bundles/elements.umd.js:8:68
    at Object.<anonymous> (/home/mari.satheesh/Documents/git_repos/devops/dashboard/buildboard/angular/eng-dashboard/node_modules/@angular/elements/bundles/elements.umd.js:11:2)
    at Module._compile (node:internal/modules/cjs/loader:1155:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
    at Module.load (node:internal/modules/cjs/loader:1033:32)
    at Function.Module._load (node:internal/modules/cjs/loader:868:12)
    at Module.require (node:internal/modules/cjs/loader:1057:19)
    at require (node:internal/modules/cjs/helpers:103:18)

ngentest is not working when working with ngrx store pattern

I am using ngrx architecture for my project. If i try to generate autogenrated test cases using ngentest , it gives me error

node:18676) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'match' of undefined
    at forEach.param (C:\Users\akatta\AppData\Roaming\npm\node_modules\ngentest\src\get-directive-data.js:86:26)
    at Array.forEach (<anonymous>)
    at getDirectiveData (C:\Users\akatta\AppData\Roaming\npm\node_modules\ngentest\src\get-directive-data.js:53:43)
    at parseTypescript.then.tsParsed (C:\Users\akatta\AppData\Roaming\npm\node_modules\ngentest\index.js:44:17)
    at process.runNextTicks [as _tickCallback] (internal/process/next_tick.js:47:5)
    at Function.Module.runMain (internal/modules/cjs/loader.js:865:11)
    at internal/main/run_main_module.js:21:11
(node:18676) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:18676) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

ngentest.config.js is not reflecting changes

I am using karma framework and on changing ngentest.config.js for providing mock implementations, the changes are not being reflected on the spec file generated.

In the screenshot below you can see that a mock implementation of HttpClient get() function is provided.
Screenshot 2020-04-06 at 12 34 40 PM

But the spec file does not reflect that
Screenshot 2020-04-06 at 12 37 06 PM

How can I fix this issue? I have saved the config file in the root directory of the project.

Error generating for close method

When i have a component with this method, i receved this error, have some replace i can do to resolve?

 private closeLoadJava() {
        if (typeof (<any>window).closeLoad === "function") {
            (<any>window).closeLoad();
        }
    }
TypeError: target[firstKey] is not a function
at Function.merge (C:\Users\caugustr\AppData\Roaming\npm\node_modules\ngentest\src\util.js:150:88)
at Function.merge (C:\Users\caugustr\AppData\Roaming\npm\node_modules\ngentest\src\util.js:176:12)
at FuncTestGen.setPropsOrParams (C:\Users\caugustr\AppData\Roaming\npm\node_modules\ngentest\src\func-test-gen.js:279:14)
at FuncTestGen.setMockData (C:\Users\caugustr\AppData\Roaming\npm\node_modules\ngentest\src\func-test-gen.js:161:12)
at FuncTestGen.setMockData (C:\Users\caugustr\AppData\Roaming\npm\node_modules\ngentest\src\func-test-gen.js:90:12)
at C:\Users\caugustr\AppData\Roaming\npm\node_modules\ngentest\src\func-test-gen.js:80:14
at Array.forEach (<anonymous>)
at FuncTestGen.setMockData (C:\Users\caugustr\AppData\Roaming\npm\node_modules\ngentest\src\func-test-gen.js:79:17)
at FuncTestGen.setMockData (C:\Users\caugustr\AppData\Roaming\npm\node_modules\ngentest\src\func-test-gen.js:104:12)
at C:\Users\caugustr\AppData\Roaming\npm\node_modules\ngentest\index.js:78:17

Feature Request

In the func-test-gen.js we can add the two more statements in the ignore list.

i.e.

      'ContinueStatement',
      'DebuggerStatement'

Thanks

Incomplete guide for config file

Greetings

The readme could have a nicer explanation on how to create the ngentest.config.js. I believe just providing a snippet as example would suffice.

In my case I just want to configure the testing framework to use Karma (Angular CLI default)

Thanks

Error when generating spec file

Hi

When I run "ngentest count-down/count-down.component.ts > count-down/count-down.component.spec.ts" or "ngentest count-down/count-down.component.ts -s"

I get the following error (see below)

Error:
(node:5508) UnhandledPromiseRejectionWarning: TypeError: Cannot read property '1' of null
    at forEach.method (/home/integra/.nvm/versions/node/v10.15.0/lib/node_modules/ngentest/src/lib/parse-typescript.js:71:85)
    at Array.forEach (<anonymous>)
    at parseTypescript (/home/integra/.nvm/versions/node/v10.15.0/lib/node_modules/ngentest/src/lib/parse-typescript.js:65:25)
    at process._tickCallback (internal/process/next_tick.js:68:7)
    at Function.Module.runMain (internal/modules/cjs/loader.js:745:11)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
(node:5508) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:5508) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

The code file looks like this

imports .....

@Component({
  selector: 'edge-count-down',
  templateUrl: './count-down.component.html',
  styleUrls: ['./count-down.component.scss'],
  encapsulation: ViewEncapsulation.None
})
export class CountDownComponent implements OnInit, OnChanges {
  @Input() seconds: number;
  @Input() name: string;
  countdown: string;

  constructor() {}

  ngOnInit() {}

  ngOnChanges(changes: SimpleChanges) { }

  startCountdownTimer() {
    detail removed for brevity...  
  }
}

VS code extension

I think this is the best unit test generator for angular - the code is clear.
Would be nice to have a visual studio code extension.
I configured the Run context menu extension to work with it.

Invalid Typescript File

when i run ngentest app.component.ts, i get:

Error. invalid typescript file. e.g., Usage $0 [options]

my ngentest.config.js file:

const fs = require('fs');
const path = require('path');
const klassTemplate = fs.readFileSync(path.join(__dirname, 'src', 'class', 'class.template.ts.ejs'), 'utf8');
const componentTemplate = fs.readFileSync(path.join(__dirname, 'src', 'component', 'component.template.ts.ejs'), 'utf8');
const directiveTemplate = fs.readFileSync(path.join(__dirname, 'src', 'directive', 'directive.template.ts.ejs'), 'utf8');
const injectableTemplate = fs.readFileSync(path.join(__dirname, 'src', 'injectable', 'injectable.template.ts.ejs'), 'utf8');
const pipeTemplate = fs.readFileSync(path.join(__dirname, 'src', 'pipe', 'pipe.template.ts.ejs'), 'utf8');

module.exports = {
  framework: 'karma', // or 'jest'
  templates: {
    klass: klassTemplate,  // ejs contents read from file
    component: componentTemplate,
    directive: directiveTemplate,
    injectable: injectableTemplate,
    pipe: pipeTemplate
  },
  // necessary directives used for a component test
  directives: [
    'oneviewPermitted'
  ],
  // necessary pipes used for a component test
  pipes: [
    'translate', 'phoneNumber', 'safeHtml'
  ],
  // when convert to JS, some codes need to be replaced to work
  replacements: [ // some 3rd party module causes an error
    { from: 'require\\("html-custom-element"\\)', to: '{}'},
    { from: '^\\S+\\.define\\(.*\\);', to: ''} // some commands causes error
  ],
  // when constructor param type is as following, create a mock class with this properties
  // e.g. @Injectable() MockElementRef { nativeElement = {}; }
  providerMocks: {
    ElementRef: ['nativeElement = {};'],
    Router: ['navigate() {};'],
    Document: ['querySelector() {};'],
    HttpClient: ['post() {};'],
    TranslateService: ['translate() {};'],
    EncryptionService: [],
  },
  // when ngentest runs with a directory, include only these files
  includeMatch: [/(component|directive|pipe|service).ts/],
  // when ngentest runs with a directory, exclude these files
  excludeMatch: []
}

Getting error when trying to generate unit test

I used the following command on a component and a guard file

ngentest some-guard.guard.ts

I got the following response

Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/myuser/Code/app/node_modules/@angular/core/fesm2015/core.mjs not supported.
Instead change the require of /Users/myuser/Code/app/node_modules/@angular/core/fesm2015/core.mjs to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (<anonymous>:10:16)
    at requireFromString (/usr/local/lib/node_modules/ngentest/node_modules/require-from-string/index.js:28:4)
    at run (/usr/local/lib/node_modules/ngentest/index.js:159:21)
    at Object.<anonymous> (/usr/local/lib/node_modules/ngentest/index.js:228:3) {
  code: 'ERR_REQUIRE_ESM'
}

I'm using the following versions

node: v16.13.1
yarn: 1.22.15

Cannot find module

Error: Cannot find module '@sct-ng2/compatibility/services/config.service'
code: 'MODULE_NOT_FOUND',
requireStack: [ '', '/usr/local/lib/node_modules/ngentest/index.js' ]

I guess this tool can't handle paths or moduleNameMapper in the same manner as tsconfig and jest config provides.

"@sct-ng2/": ["src/app/"]

npm install fails with check-engines: command not found

When trying to install ngentest via npm the install fails.

The npm error log is below:

`➜ ~ npm install ngentest -g

[email protected] preinstall /Users/***/.nvm/versions/node/v10.5.0/lib/node_modules/ngentest
check-engines

sh: check-engines: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! [email protected] preinstall: check-engines
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] preinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.`

error TS1127: Invalid character error in ngentest generated spec file when using Jasmine/Karma

Hi Alan

Thanks again for your work - this looks like a great tool! I'm getting the following issue with an ngentest generated test, with Jasmine and Karma, when running ng test in the terminal:

error TS1127: Invalid character error

Full details here:

https://stackoverflow.com/questions/57799360/error-ts1127-invalid-character-when-running-karma-tests-in-angular-7

I tried uninstalling and re-installing Jasmine + Karma, removing the ngentest generated file, building, then regenerating the spec file, doing an npm run build, then ng test - same issue. Here's exactly what I did when I uninstalled and re-installed:

npm uninstall karma-jasmine
npm uninstall karma
npm uninstall jasmine
npm uninstall jasmine-core
npm uninstall jasmine-spec-reporter
npm uninstall karma-jasmine-html-reporter

remove following from package.json

"@types/jasmine": "~3.3.12",
"@types/jasminewd2": "^2.0.6",

"karma-chrome-launcher": "~2.2.0",
"karma-cli": "~2.0.0",
"karma-coverage-istanbul-reporter": "^2.0.5",

npm install


npm install karma-jasmine
npm install karma
npm install jasmine
npm install jasmine-core
npm install jasmine-spec-reporter
npm install karma-jasmine-html-reporter
npm install karma-chrome-launcher
npm install karma-cli
npm install karma-coverage-istanbul-reporter
npm install -save @types/jasmine
npm install -save @types/jasminewd2
npm i ngentest

npm install

remove app.component.spec.ts

npm run build
ng test (to verify that karma-jasmine is working correctly)

ngentest app.component.ts > app.component.spec.ts
npm run build
ng test


my package.json is now:

"dependencies": {
"@angular/animations": "^7.2.13",
"@angular/common": "^7.2.13",
"@angular/compiler": "^7.2.13",
"@angular/core": "^7.2.13",
"@angular/forms": "^7.2.15",
"@angular/http": "^7.2.15",
"@angular/platform-browser": "^7.2.13",
"@angular/platform-browser-dynamic": "^7.2.13",
"@angular/router": "^7.2.13",
"@aspnet/signalr": "^1.1.4",
"@ecotech/common-angular-dashboard-lib": "^7.0.2",
"@ecotech/common-angular-widgets-lib": "^7.0.30",
"@fortawesome/angular-fontawesome": "^0.3.0",
"@fortawesome/fontawesome-svg-core": "^1.2.22",
"@ngx-translate/i18n-polyfill": "^1.0.0",
"@types/jasmine": "^3.4.0",
"@types/jasminewd2": "^2.0.6",
"bootstrap": "^4.3.1",
"core-js": "^2.6.5",
"font-awesome": "^4.7.0",
"highcharts": "^7.1.1",
"jasmine": "^3.4.0",
"jasmine-core": "^3.4.0",
"jasmine-spec-reporter": "^4.2.1",
"karma": "^4.3.0",
"karma-chrome-launcher": "^3.1.0",
"karma-cli": "^2.0.0",
"karma-coverage-istanbul-reporter": "^2.1.0",
"karma-jasmine": "^2.0.1",
"karma-jasmine-html-reporter": "^1.4.2",
"ng2-dragula": "^1.5.0",
"ngentest": "^0.4.1",
"ngx-bootstrap": "^4.0.1",
"ngx-toastr": "^10.0.2",
"popper.js": "^1.15.0",
"rxjs": "^6.5.1",
"rxjs-compat": "^6.5.1",
"zone.js": "~0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.13.9",
"@angular-devkit/core": "7.3.8",
"@angular/cli": "^7.3.9",
"@angular/compiler-cli": "^7.2.15",
"@angular/language-service": "^7.2.15",
"@fortawesome/pro-light-svg-icons": "^5.10.2",
"@fortawesome/pro-regular-svg-icons": "^5.10.2",
"@fortawesome/pro-solid-svg-icons": "^5.10.2",
"@types/node": "^11.13.7",
"acorn": "^6.1.1",
"codelyzer": "~5.0.0",
"concurrently": "^4.1.2",
"ncp": "^2.0.0",
"ngx-i18nsupport": "^0.17.1",
"protractor": "^5.4.2",
"ts-node": "~8.1.0",
"tslint": "^5.16.0",
"typescript": "^3.2.4",
"webpack-bundle-analyzer": "^3.3.2"
}

Regarding automation of test files in angular project

When we use the command "gentest view-details.service.ts",
we get the following structure.

import { async } from '@angular/core/testing';
import {ViewDetailsService} from './view-details.service';

describe('ViewDetailsService', () => {
  let service;

  const http: any = {
    // mock properties here
  }

  beforeEach(() => {
    service = new ViewDetailsService(http);
  });

  it('should run #view()', async () => {
    // const result = view();
  });

  it('should run #delete()', async () => {
    // const result = delete(bookingId);
  });

});

Now what I want to do is, I want to automate the process of writing functional tests.But I don't know how to do it.Kindly help me.Thanks in advance.

Invalid typescript file - have tried the solutions in the closed issue

Hi,

I've installed gentest and created ngentest.config.js file.

Have tried running ngentest task-form.components.js in the file folder using the terminal in Visual Studio, using gitbash, using ./task-form.components.js, using the full path, using -c ngentest.config.js at the end of the command. Seems whatever I try I get an error

$ ngentest task-form.components.ts -c ../ngentest.config.js
Error. invalid typescript file. e.g., Usage $0 [options]

Any ideas of what to try next please?

Thanks,
Amanda

angular 5

unable to pass the test cases with angular 5
only dependency ijection are passed and the rest are getting failed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.