pre-commit
This commit is contained in:
parent
6bbba634c8
commit
efd596410b
14
.pre-commit-config.yaml
Normal file
14
.pre-commit-config.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
#exclude: static/fontawesome|^build
|
||||
|
||||
default_stages:
|
||||
- merge-commit
|
||||
- push
|
||||
|
||||
repos:
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: lint
|
||||
name: lint
|
||||
entry: task lint:fix --
|
||||
language: system
|
||||
files: ''
|
@ -4,6 +4,8 @@ version: '3'
|
||||
|
||||
vars:
|
||||
GREETING: Hello, World!
|
||||
FILES:
|
||||
sh: git diff-ls --diff-filter=d main | perl -pe's/\n/ /'
|
||||
|
||||
tasks:
|
||||
build: vite build
|
||||
@ -13,3 +15,14 @@ tasks:
|
||||
cmds:
|
||||
- echo "{{.GREETING}}"
|
||||
silent: true
|
||||
lint:fix:
|
||||
cmds:
|
||||
- npx prettier --write {{.CLI_ARGS | default .FILES }}
|
||||
# - npx eslint --fix --quiet {{.CLI_ARGS | default .FILES }}
|
||||
integrate:
|
||||
cmds:
|
||||
- git is-clean
|
||||
- task: lint:fix
|
||||
- task: test
|
||||
- git co main
|
||||
- git weld -
|
||||
|
@ -11,6 +11,7 @@ const seedCampaign = {
|
||||
|
||||
export function genApi(options = {}) {
|
||||
// if (options.local) MyPouch.plugin(pouchMem);
|
||||
if (options.pouch) options.pouch(PouchDB);
|
||||
|
||||
const pouchdb = new PouchDB(
|
||||
'Campaigns',
|
||||
|
@ -2,6 +2,7 @@ import { test, expect } from 'vitest';
|
||||
import { get } from 'svelte/store';
|
||||
|
||||
import { genApi } from './api.js';
|
||||
import adapter from 'pouchdb-adapter-memory';
|
||||
|
||||
const waitUntil = (store, condition) => {
|
||||
return new Promise((resolve) => {
|
||||
@ -10,7 +11,10 @@ const waitUntil = (store, condition) => {
|
||||
};
|
||||
|
||||
test('create and add and remove campaigns', async () => {
|
||||
const api = genApi({ local: true });
|
||||
const api = genApi({
|
||||
local: true,
|
||||
pouch: (p) => p.plugin(adapter),
|
||||
});
|
||||
|
||||
let result = waitUntil(api.campaigns, (r) => r.length === 2);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user