1
1
import assert , { fail } from "node:assert" ;
2
2
import { exec } from "node:child_process" ;
3
3
import type { Stats } from "node:fs" ;
4
- import { mkdtemp , rm , stat } from "node:fs/promises" ;
5
- import { tmpdir } from "node:os" ;
6
- import { join } from "node:path" ;
4
+ import { stat } from "node:fs/promises" ;
7
5
import { Readable , Writable } from "node:stream" ;
8
6
import { promisify } from "node:util" ;
9
7
import type { BuildManifest } from "../src/build.js" ;
@@ -20,6 +18,7 @@ import {stripColor} from "../src/tty.js";
20
18
import { MockAuthEffects } from "./mocks/authEffects.js" ;
21
19
import { TestClackEffects } from "./mocks/clack.js" ;
22
20
import { MockConfigEffects } from "./mocks/configEffects.js" ;
21
+ import { mockIsolatedDirectory } from "./mocks/directory.js" ;
23
22
import { mockJsDelivr } from "./mocks/jsdelivr.js" ;
24
23
import { MockLogger } from "./mocks/logger.js" ;
25
24
import {
@@ -200,22 +199,6 @@ const DEPLOY_CONFIG: DeployConfig & {projectId: string; projectSlug: string; wor
200
199
continuousDeployment : false
201
200
} ;
202
201
203
- function mockIsolatedDirectory ( { git} : { git : boolean } ) {
204
- let dir : string ;
205
- let cwd : string ;
206
- beforeEach ( async ( ) => {
207
- cwd = process . cwd ( ) ;
208
- dir = await mkdtemp ( join ( tmpdir ( ) , "framework-test-" ) ) ;
209
- process . chdir ( dir ) ;
210
- if ( git ) ( await promisify ( exec ) ( "git init" ) ) . stdout ;
211
- } ) ;
212
-
213
- afterEach ( async ( ) => {
214
- process . chdir ( cwd ) ;
215
- await rm ( dir , { recursive : true } ) ;
216
- } ) ;
217
- }
218
-
219
202
describe ( "deploy" , ( ) => {
220
203
before ( ( ) => setCurrentDate ( new Date ( "2024-01-10T16:00:00" ) ) ) ;
221
204
mockObservableApi ( ) ;
0 commit comments