|
@@ -1,6 +1,7 @@
|
|
|
import * as fixtureSetup from '../fixtures/app-test-setup.js'
|
|
|
import { resolve, dirname } from 'path'
|
|
|
-import { writeFileSync, readFileSync } from 'fs'
|
|
|
+import { existsSync, readFileSync, writeFileSync } from 'fs'
|
|
|
+import { move } from 'fs-extra'
|
|
|
import { init, build } from 'dist/api/cli'
|
|
|
import { fileURLToPath } from 'url'
|
|
|
|
|
@@ -11,11 +12,18 @@ describe('[CLI] cli.js template', () => {
|
|
|
const cwd = process.cwd()
|
|
|
const fixturePath = resolve(currentDirName, '../fixtures/empty')
|
|
|
const tauriFixturePath = resolve(fixturePath, 'src-tauri')
|
|
|
+ const outPath = resolve(tauriFixturePath, 'target')
|
|
|
+ const cacheOutPath = resolve(fixturePath, 'target')
|
|
|
|
|
|
fixtureSetup.initJest('empty')
|
|
|
|
|
|
process.chdir(fixturePath)
|
|
|
|
|
|
+ const outExists = existsSync(outPath)
|
|
|
+ if (outExists) {
|
|
|
+ await move(outPath, cacheOutPath)
|
|
|
+ }
|
|
|
+
|
|
|
const { promise } = await init({
|
|
|
directory: process.cwd(),
|
|
|
force: true,
|
|
@@ -24,6 +32,10 @@ describe('[CLI] cli.js template', () => {
|
|
|
})
|
|
|
await promise
|
|
|
|
|
|
+ if (outExists) {
|
|
|
+ await move(cacheOutPath, outPath)
|
|
|
+ }
|
|
|
+
|
|
|
process.chdir(tauriFixturePath)
|
|
|
|
|
|
const manifestPath = resolve(tauriFixturePath, 'Cargo.toml')
|