Coder Social home page Coder Social logo

ai-component-bundler's Introduction

ai-component-bundler Build Status

Provides functionality for bundling a component in a project.

Getting Started

Install the module with: npm i ai-component-bundler

var bundler = require('ai-component-bundler');
bundler(); // "awesome"

See how-to-setup-testing-using-typescript-mocha-chai-sinon-karma-and-webpack

Documentation

This library is part of ai-component and provides functionality for bundling installed components in a web app project.

Development

  • Clone the repo
  • npm i

The project setup is in part based on: how to setup testing using typescript mocha chai sinon karma and webpack

Gulp

Simply run gulp to build the project. To enable watch & compile: gulp watch

Webpack

Run webpack to create bundle in dist/bundle.js

To enable watch & compile: webpack --watch

Testing

Write test cases using mocha, chai and expect etc. in test/src The gulp tasks are configured to dump all test related output files to the /.tmp folder

Run gulp tests: npm test

Use mocha-webpack to run tests

npm run test-wp (see mocha-webpack)

Using Karma

  • karma start to start Karma server (in a process)
  • karma run to run tests (different process - communicating over server port)

Test Coverage

npm run cover to use Istanbul test coverage

E2E testing via Nightwatch

See Getting Started

Install nightwatch globally

npm i nightwatch -g

Install selenium server: brew install selenium

Brew might ask you to install the server standalone as follows:

brew install homebrew/versions/selenium-server-standalone245

Optionally adjust the nightwatch.json config file.

Launch nightwatch (default):

$ nightwatch

Run specific environment tests (as per entry under test_settings:

$ nightwatch --env chrome

Sinon

The project comes with support for sinon to test and mock server communication.

describe('MoviesViewModel', () => {
  let viewModel: MoviesViewModel;
  let movieDataServiceStub: Sinon.SinonSpy;

  beforeEach(() => {
    sinon.stub(movieDataService, 'loadMovies').returns([new Movie('The Matrix', 1998, 5)]);
    movieDataServiceStub = sinon.spy(movieDataService, 'save');
    viewModel = new MoviesViewModel();
  });

  afterEach(() => {
    sinon.restore(movieDataService.loadMovies);
    sinon.restore(movieDataService.save);
  });
  // ...  
})

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality.

Release History

License

Copyright (c) 2016 Kristian Mandrup Licensed under the MIT license.

ai-component-bundler's People

Contributors

kristianmandrup avatar

Watchers

 avatar  avatar  avatar

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.