Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(vuepress): add docs website #7

Draft
wants to merge 46 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
acf2624
chore(docs): init new package; move assets
dsseng Aug 10, 2019
925ea2f
docs: set up Vuepress
dsseng Aug 11, 2019
ccc11a3
docs(vuepress): basic structure
dsseng Aug 11, 2019
d8b9d6f
build(package): add proxies to docs dev and build scripts
dsseng Aug 11, 2019
3b32785
docs: add Russian locale
dsseng Aug 11, 2019
ed21ca2
docs: move assets to the public dir
dsseng Aug 11, 2019
f4526bb
chore(docs): move all contents to the package root
dsseng Aug 11, 2019
65c5d65
docs: install some plugins
dsseng Aug 11, 2019
4a9eb2c
build(docs): enable docs publishing to GitHub pages
dsseng Aug 11, 2019
dca7d49
docs: fix russian translation in config
dsseng Aug 11, 2019
b777ece
docs(matchers): add root page
dsseng Aug 11, 2019
3f619e4
docs(matchers): fix typo
dsseng Aug 12, 2019
b478041
docs(toBe): add a doc page
dsseng Aug 12, 2019
5bd1499
docs(toBeDefined): add a doc page
dsseng Aug 12, 2019
533e37f
Merge branch 'master' into docs/vuepress
dsseng Aug 15, 2019
78e18fb
docs(toBeFalse): add a doc page
dsseng Aug 15, 2019
3d06632
docs(toBeTrue): add a doc page
dsseng Aug 15, 2019
696efbb
chore(config): add to-be-true to vuepress config
dsseng Aug 15, 2019
a719595
docs(toBeInstanceOf): add a doc page
dsseng Aug 15, 2019
3894a34
chore: update navigation
dsseng Aug 15, 2019
b6157e5
docs(toBeNaN): add a doc page
dsseng Aug 15, 2019
610b77f
docs(toBeNull): add a doc page
dsseng Aug 15, 2019
3db930b
docs(toBeTypeOf): Add toBeTypeOf matcher.
ElijahKotyluk Aug 18, 2019
c4045d0
test(toBeUndefined): Add toBeUndefined
ElijahKotyluk Sep 1, 2019
715cc02
test(toContain): Add en toContain.
ElijahKotyluk Sep 1, 2019
bb093c7
fix(toContain): Rename file.
ElijahKotyluk Sep 3, 2019
79fa357
docs(toEqual): Add toEqual en.
ElijahKotyluk Sep 3, 2019
ee23c28
docs(toHaveLength): Add toHaveLength en.
ElijahKotyluk Sep 3, 2019
34544ed
fix(toHaveLength): Update description.
ElijahKotyluk Sep 3, 2019
03b281f
fix(toEqual/Contain): Fix description.
ElijahKotyluk Sep 3, 2019
742d18b
docs(toStrictlyEqual): Add toStriclyEqual en,
ElijahKotyluk Sep 4, 2019
65d640f
fix(Typos): Fix typos in docs.
ElijahKotyluk Sep 4, 2019
a5a7964
docs(toThrow): Add toThrow en.
ElijahKotyluk Sep 4, 2019
7232295
docs(mock): add mock function En
ElijahKotyluk Dec 30, 2019
9fd34f6
docs(expect): add expect En
ElijahKotyluk Dec 30, 2019
c6cc926
fix(mock): fix mock header casing
ElijahKotyluk Dec 30, 2019
cded296
fix merge
NinjaEagle Feb 21, 2020
502df61
added mandarin translation for matchers and mock folders
NinjaEagle Feb 23, 2020
941c78d
fix(merge): conflict
ElijahKotyluk Feb 24, 2020
380f15b
added matchers mandarin translation
NinjaEagle Feb 24, 2020
fd938cc
edited config file
NinjaEagle Feb 24, 2020
f30a8e8
fix(config): update config to properly render new docs
ElijahKotyluk Feb 25, 2020
76812c4
chore(docs): update zh README files
ElijahKotyluk Feb 25, 2020
0f3954a
Merge docs(mandarin)
ElijahKotyluk Feb 25, 2020
cf5f7e4
Update README.md
NinjaEagle Mar 6, 2020
5d1b5f1
Merge pull request #21 from NinjaEagle/patch-1
ElijahKotyluk Mar 6, 2020
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Onyx
![Onyx logo](docs/assets/onyx-logo-sm.svg)
![Onyx logo](packages/docs/.vuepress/public/onyx-logo-sm.svg)

[![Build Status](https://travis-ci.org/onyxjs/onyx.svg?branch=master)](https://travis-ci.org/onyxjs/onyx)
[![codecov](https://codecov.io/gh/onyxjs/onyx/branch/master/graph/badge.svg)](https://codecov.io/gh/onyxjs/onyx)
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
"lint:fix": "lerna run --no-bail lint:fix --stream",
"build": "lerna run build --stream",
"dev": "lerna run dev --stream",
"watch": "lerna run watch --stream"
"watch": "lerna run watch --stream",
"dev:docs": "lerna run dev --stream --scope @onyx/docs",
"build:docs": "lerna run build --stream --scope @onyx/docs"
},
"husky": {
"hooks": {
Expand Down
113 changes: 113 additions & 0 deletions packages/docs/.vuepress/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
module.exports = {
base: "/onyx/",
plugins: {
"@vuepress/pwa": {
serviceWorker: true,
updatePopup: {
"/": {
message: "New content is available.",
buttonText: "Refresh"
},
"/ru/": {
message: "Доступна новая информация.",
buttonText: "Обновить"
},
"/zh-Hant/": {
message: "新內容可用。",
buttonText: "刷新"
}
}
},
"@vuepress/nprogress": {},
"@vuepress/back-to-top": {}
},
themeConfig: {
locales: {
"/": {
selectText: "Languages",
label: "English",
editLinkText: "Edit this page on GitHub",
sidebar: [
"/",
{
title: "@onyx/matchers",
path: "/matchers/",
children: [
"/matchers/matchers/to-be",
"/matchers/matchers/to-be-defined",
"/matchers/matchers/to-be-false",
"/matchers/matchers/to-be-instance-of",
"/matchers/matchers/to-be-nan",
"/matchers/matchers/to-be-null",
"/matchers/matchers/to-be-true",
"/matchers/matchers/to-be-type-of",
"/matchers/matchers/to-be-undefined",
"/matchers/matchers/to-contain",
"/matchers/matchers/to-equal",
"/matchers/matchers/to-have-length",
"/matchers/matchers/to-strictly-equal",
"/matchers/matchers/to-throw"
]
},
"/mock/"
]
},
"/ru/": {
selectText: "Языки",
label: "Русский",
editLinkText: "Редактировать эту страницу на GitHub",
sidebar: ["/ru/", "/ru/matchers/", "/ru/mock/"]
},
"/zh/": {
selectText: "語言",
label: "中文",
editLinkText: "在Github中編輯此頁面",
sidebar: [
"/zh/",
{
title: "@onyx/matchers",
path: "/zh/matchers/",
children: [
"/zh/matchers/matchers/to-be",
"/zh/matchers/matchers/to-be-defined",
"/zh/matchers/matchers/to-be-false",
"/zh/matchers/matchers/to-be-instance-of",
"/zh/matchers/matchers/to-be-nan",
"/zh/matchers/matchers/to-be-null",
"/zh/matchers/matchers/to-be-true",
"/zh/matchers/matchers/to-be-type-of",
"/zh/matchers/matchers/to-be-undefined",
"/zh/matchers/matchers/to-contain",
"/zh/matchers/matchers/to-equal",
"/zh/matchers/matchers/to-have-length",
"/zh/matchers/matchers/to-strictly-equal",
"/zh/matchers/matchers/to-throw"
]
},
{
title: "@onyx/mock",
path: "/zh/mock/",
children: []
}
]
}
}
},
locales: {
"/": {
lang: "en-US",
title: "Onyx",
description: "Onyx is a JavaScript testing framework"
},
"/ru/": {
lang: "ru-RU",
title: "Onyx",
description: "Onyx это фреймворк для тестирования JavaScript кода."
},
"/zh/": {
lang: "zh-TW",
title: "Onyx",
description: "Onyx是一個JavaScript測試框架。"
}
}
};
7 changes: 7 additions & 0 deletions packages/docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Onyx
![Onyx logo](/onyx/onyx-logo-sm.svg)

[![Build Status](https://travis-ci.org/onyxjs/onyx.svg?branch=master)](https://travis-ci.org/onyxjs/onyx)
[![codecov](https://codecov.io/gh/onyxjs/onyx/branch/master/graph/badge.svg)](https://codecov.io/gh/onyxjs/onyx)

> Onyx is a JavaScript testing framework
19 changes: 19 additions & 0 deletions packages/docs/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env sh

# abort on errors
set -e

# build
yarn build

# navigate into the build output directory
cd .vuepress/dist

git init
git add -A
git commit -m 'deploy'

# deploy to gh-pages branch
git push -f https://github.com/onyxjs/onyx master:gh-pages

cd -
4 changes: 4 additions & 0 deletions packages/docs/matchers/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# @onyx/matchers
![Onyx logo](/onyx/onyx-logo-sm.svg)

This package provides matchers that can compare, validate and diff (TODO) values in your tests.
16 changes: 16 additions & 0 deletions packages/docs/matchers/expect/expect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## expect

> Signature: `expect ( matchers: { [ key: string ]: Function }, expectation: any): any

`expect` allows you to test that values meet certain expectations. The `expect` function can be paired with a `matcher` to validate a desired output or value.

### Example

```ts
import { expect } from '@onyx/matchers';

console.log(expect(1).toBeTypeOf('number')); // true
console.log(expect('string').toHaveLength(6)); // true
console.log(expect(2).not.toBeTypeOf('number')); // false
console.log(expect('string').not.toHaveLength(6)); // false
```
18 changes: 18 additions & 0 deletions packages/docs/matchers/matchers/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## Matcher functions
All matcher functions are listed here:
- [toBe](to-be)
- [toBeDefined](to-be-defined)
- [toBeFalse](to-be-false)
- [toBeFalsy](to-be-falsy)
- [toBeInstanceOf](to-be-instance-of)
- [toBeNaN](to-be-nan)
- [toBeNull](to-be-null)
- [toBeTrue](to-be-true)
- [toBeTruthy](to-be-truthy)
- [toBeTypeOf](to-be-type-of)
- [toBeUndefined](to-be-undefined)
- [toContain](to-contain)
- [toEqual](to-equal)
- [toHaveLength](to-have-length)
- [toStrictlyEqual](to-strictly-equal)
- [toThrow](to-throw)
17 changes: 17 additions & 0 deletions packages/docs/matchers/matchers/to-be-defined.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## toBeDefined

> Signature: `toBeDefined (a: any): boolean`

`toBeDefined` checks if the value is defined. It only returns `false` when it has `undefined` as input.

### Example

```ts
import { toBeDefined } from '@onyx/matchers';

console.log(toBeDefined(1)); // true
console.log(toBeDefined({}); // true
console.log(toBeDefined(NaN)); // true
console.log(toBeDefined(null)); // true
console.log(toBeDefined(undefined)); // false
```
18 changes: 18 additions & 0 deletions packages/docs/matchers/matchers/to-be-false.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## toBeFalse (toBeFalsy)

> Signature: `toBeFalse (a: any): boolean`

`toBeFalse` matcher (aliased as `toBeFalsy`) checks whether the given value is falsy.

### Example

```ts
import { toBeFalse } from '@onyx/matchers';

console.log(toBeFalse(false)); // true
console.log(toBeFalse(undefined)); // true
console.log(toBeFalse(NaN)); // true
console.log(toBeFalse(0)); // true
console.log(toBeFalse(1)); // false
console.log(toBeFalse({})); // false
```
16 changes: 16 additions & 0 deletions packages/docs/matchers/matchers/to-be-instance-of.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## toBeInstanceOf

> Signature: `toBeInstanceOf (a: any, b: Function): boolean`

`toBeInstanceOf` matcher checks whether the given first argument in instance of type given as second argument.

### Example

```ts
import { toBeInstanceOf } from '@onyx/matchers';

console.log(toBeInstanceOf(document, Document)); // true
console.log(toBeInstanceOf(document.body, Element)); // true
console.log(toBeInstanceOf([], Array)); // true
console.log(toBeInstanceOf({}, Element)); // false
```
16 changes: 16 additions & 0 deletions packages/docs/matchers/matchers/to-be-nan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## toBeNaN

> Signature: `toBeNaN (a: any, b: any): boolean`

`toBeNaN` matcher checks whether given value is `NaN`. If the value is string, `toBeNaN` will parse it.

### Example

```ts
import { toBeNaN } from '@onyx/matchers';

console.log(toBeNaN(NaN)); // true
console.log(toBeNaN('onyx')); // true
console.log(toBeNaN(1)); // false
console.log(toBeNaN(1337)); // false
```
14 changes: 14 additions & 0 deletions packages/docs/matchers/matchers/to-be-null.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## toBeNull

> Signature: `toBeNull (a: any): boolean`

`toBeNull` matcher checks if the given value is `null`.

### Example

```ts
import { toBeNull } from '@onyx/matchers';

console.log(toBeNull(null)); // true
console.log(toBeNull(1)); // false
```
18 changes: 18 additions & 0 deletions packages/docs/matchers/matchers/to-be-true.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## toBeTrue (toBeTruthy)

> Signature: `toBeTrue (a: any): boolean`

`toBeTrue` matcher (aliased as `toBeTruthy`) checks whether the given value is truthy.

### Example

```ts
import { toBeTrue } from '@onyx/matchers';

console.log(toBeTrue(false)); // false
console.log(toBeTrue(undefined)); // false
console.log(toBeTrue(NaN)); // false
console.log(toBeTrue(0)); // false
console.log(toBeTrue(1)); // true
console.log(toBeTrue({})); // true
```
16 changes: 16 additions & 0 deletions packages/docs/matchers/matchers/to-be-type-of.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## toBeTypeOf

> Signature: `toBeTypeOf (a: any, b: Function): boolean`

`toBeTypeOf` matcher checks the first given argument's object type.

### Example

```ts
import { toBeTypeOf } from '@onyx/matchers';

console.log(toBeTypeOf('', 'string')); // true
console.log(toBeTypeOf(22, 'number')); // true
console.log(toBeTypeOf([], 'array')); // true
console.log(toBeTypeOf({}, 'boolean')); // false
```
16 changes: 16 additions & 0 deletions packages/docs/matchers/matchers/to-be-undefined.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## toBeUndefined

> Signature: `toBeUndefined (a: any): boolean`

`toBeUndefined` matcher checks if the given argument is undefined.

### Example

```ts
import { toBeUndefined } from '@onyx/matchers';

console.log(toBeUndefined('')); // false
console.log(toBeUndefined(undefined)); // true
console.log(toBeUndefined(null)); // false
console.log(toBeUndefined({})); // false
```
18 changes: 18 additions & 0 deletions packages/docs/matchers/matchers/to-be.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## toBe

> Signature: `toBe (a: any, b: any): boolean`

`toBe` matcher uses `lodash.isEqual` and `Object.is` under the hood to compare values. It returns `true` if values are identical, `false` in any other case.

### Example

```ts
import { toBe } from '@onyx/matchers';

console.log(toBe(1, 1)); // true
console.log(toBe({}, {})); // true
console.log(toBe(NaN, NaN)); // true
console.log(toBe(1, 2)); // false
console.log(toBe(NaN, null)); // false
console.log(toBe(undefined, null)); // false
```
16 changes: 16 additions & 0 deletions packages/docs/matchers/matchers/to-contain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## toContain

> Signature: `toContain (a: any[] | object, b: any): boolean`

`toContain` matcher checks if the first given parameter contains the second given parameter.

### Example

```ts
import { toContain } from '@onyx/matchers';

console.log(toContain([1], 1)); // true
console.log(toContain({a: 'b'}, 'b')); // true
console.log(toContain([{}, 1, 'onyx'], 'onyx')); // true
console.log(toContain(1 as any, 'onyx')); // false
```
16 changes: 16 additions & 0 deletions packages/docs/matchers/matchers/to-equal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## toEqual

> Signature: `toEqual (a: any, b: any): boolean`

`toEqual` matcher performs `type coercion` and checks the given parameters for loose equality.

### Example

```ts
import { toEqual } from '@onyx/matchers';

console.log(toEqual(1, '1')); // true
console.log(toEqual('string', ['string'])); // true
console.log(toEqual('five', 5)); // false
console.log(toEqual({}, {})); // false
```
Loading