laat-readme-jest
v0.0.2
Published
Execute code blocks with jest
Readme
readme-jest

WIP! use with caution
Execute code blocks with jest
Install
npm install -D laat-readme-jestjest config
module.exports = {
transform: {
'readme.md': 'laat-readme-jest',
'^.+\\.jsx?$': 'babel-jest',
},
testMatch: [
'**/readme.md',
'**/__tests__/**/*.js?(x)',
'**/?(*.)(spec|test).js?(x)',
],
moduleFileExtensions: [
'md',
'js',
],
};basic
true; // => trueimport from package main
// To override main to import use the magic comment in markdown
// <!-- test-main: "./__test__" -->
import helloWorld from 'laat-readme-jest';
helloWorld(); // => 'hello-world'throws
const a = () => {
throw new Error('MyError');
};
a(); // throws /MyError/Promises
const b = Promise.resolve('foobar')
b; // Promise 'foobar'const d = Promise.resolve('foobar')
d; // resolves to 'foobar'