@@ -1,26 +1,45 @@ | |||||
import { defineConfig } from "cypress"; | |||||
import { resolve } from 'path'; | |||||
import { defineConfig } from 'cypress'; | |||||
import { mkdir, rm, writeFile } from 'fs/promises'; | import { mkdir, rm, writeFile } from 'fs/promises'; | ||||
export default defineConfig({ | export default defineConfig({ | ||||
e2e: { | e2e: { | ||||
setupNodeEvents(on, config) { | setupNodeEvents(on, config) { | ||||
// implement node event listeners here | // implement node event listeners here | ||||
on('task', { | |||||
async resetDb() { | |||||
console.log(resolve('../iceform-next-sandbox/.db')); | |||||
await rm('../iceform-next-sandbox/.db', { force: true, recursive: true }); | |||||
await mkdir('../iceform-next-sandbox/.db'); | |||||
await writeFile('../iceform-next-sandbox/.db/notes.jsonl', ''); | |||||
return null; | |||||
} | |||||
}); | |||||
}, | |||||
}, | |||||
component: { | |||||
devServer: { | |||||
framework: 'next', | |||||
bundler: 'webpack', | |||||
on('task', { | |||||
async 'db:reset'() { | |||||
try { | |||||
await rm('../iceform-next-sandbox/.db', { | |||||
force: true, | |||||
recursive: true, | |||||
}); | |||||
} catch { | |||||
// noop | |||||
} | |||||
try { | |||||
await mkdir('../iceform-next-sandbox/.db'); | |||||
await writeFile('../iceform-next-sandbox/.db/notes.jsonl', ''); | |||||
return null; | |||||
} catch { | |||||
// noop | |||||
} | |||||
return undefined; | |||||
}, | |||||
async 'db:shutdown'() { | |||||
try { | |||||
await rm('../iceform-next-sandbox/.db', { | |||||
force: true, | |||||
recursive: true, | |||||
}); | |||||
return null; | |||||
} catch { | |||||
// noop | |||||
} | |||||
return undefined; | |||||
}, | |||||
}); | |||||
}, | }, | ||||
}, | }, | ||||
}); | }); |
@@ -1,6 +1,10 @@ | |||||
describe('form', () => { | describe('form', () => { | ||||
beforeEach(() => { | beforeEach(() => { | ||||
cy.task('resetDb'); | |||||
cy.task('db:reset'); | |||||
}); | |||||
after(() => { | |||||
cy.task('db:shutdown'); | |||||
}); | }); | ||||
describe('script', () => { | describe('script', () => { | ||||
@@ -35,6 +35,7 @@ | |||||
"react-test-renderer": "^18.2.0", | "react-test-renderer": "^18.2.0", | ||||
"tslib": "^2.5.0", | "tslib": "^2.5.0", | ||||
"typescript": "^4.9.5", | "typescript": "^4.9.5", | ||||
"vite": "^4.4.11", | |||||
"vitest": "^0.34.1" | "vitest": "^0.34.1" | ||||
}, | }, | ||||
"peerDependencies": { | "peerDependencies": { | ||||
@@ -87,6 +87,9 @@ importers: | |||||
typescript: | typescript: | ||||
specifier: ^4.9.5 | specifier: ^4.9.5 | ||||
version: 4.9.5 | version: 4.9.5 | ||||
vite: | |||||
specifier: ^4.4.11 | |||||
version: 4.4.11(@types/node@18.14.1) | |||||
vitest: | vitest: | ||||
specifier: ^0.34.1 | specifier: ^0.34.1 | ||||
version: 0.34.1(jsdom@21.1.0) | version: 0.34.1(jsdom@21.1.0) | ||||
@@ -6152,7 +6155,7 @@ packages: | |||||
mlly: 1.4.2 | mlly: 1.4.2 | ||||
pathe: 1.1.1 | pathe: 1.1.1 | ||||
picocolors: 1.0.0 | picocolors: 1.0.0 | ||||
vite: 4.4.9(@types/node@18.14.1) | |||||
vite: 4.4.11(@types/node@18.14.1) | |||||
transitivePeerDependencies: | transitivePeerDependencies: | ||||
- '@types/node' | - '@types/node' | ||||
- less | - less | ||||
@@ -6164,8 +6167,8 @@ packages: | |||||
- terser | - terser | ||||
dev: true | dev: true | ||||
/vite@4.4.9(@types/node@18.14.1): | |||||
resolution: {integrity: sha512-2mbUn2LlUmNASWwSCNSJ/EG2HuSRTnVNaydp6vMCm5VIqJsjMfbIWtbH2kDuwUVW5mMUKKZvGPX/rqeqVvv1XA==} | |||||
/vite@4.4.11(@types/node@18.14.1): | |||||
resolution: {integrity: sha512-ksNZJlkcU9b0lBwAGZGGaZHCMqHsc8OpgtoYhsQ4/I2v5cnpmmmqe5pM4nv/4Hn6G/2GhTdj0DhZh2e+Er1q5A==} | |||||
engines: {node: ^14.18.0 || >=16.0.0} | engines: {node: ^14.18.0 || >=16.0.0} | ||||
hasBin: true | hasBin: true | ||||
peerDependencies: | peerDependencies: | ||||
@@ -6253,7 +6256,7 @@ packages: | |||||
strip-literal: 1.3.0 | strip-literal: 1.3.0 | ||||
tinybench: 2.5.1 | tinybench: 2.5.1 | ||||
tinypool: 0.7.0 | tinypool: 0.7.0 | ||||
vite: 4.4.9(@types/node@18.14.1) | |||||
vite: 4.4.11(@types/node@18.14.1) | |||||
vite-node: 0.34.1(@types/node@18.14.1) | vite-node: 0.34.1(@types/node@18.14.1) | ||||
why-is-node-running: 2.2.2 | why-is-node-running: 2.2.2 | ||||
transitivePeerDependencies: | transitivePeerDependencies: | ||||