File tree Expand file tree Collapse file tree 4 files changed +20
-4
lines changed Expand file tree Collapse file tree 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";
33import { Command } from "../engine/command" ;
44import { NoErrorCode } from "./noErrorCode" ;
55import { NoException } from "./noException" ;
6+ import { DirectoryExist } from "./directoryExist" ;
67
78
8- export class Assertions {
9+ export class Assertions {
910
1011 public noErrorCode ( result : RunResult ) : Assertions {
1112 NoErrorCode . run ( result ) ;
@@ -16,4 +17,9 @@ export class Assertions{
1617 NoException . run ( result ) ;
1718 return this ;
1819 }
20+
21+ public directoryExits ( directory : string ) : Assertions {
22+ DirectoryExist . run ( directory ) ;
23+ return this ;
24+ }
1925}
Original file line number Diff line number Diff line change 11import { RunResult } from "../engine/run_result" ;
22
3- export class NoErrorCode {
3+ export class NoErrorCode {
44 public static run ( result : RunResult ) : void {
5- if ( result . returnCode != 0 ) {
5+ if ( result . returnCode != 0 ) {
66 throw new Error ( "returnCode is not 0" ) ;
77 }
88 }
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { RunResult } from "../engine/run_result";
22
33export class NoException {
44 public static run ( result : RunResult ) : void {
5- if ( result . exceptions . length > 0 ) {
5+ if ( result . exceptions . length > 0 ) {
66 throw new Error ( "Unexpected exception." ) ;
77 }
88 }
You can’t perform that action at this time.
0 commit comments