File tree 4 files changed +20
-4
lines changed
4 files changed +20
-4
lines changed Original file line number Diff line number Diff line change
1
+ import { RunResult } from "../engine/run_result" ;
2
+ import * as fs from "fs" ;
3
+
4
+ export class DirectoryExist {
5
+ public static run ( directory : string ) : void {
6
+ if ( ! fs . existsSync ( directory ) ) {
7
+ throw new Error ( "directory " + directory + " does not exist" ) ;
8
+ }
9
+ }
10
+ }
Original file line number Diff line number Diff line change @@ -3,9 +3,10 @@ import { Step } from "../engine/step";
3
3
import { Command } from "../engine/command" ;
4
4
import { NoErrorCode } from "./noErrorCode" ;
5
5
import { NoException } from "./noException" ;
6
+ import { DirectoryExist } from "./directoryExist" ;
6
7
7
8
8
- export class Assertions {
9
+ export class Assertions {
9
10
10
11
public noErrorCode ( result : RunResult ) : Assertions {
11
12
NoErrorCode . run ( result ) ;
@@ -16,4 +17,9 @@ export class Assertions{
16
17
NoException . run ( result ) ;
17
18
return this ;
18
19
}
20
+
21
+ public directoryExits ( directory : string ) : Assertions {
22
+ DirectoryExist . run ( directory ) ;
23
+ return this ;
24
+ }
19
25
}
Original file line number Diff line number Diff line change 1
1
import { RunResult } from "../engine/run_result" ;
2
2
3
- export class NoErrorCode {
3
+ export class NoErrorCode {
4
4
public static run ( result : RunResult ) : void {
5
- if ( result . returnCode != 0 ) {
5
+ if ( result . returnCode != 0 ) {
6
6
throw new Error ( "returnCode is not 0" ) ;
7
7
}
8
8
}
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { RunResult } from "../engine/run_result";
2
2
3
3
export class NoException {
4
4
public static run ( result : RunResult ) : void {
5
- if ( result . exceptions . length > 0 ) {
5
+ if ( result . exceptions . length > 0 ) {
6
6
throw new Error ( "Unexpected exception." ) ;
7
7
}
8
8
}
You can’t perform that action at this time.
0 commit comments