'Tools'에 해당되는 글 32건

[Jasmine] Spies

Tools/jasmine 2016. 7. 29. 13:42
donaricano-btn

Spies

- We want to be able to check if functions have been called so We use it Spies

- It lets you spy on pieces of your program


1. spyOn()

1_1 src


1_2. spec

 

- This will spy on this fake person's sayHello() method.

'Tools > jasmine' 카테고리의 다른 글

[Jasmine] Matcher  (0) 2016.07.29
[Jasmine] Jasmine  (0) 2016.07.21
블로그 이미지

리딩리드

,

[Jasmine] Matcher

Tools/jasmine 2016. 7. 29. 11:46
donaricano-btn

Matcher

- There are more matchers and I can make my own matchers


1. MoreMatchers

1) toEqual()

- It compare both objects If it is equal or not

2) toMatch()

    - toMatch() matcher is for regular expression


3) toBeDefine()

- The toBeDefined() matcher compares againt 'undefined'

 

4) toContain()

- The toContain() matcher is for finding an item in an Array

 

'Tools > jasmine' 카테고리의 다른 글

[Jasmine] Spies  (0) 2016.07.29
[Jasmine] Jasmine  (0) 2016.07.21
블로그 이미지

리딩리드

,

[Jasmine] Jasmine

Tools/jasmine 2016. 7. 21. 14:18
donaricano-btn

Jasmine


1. What is the Jasmine?

- Jasmine is a behavior-driven testing framework for Javascript

- Jasmine is an automated testing framework 


2. How to get

- There are two ways to get a jasmine

1) download zip 

- https://github.com/jasmine/jasmine/releases

2)  npm

2_0. install

# Local installation:

npm install --save-dev jasmine

# Global installation

npm install -g jasmine

2_1. Init

- jasmine init

- jasmine examples

2_2. Usage

- jasmine


3. Usage

3_0. Src


3_1. Spec

 1) suite 

- describe("Hello.....) What we call a suite

- This is basically a component of your application

- This suite is called "Hello World"

2) spec

- it()

- This is called a spec

- For each suite, you can have a bajillion specs for the bajillion tests you want to do

3) matcher

- We're testing if helloworld() does equal "Hello world".

- This check is called a matcher

- I can also make my own matcher


3_2. SpecRunner

1) SpecRunner.html

2) view



'Tools > jasmine' 카테고리의 다른 글

[Jasmine] Spies  (0) 2016.07.29
[Jasmine] Matcher  (0) 2016.07.29
블로그 이미지

리딩리드

,
donaricano-btn

Using a package.json

- The best way to manage locally installed npm packages is to create a package.json file


1.package.json

1) It serves as documentation for what packages your project depends on

2) It allows you to specify the versions of package that your project can use using semantic versioning rules

3) Makes your build reproducable which means that its way easier to share with other developer


2. Requirements

- a package.json must have

1) name

2) version


3. Creating a package.json

3_1. To create a package.json

- This will initate a command line questionnaire that will conclude with the creation of a package.json in the directory you initiated the command


3_2. The --yes init flag

- If you are comfortable with using a package.json you'd like a more expedited experience

you can get a default package.json by running npm init with the --yes or -y flag

- This will ask you only one question, Author, Otherwise it will fill in default values


4. Specifying packages

- To specify the packages your project depends on, you need to list packages you'd like to use in your package.json file.

- There are 2 types of packages you can list


1) dependencies : these packages are required by your application in production

2) devDependencies : these packages are only needed for development and testing


4_1. Manually editing your package.json

- You can manually edit your package.json. You'll need to create an attribute in the package object called dependencies that points to an object.

- If you have dependencies you only need to use during local development,


4_2. The --save and --save-dev install flags

- To add an entry to your package.json's dependencies:

- To add an entry to your package.json's devDependencies:








'Tools > npm' 카테고리의 다른 글

[npm] Installing npm packages  (0) 2016.06.21
[npm] 1. What is NPM?  (0) 2016.02.23
블로그 이미지

리딩리드

,