File tree Expand file tree Collapse file tree 3 files changed +18
-1
lines changed Expand file tree Collapse file tree 3 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @shelf/postgres-local" ,
3
- "version" : " 1.0.4 " ,
3
+ "version" : " 1.0.5 " ,
4
4
"description" : " Run Postgres locally" ,
5
5
"keywords" : [
6
6
" postgres" ,
Original file line number Diff line number Diff line change @@ -4,6 +4,22 @@ import postgres from 'postgres';
4
4
import { start , stop } from '.' ;
5
5
6
6
describe ( '#postgres' , ( ) => {
7
+ // The order of tests matters here
8
+ // since plugin should clean up files and rerun correctly even after error occurred after start
9
+
10
+ it ( 'should stop postgres and clear files locally if error occurred during start' , async ( ) => {
11
+ try {
12
+ await start ( {
13
+ version : 12 ,
14
+ debugMode : true ,
15
+ seedPath : `${ cwd ( ) } /src/notExists.sql` ,
16
+ } ) ;
17
+ } catch ( e ) {
18
+ // @ts -ignore
19
+ expect ( e . name ) . toEqual ( 'Error' ) ;
20
+ }
21
+ } ) ;
22
+
7
23
it ( 'should start postgres locally' , async ( ) => {
8
24
expect . assertions ( 2 ) ;
9
25
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ export async function start(options: {
47
47
return url ;
48
48
} catch ( e ) {
49
49
console . error ( e ) ;
50
+ stop ( options ) ;
50
51
throw e ;
51
52
}
52
53
}
You can’t perform that action at this time.
0 commit comments