├── .editorconfig ├── .gitignore ├── .travis.yml ├── CHANGELOG.md ├── LICENSE ├── README.md ├── package.json └── src └── index.js /.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | root = true 3 | 4 | [*] 5 | end_of_line = lf 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | indent_style = space 10 | indent_size = 2 11 | 12 | [*.md] 13 | # Allow
from Markdown 14 | trim_trailing_whitespace = false 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OS X crap 2 | .DS_Store 3 | 4 | # no log 5 | .log 6 | 7 | # Node.js / npm 8 | node_modules 9 | 10 | # build 11 | lib 12 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - '6' 4 | 5 | # fail asap when there is a failure 6 | matrix: 7 | fast_finish: true 8 | 9 | # cache node modules 10 | cache: 11 | directories: 12 | - node_modules 13 | 14 | before_install: 15 | # faster npm install 16 | - npm set progress=false 17 | # remove useless/non listed deps 18 | - npm prune 19 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 0.1.0 - 2016-09-09 2 | 3 | ✨ Initial release, untested (YOLO) 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 "MoOx" Maxime Thirouin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # jest-ava-api 2 | 3 | [![Unix Build status](https://img.shields.io/travis/MoOx/js-boilerplate/master.svg?branch=master&label=unix%20build)](https://travis-ci.org/MoOx/js-boilerplate) 4 | [![Version](https://img.shields.io/npm/v/jest-ava-api.svg)](https://github.com/MoOx/jest-ava-api/blob/master/CHANGELOG.md) 5 | 6 | [![Repo on GitHub](https://img.shields.io/badge/repo-GitHub-3D76C2.svg)](https://github.com/MoOx/jest-ava-api) 7 | [![Repo on GitLab](https://img.shields.io/badge/repo-GitLab-6C488A.svg)](https://gitlab.com/MoOx/jest-ava-api) 8 | [![Repo on BitBucket](https://img.shields.io/badge/repo-BitBucket-1F5081.svg)](https://bitbucket.org/MoOx/jest-ava-api) 9 | 10 | > AVA API for Jest 11 | 12 | Very simple & stupid proxy API. 13 | ** ⚠️ Not everything is mapped yet.** 14 | 15 | _Take a look at the UNTESTED file._ 16 | 17 | ## Installation 18 | 19 | ```console 20 | $ npm install --save-dev jest babel-jest jest-ava-api 21 | ``` 22 | 23 | ## Usage 24 | 25 | ```js 26 | // VERY EASY, JUST REPLACE "ava" by "jest-ava-api" and you are done. 27 | import test from "jest-ava-api" 28 | 29 | test("message", (t) => { 30 | t.truthy(value) 31 | }) 32 | ``` 33 | 34 | ## ⚠️ Notes 35 | 36 | * Jest provides a "window" object, unlike AVA, so you might need to use this option 37 | http://facebook.github.io/jest/docs/api.html#testenvironment-string. 38 | 39 | * Not also that AVA try to test ``**/__tests__/*.js``, 40 | while Jest try to test ``**/__tests__/**/*.js`` 41 | so you might need to ignore fixtures if you have some, like this 42 | 43 | ```js 44 | "testPathIgnorePatterns": [ 45 | "/fixtures/" 46 | ] 47 | ``` 48 | 49 | --- 50 | 51 | ## CONTRIBUTING 52 | 53 | * ⇄ Pull/Merge requests and ★ Stars are always welcome. 54 | * For bugs and feature requests, please create an issue. 55 | * Pull/Merge requests must be accompanied by passing automated tests (`$ npm test`). 56 | 57 | ## [CHANGELOG](CHANGELOG.md) 58 | 59 | ## [LICENSE](LICENSE) 60 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jest-ava-api", 3 | "version": "0.1.0", 4 | "description": "AVA API for Jest", 5 | "keywords": [ 6 | "jest", 7 | "ava" 8 | ], 9 | "author": "Maxime Thirouin", 10 | "license": "MIT", 11 | "repository": "https://github.com/MoOx/jest-ava-api.git", 12 | "#repositories": "https://github.com/npm/npm/issues/11315", 13 | "repositories": [ 14 | "https://github.com/MoOx/jest-ava-api.git", 15 | "https://gitlab.com/MoOx/jest-ava-api.git", 16 | "https://bitbucket.org/MoOx/jest-ava-api.git" 17 | ], 18 | "main": "lib/index.js", 19 | "files": [ 20 | "lib", 21 | "src", 22 | "!**/__tests__" 23 | ], 24 | "dependencies": {}, 25 | "devDependencies": { 26 | "babel-cli": "^6.14.0", 27 | "babel-core": "^6.14.0", 28 | "babel-preset-latest": "^6.14.0", 29 | "eslint": "^3.4.0", 30 | "eslint-config-i-am-meticulous": "^4.2.1", 31 | "npmpub": "^3.1.0" 32 | }, 33 | "scripts": { 34 | "transpile": "babel --ignore __tests__ --copy-files src --out-dir lib", 35 | "prepublish": "rimraf lib && npm -s run transpile", 36 | "lint": "eslint --ignore-path .gitignore --fix .", 37 | "pretest": "npm -s run lint", 38 | "test": "npm run transpile && echo 'YOLO' && exit 0", 39 | "release": "npmpub" 40 | }, 41 | "babel": { 42 | "presets": [ 43 | "babel-preset-latest" 44 | ] 45 | }, 46 | "eslintConfig": { 47 | "extends": [ 48 | "eslint-config-i-am-meticulous" 49 | ], 50 | "env": { 51 | "jest": true 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import assert from "assert" 2 | 3 | // @todo cover ava api 4 | // https://github.com/avajs/ava#api 5 | const todo = () => { 6 | console.log("@todo") 7 | assert(false) 8 | } 9 | 10 | const helpers = { 11 | pass: () => assert(true), 12 | fail: () => assert(false), 13 | truthy: (value) => expect(value).toBeTruthy(), 14 | falsy: (value) => expect(value).toBeFalsy(), 15 | true: (value) => expect(value).toBe(true), 16 | false: (value) => expect(value).toBe(false), 17 | is: (value, expected) => expect(value).toBe(expected), 18 | not: (value, expected) => expect(value).not.toBe(expected), 19 | deepEqual: (value, expected) => expect(value).toEqual(expected), 20 | notDeepEqual: (value, expected) => expect(value).not.toEqual(expected), 21 | throws: (fn) => expect(fn).toThrow(), 22 | notThrows: (fn) => expect(fn).not.toThrow(), 23 | regex: (/* contents, regex*/) => todo, 24 | notRegex: (/* contents, regex*/) => todo, 25 | ifError: (/* error*/) => todo, 26 | } 27 | 28 | const test = (message, cb) => { 29 | it(message, () => cb(helpers)) 30 | } 31 | 32 | test.serial = todo 33 | test.cb = todo 34 | test.only = todo 35 | test.skip = todo 36 | test.todo = (message) => { 37 | it(message, () => { 38 | console.log("@todo", message) 39 | assert(true) 40 | }) 41 | } 42 | test.failing = todo 43 | test.before = todo 44 | test.after = todo 45 | test.beforeEach = todo 46 | test.afterEach = todo 47 | 48 | export default test 49 | --------------------------------------------------------------------------------