Git Product home page Git Product logo

karma-jawr-sample's Introduction

Karma Jawr Sample

Build Status Coverage Status

The focus point is: Providing a way to show: how to write graceful javascript unittest in server render template engine.

Background

  • Spring Framework
  • Spring MVC
  • JAWR
  • JAWR Locale Message Generator
  • Ext3

Features

  • Karma + Mocha + Chai
  • Sinon
  • Integration with CI System

Problems

  • How to load necessary JS files into runtime easily? Because Java side uses JAWR as assets bundling tool to compact multiple JS files into one. Then Front-end uses <script> tags to include those bundles. This make it difficult to get the correct dependencies JS files.
  • How to mock the Locale Message Generator in global? Currently the JAWR Locale Message Generator is assigned as a property of the global object(We use it like locale.namesapce.field.a()). We need to construct this object when running test cases otherwise a lot of code will throw exception.
  • No best practice for Ext3 can be found from Internet

Plan: outline

Usage

Install Dependencies

mvn install && npm install

Build War & Deploy

You can deploy you war file in target/karma-jawr.war to your webapp container.(Tomcat, JBoss, Weblogic...)

Install Frontend UnitTest Dependencies

npm install

For China User, since puppeteer v0.13.0 support CHROMIUM binary download mirror.

Please export environment variables PUPPETEER_DOWNLOAD_HOST=https://npm.taobao.org/mirrors before npm install

For Windows Run

SET PUPPETEER_DOWNLOAD_HOST=https://npm.taobao.org/mirrors

Since 2018-03-13 cnpmjs.org network issue, found another mirror on taobao.org So you can also use this https://npm.taobao.org/mirrors

For Unix Run

export PUPPETEER_DOWNLOAD_HOST=https://npm.taobao.org/mirrors

Frontend UnitTest

npm test

karma-jawr-sample's People

Contributors

aquariuslt avatar yellowb avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

yellowb

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.