File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 1- import { RunResult } from "../engine/run_result" ;
21import * as fs from "fs" ;
32
43export class DirectoryExist {
Original file line number Diff line number Diff line change 1+ import * as fs from "fs" ;
2+
3+ export class FileExist {
4+ public static run ( filepath : string ) : void {
5+ if ( ! fs . existsSync ( filepath ) ) {
6+ throw new Error ( "file " + filepath + " does not exist" ) ;
7+ }
8+ }
9+ }
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { Command } from "../engine/command";
44import { NoErrorCode } from "./noErrorCode" ;
55import { NoException } from "./noException" ;
66import { DirectoryExist } from "./directoryExist" ;
7+ import { FileExist } from "./fileExist" ;
78
89
910export class Assertions {
@@ -22,4 +23,9 @@ export class Assertions {
2223 DirectoryExist . run ( directory ) ;
2324 return this ;
2425 }
26+
27+ public fileExits ( filepath : string ) : Assertions {
28+ FileExist . run ( filepath ) ;
29+ return this ;
30+ }
2531}
You can’t perform that action at this time.
0 commit comments