test: cover isolated SQLite invariants and durability
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
const { spawnSync } = require('node:child_process');
|
||||
const { mkdtempSync, rmSync } = require('node:fs');
|
||||
const { join, resolve } = require('node:path');
|
||||
|
||||
const cwd = resolve(__dirname, '..');
|
||||
for (const suite of ['app.e2e-spec.ts', 'bank-cards.e2e-spec.ts']) {
|
||||
const dir = mkdtempSync('/tmp/bank-cards-');
|
||||
const env = {
|
||||
...process.env,
|
||||
DATABASE_URL: `file:${join(dir, 'test.db')}`,
|
||||
RUST_LOG: 'info',
|
||||
NODE_ENV: 'development',
|
||||
NODE_OPTIONS: '--experimental-vm-modules',
|
||||
};
|
||||
try {
|
||||
for (const args of [
|
||||
['node_modules/prisma/build/index.js', 'migrate', 'deploy'],
|
||||
[
|
||||
'node_modules/jest/bin/jest.js',
|
||||
'--config',
|
||||
'test/jest-e2e.json',
|
||||
'--runInBand',
|
||||
'--runTestsByPath',
|
||||
`test/${suite}`,
|
||||
],
|
||||
]) {
|
||||
const result = spawnSync(process.execPath, args, {
|
||||
cwd,
|
||||
env,
|
||||
stdio: 'inherit',
|
||||
});
|
||||
if (result.error) throw result.error;
|
||||
if (result.status !== 0) {
|
||||
process.exitCode = result.status ?? 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
rmSync(dir, { recursive: true, force: true });
|
||||
}
|
||||
if (process.exitCode) break;
|
||||
}
|
||||
Reference in New Issue
Block a user