Giter Site home page Giter Site logo

aurelia-webpack-test's Introduction

aurelia-skeleton-webpack

Getting started

Before you start, make sure you have a recent version of NodeJS environment >=6.0 with NPM 3 or Yarn.

From the project folder, execute the following commands:

npm install # or: yarn install

This will install all required dependencies, including a local version of Webpack that is going to build and bundle the app. There is no need to install Webpack globally.

To run the app execute the following command:

npm start # or: yarn start

This command starts the webpack development server that serves the build bundles. You can now browse the skeleton app at http://localhost:8080 (or the next available port, notice the output of the command). Changes in the code will automatically build and reload the app.

Running with Hot Module Reload

If you wish to try out the experimental Hot Module Reload, you may run your application with the following command:

npm start -- webpack.server.hmr

Feature configuration

Most of the configuration will happen in the webpack.config.js file. There, you may configure advanced loader features or add direct SASS or LESS loading support.

Bundling

To build an optimized, minified production bundle (output to /dist) execute:

npm start -- build

To build

To test either the development or production build execute:

npm start -- serve

The production bundle includes all files that are required for deployment.

Running The Tests

This skeleton provides three frameworks for running tests.

You can choose one or two and remove the other, or even use all of them for different types of tests.

By default, both Jest and Karma are configured to run the same tests with Jest's matchers (see Jest documentation for more information).

If you wish to only run certain tests under one of the runners, wrap them in an if, like this:

if (jest) {
  // since only jest supports creating snapshot:
  it('should render correctly', () => {
    expect(document.body.outerHTML).toMatchSnapshot();
  });
}

Jest + Jasmine 2

Jest is a powerful unit testing runner and framework. It runs really fast, however the tests are run under NodeJS, not the browser. This means there might be some cases where something you'd expect works in reality, but fails in a test. One of those things will be SVG, which isn't supported under NodeJS. However, the framework is perfect for doing unit tests of pure functions, and works pretty well in combination with aurelia-testing.

To create new Jest tests, create files with the extension .spec.js, either in the src directory or in the test/unit directory.

To run the Jest unit tests, run:

npm test

To run the Jest watcher (re-runs tests on changes), run:

npm start -- test.jest.watch

Karma + Jasmine 2

Karma is also a powerful test runner, which by default runs in the browser. This means that whatever works in real browsers, should also work the same way in the unit tests. But it also means the framework is heavier to execute and not as lean to work with.

To ease transitioning between Jest and Karma, Jasmine 2 is configured with Jest's matchers.

To create new Karma tests, create files with the extension .spec.js, either in the src directory or in the test/unit directory.

To run the Karma unit tests, run:

npm start -- test.karma

To run the Karma watcher (re-runs tests on changes), run:

npm start -- test.karma.watch

Protractor (E2E / integration tests)

Integration tests can be performed with Protractor.

  1. Place your E2E-Tests into the folder test/e2e and name them with the extension .e2e.js.

  2. Run the tests by invoking

npm start -- e2e

Running all test suites

To run all the unit test suites and the E2E tests, you may simply run:

npm start -- test.all

aurelia-webpack-test's People

Watchers

 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.