Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

docs: update #275

Merged
merged 7 commits into from
Jun 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 25 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* [puppeteer](https://github.com/GoogleChrome/puppeteer) (High-level Headless Chrome Node API - experimental): puppeteer

## Introduction

`after-work.js` aims to be a tool that facilitates the testing while development or restructuring code.
Designed for test and provide fast feedback on changed code and added testcases.

Expand All @@ -29,25 +30,36 @@ To configure `after-work.js` you need to start with an analyse of the code.
## Get started

### Installation

Install the module using npm:

```sh
npm install --save-dev @after-work.js/aw
```

### CLI entrypoint

`after-work.js` is CLI and consists of a command together with appropriate options
Help is always available with the `--help, -h` option
```
aw <command>

Commands:
aw node Run tests in node [default]
aw protractor Run protractor [aliases: ptor]
aw cdp Run tests with cdp (chrome devtools protocol) [aliases: chrome]
aw serve Serve files
aw puppeteer Run tests with puppeteer [aliases: puppet]

```sh
npx aw -h
npx aw chrome -h
npx aw protractor -h
npx aw serve -h
npx aw puppeteer -h
```

| Command | Description | Alias | Default | Experimental |
| ---------- | ----------------------------------------------- | ------ | :-----: | :----------: |
| node | Run tests in node. | | x | |
| cdp | Run tests in Chrome (chrome devtools protocol). | chrome | | |
| protractor | Run tests with Protractor. | ptor | | |
| serve | Serve files. | | | |
| puppeteer | Run tests with Puppeteer. | puppet | | x |

---

All commands support passing a config file for all options.

```sh
Expand All @@ -68,16 +80,20 @@ This will only run the current active file. And you don't have to worry about yo
since `after-work.js` will automatically detect running a debugger and set the appropriate options accordingly.

## Included Tools

The following tools are bundled into after-work.js:

* [Mocha](https://mochajs.org/): an extensible testing framework for TDD or BDD.
* [Chai](http://chaijs.com/): an assertion library used together with a JavaScript testing framework.
* [Sinon](http://sinonjs.org/): a framework for standalone test spies, stubs and mocks for JavaScript.
* [Nyc](https://istanbul.js.org/): the Istanbul command line interface

## Examples

* [Node](./examples/node/README.md)

Browser

* [ES2015](./examples/es2015/README.md)
* [Requirejs](./examples/requirejs/README.md)
* [Typescript](./examples/typescript/README.md)
Expand Down
2 changes: 1 addition & 1 deletion docs/cdp.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,6 @@ Check Mochas [**list**](https://mochajs.org/#reporters) for valid options.

| Description | Type | Default |
| ---------------------------------------- | ------ | --------- |
| Directory to output coverage reports in. | string | 'coverage |
| Directory to output coverage reports in. | string | 'coverage' |

---
134 changes: 134 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
---
id: development
title: Development
---

* [Getting started](#getting-started)
* [Clone](#clone)
* [Installation](#installation)
* [Testing](#testing)
* [Debugging](#debugging)
* [Debugging with Chrome](#debugging-with-chrome)
* [Testing local changes](#testing-local-changes)

## Getting started

### Clone

```sh
git clone git@github.com:qlik-oss/after-work.js.git
```

### Installation

Go into the cloned folder:

```sh
npm i
```

Since we are using [Lerna](https://lernajs.io/) with hoisting run:

```sh
npm run bootstrap
```

### Testing

Run all tests with:

```sh
npm test
```

This will run all `after-work.js` tests with `after-work.js` itself.

### Debugging

For easy debugging using [vscode](https://code.visualstudio.com/download) just add a `.vscode/launch.json`.

<details><summary>launch.json</summary>
<p>

```json
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "NodeRunner",
"program": "${workspaceRoot}/commands/aw/src/index.js",
"args": [
"-c",
"aw.config.js",
"--glob",
"${file}"
]
},
{
"type": "node",
"request": "launch",
"name": "ChromeRunner",
"program": "${workspaceRoot}/commands/aw/src/index.js",
"args": [
"chrome",
"-c",
"aw.config.js",
"--glob",
"${file}"
]
},
{
"type": "chrome",
"request": "launch",
"name": "ChromeHeadless",
"port": 9222,
"url": "http://localhost:9676/examples/index.html",
"webRoot": "${workspaceFolder}",
"runtimeArgs": [
"--headless",
"--disable-gpu"
]
}
],
"compounds": [
{
"name": "ChromeDebug",
"configurations": [
"ChromeHeadless",
"ChromeRunner"
]
}
]
}

```

</p>
</details>

<br>

Add a breakpoint in any `*.{js,ts}` and hit F5 and off you go...

### Debugging with Chrome

To debug in Chrome just pass:

```sh
npx aw chrome -c aw.config.js --chrome.devtools=true
```

This will ensure to auto open devtools in your Chrome instance and waiting for it to attach.
Add a `debugger` statement in any file and it will break right into it 🚀.

### Testing local changes

`after-work.js` is designed to be run directly without installing it. Just go into the project you want to test and point to your local entry point:

```sh
../after-work.js/commands/aw/src/index.js
```

This will run `after-work.js` with your local changes 💥.
Loading