https://github.com/sammarks/yaml-to-test
Automatically generates test scaffolds based on a YAML file configuration.
https://github.com/sammarks/yaml-to-test
Last synced: 2 months ago
JSON representation
Automatically generates test scaffolds based on a YAML file configuration.
- Host: GitHub
- URL: https://github.com/sammarks/yaml-to-test
- Owner: sammarks
- License: mit
- Created: 2019-07-15T15:58:22.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-07-15T16:04:15.000Z (almost 6 years ago)
- Last Synced: 2024-10-19T06:27:07.576Z (7 months ago)
- Size: 2.93 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# YAML → Test
A simple CLI to accept a list of YAML files as an input, and converts and replaces them with test file scaffolds according to the structure of their contents.
For example, let's say you have this file:
#### Lesson.test.yaml
```yaml
- '#isOwn()'
- when the current user is a student
- and they are assigned the lesson
- returns true
- and they are not assigned the lesson
- returns false
- when the current user is a teacher
- and they created the lesson
- returns true
- and they did not create the lesson
- returns false
- when the current user is not a teacher or a student
- returns false
```If you execute the CLI like so:
```sh
yaml-to-test ./*.test.yaml
```It will transform that file to be this one:
#### Lesson.test.js
```js
describe('#isOwn()', () => {
describe('when the current user is a student', () => {
describe('and they are assigned the lesson', () => {
it('returns true', () => {})
})
describe('and they are not assigned the lesson', () => {
it('returns false', () => {})
})
})
describe('when the current user is a teacher', () => {
describe('and they created the lesson', () => {
it('returns true', () => {})
})
describe('and they did not create the lesson', () => {
it('returns false', () => {})
})
})
describe('when the current user is not a teacher or a student', () => {
it('returns false', () => {})
})
})
```## Features
- Recursively search through directories based on glob pattern added to CLI.
- Support both Typescript, vanilla ES6, and CoffeeScript for test generation.
- Support multiple test frameworks (Mocha, Jest, etc)