├── .editorconfig ├── .gitattributes ├── assertions.sublime-completions ├── license ├── readme.md ├── screenshot.gif └── snippets ├── after-each-hook.sublime-snippet ├── after-hook.sublime-snippet ├── ava.sublime-snippet ├── before-each-hook.sublime-snippet ├── before-hook.sublime-snippet ├── import-ava.sublime-snippet ├── test-async.sublime-snippet ├── test-cb.sublime-snippet ├── test-failing.sublime-snippet ├── test-only.sublime-snippet ├── test-serial.sublime-snippet ├── test-skip.sublime-snippet ├── test-todo.sublime-snippet └── test.sublime-snippet /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = tab 5 | end_of_line = lf 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | -------------------------------------------------------------------------------- /assertions.sublime-completions: -------------------------------------------------------------------------------- 1 | { 2 | "scope": "source.js, source.jsx, source.ts", 3 | "completions": [ 4 | { 5 | "trigger": "t.pass", 6 | "contents": "t.pass(${1/.+/'/}${1:message}${1/.+/'/});" 7 | }, 8 | { 9 | "trigger": "t.fail", 10 | "contents": "t.fail(${1/.+/'/}${1:message}${1/.+/'/});" 11 | }, 12 | { 13 | "trigger": "t.truthy", 14 | "contents": "t.truthy(${1:value}${2/.+/, '/}${2:message}${2/.+/'/});" 15 | }, 16 | { 17 | "trigger": "t.falsy", 18 | "contents": "t.falsy(${1:value}${2/.+/, '/}${2:message}${2/.+/'/});" 19 | }, 20 | { 21 | "trigger": "t.true", 22 | "contents": "t.true(${1:value}${2/.+/, '/}${2:message}${2/.+/'/});" 23 | }, 24 | { 25 | "trigger": "t.false", 26 | "contents": "t.false(${1:value}${2/.+/, '/}${2:message}${2/.+/'/});" 27 | }, 28 | { 29 | "trigger": "t.is", 30 | "contents": "t.is(${1:value}, ${2:expected}${3/.+/, '/}${3:message}${3/.+/'/});" 31 | }, 32 | { 33 | "trigger": "t.not", 34 | "contents": "t.not(${1:value}, ${2:expected}${3/.+/, '/}${3:message}${3/.+/'/});" 35 | }, 36 | { 37 | "trigger": "t.deepEqual", 38 | "contents": "t.deepEqual(${1:value}, ${2:expected}${3/.+/, '/}${3:message}${3/.+/'/});" 39 | }, 40 | { 41 | "trigger": "t.notDeepEqual", 42 | "contents": "t.notDeepEqual(${1:value}, ${2:expected}${3/.+/, '/}${3:message}${3/.+/'/});" 43 | }, 44 | { 45 | "trigger": "t.throws", 46 | "contents": "t.throws(${1:function}${2/.+/, '/}${2:message}${2/.+/'/});" 47 | }, 48 | { 49 | "trigger": "t.notThrows", 50 | "contents": "t.notThrows(${1:function}${2/.+/, '/}${2:message}${2/.+/'/});" 51 | }, 52 | { 53 | "trigger": "t.throwsAsync", 54 | "contents": "t.throws(${1:promise|function}${2/.+/, '/}${2:message}${2/.+/'/});" 55 | }, 56 | { 57 | "trigger": "t.notThrowsAsync", 58 | "contents": "t.notThrows(${1:promise|function}${2/.+/, '/}${2:message}${2/.+/'/});" 59 | }, 60 | { 61 | "trigger": "t.regex", 62 | "contents": "t.regex(${1:contents}, ${2:regex}${3/.+/, '/}${3:message}${3/.+/'/});" 63 | }, 64 | { 65 | "trigger": "t.notRegex", 66 | "contents": "t.notRegex(${1:contents}, ${2:regex}${3/.+/, '/}${3:message}${3/.+/'/});" 67 | }, 68 | { 69 | "trigger": "t.snapshot", 70 | "contents": "t.snapshot(${1:expected}${3/.+/, '/}${2:message}${2/.+/'/});" 71 | } 72 | ] 73 | } 74 | -------------------------------------------------------------------------------- /license: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Sindre Sorhus (sindresorhus.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # sublime-ava 2 | 3 | > Snippets for [AVA](https://ava.li) 4 | 5 | 6 | 7 | 8 | ## Install 9 | 10 | Install `AVA` with [Package Control](https://packagecontrol.io) and restart Sublime. 11 | 12 | 13 | ## Snippets 14 | 15 | Included are some [snippets](snippets) & [completions](assertions.sublime-completions) useful for writing AVA tests. 16 | 17 | Start writing a snippet's `tabTrigger` and then press Tab ↹ to expand the snippet. 18 | 19 | Snippets are fuzzy matched, so you can for example just write `tde` to get the `t.deepEqual()` snippet. 20 | 21 | 22 | ## Related 23 | 24 | - [Atom plugin](https://github.com/avajs/atom-ava) 25 | - [VS Code plugin](https://github.com/samverschueren/vscode-ava) 26 | 27 | 28 | ## License 29 | 30 | MIT © [Sindre Sorhus](https://sindresorhus.com) 31 | -------------------------------------------------------------------------------- /screenshot.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/sublime-ava/0e06ee7116a1708ae0d4134660035b4c4394cac2/screenshot.gif -------------------------------------------------------------------------------- /snippets/after-each-hook.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | { 4 | $1 5 | }); 6 | ]]> 7 | after-each-hook 8 | source.js 9 | After each hook 10 | 11 | -------------------------------------------------------------------------------- /snippets/after-hook.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | { 4 | $1 5 | }); 6 | ]]> 7 | after-hook 8 | source.js 9 | After hook 10 | 11 | -------------------------------------------------------------------------------- /snippets/ava.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | { 7 | t.is($1(), '$4'); 8 | }); 9 | ]]> 10 | ava 11 | source.js 12 | AVA 13 | 14 | -------------------------------------------------------------------------------- /snippets/before-each-hook.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | { 4 | $1 5 | }); 6 | ]]> 7 | before-each-hook 8 | source.js 9 | Before each hook 10 | 11 | -------------------------------------------------------------------------------- /snippets/before-hook.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | { 4 | $1 5 | }); 6 | ]]> 7 | before-hook 8 | source.js 9 | Before hook 10 | 11 | -------------------------------------------------------------------------------- /snippets/import-ava.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 6 | import-ava 7 | source.js 8 | Import AVA 9 | 10 | -------------------------------------------------------------------------------- /snippets/test-async.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | { 4 | $2 5 | }); 6 | ]]> 7 | test-async 8 | source.js 9 | Test - Async 10 | 11 | -------------------------------------------------------------------------------- /snippets/test-cb.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | { 4 | $2 5 | }); 6 | ]]> 7 | test-cb 8 | source.js 9 | Test - Cb 10 | 11 | -------------------------------------------------------------------------------- /snippets/test-failing.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | { 4 | $2 5 | }); 6 | ]]> 7 | test-failing 8 | source.js 9 | Test - Failing 10 | 11 | -------------------------------------------------------------------------------- /snippets/test-only.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | { 4 | $2 5 | }); 6 | ]]> 7 | test-only 8 | source.js 9 | Test - Only 10 | 11 | -------------------------------------------------------------------------------- /snippets/test-serial.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | { 4 | $2 5 | }); 6 | ]]> 7 | test-serial 8 | source.js 9 | Test - Serial 10 | 11 | -------------------------------------------------------------------------------- /snippets/test-skip.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | { 4 | $2 5 | }); 6 | ]]> 7 | test-skip 8 | source.js 9 | Test - Skip 10 | 11 | -------------------------------------------------------------------------------- /snippets/test-todo.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 5 | test-todo 6 | source.js 7 | Test - Todo 8 | 9 | -------------------------------------------------------------------------------- /snippets/test.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | { 4 | $2 5 | }); 6 | ]]> 7 | test 8 | source.js 9 | Test 10 | 11 | --------------------------------------------------------------------------------