diff --git a/tooling/cli/node/main.js b/tooling/cli/node/main.js index b3156ed09..0d3ffd5b7 100644 --- a/tooling/cli/node/main.js +++ b/tooling/cli/node/main.js @@ -6,9 +6,9 @@ const { run, logError } = require('./index') module.exports.run = (args, binName) => { return new Promise((resolve, reject) => { - run(args, binName, res => { - if (res instanceof Error) { - reject(res) + run(args, binName, (error, res) => { + if (error) { + reject(error) } else { resolve(res) } diff --git a/tooling/cli/node/src/lib.rs b/tooling/cli/node/src/lib.rs index 213dd84c4..0660986a7 100644 --- a/tooling/cli/node/src/lib.rs +++ b/tooling/cli/node/src/lib.rs @@ -12,7 +12,7 @@ pub fn run(args: Vec, bin_name: Option, callback: JsFunction) -> let function: ThreadsafeFunction = callback .create_threadsafe_function(0, |ctx| ctx.env.get_boolean(ctx.value).map(|v| vec![v]))?; - // we need to run in a separate thread so Node.js (e.g. vue-cli-plugin-tauri) consumers + // we need to run in a separate thread so Node.js consumers // can do work while `tauri dev` is running. std::thread::spawn(move || match tauri_cli::try_run(args, bin_name) { Ok(_) => function.call(Ok(true), ThreadsafeFunctionCallMode::Blocking), diff --git a/tooling/cli/node/test/jest/__tests__/template.spec.js b/tooling/cli/node/test/jest/__tests__/template.spec.js index 61d1ca681..abd00241b 100644 --- a/tooling/cli/node/test/jest/__tests__/template.spec.js +++ b/tooling/cli/node/test/jest/__tests__/template.spec.js @@ -4,7 +4,7 @@ const fixtureSetup = require('../fixtures/app-test-setup.js') const { resolve } = require('path') -const { existsSync, readFileSync, writeFileSync } = require('fs') +const { existsSync, readFileSync, writeFileSync, rmSync } = require('fs') const { move } = require('fs-extra') const cli = require('~/main.js') @@ -24,6 +24,9 @@ describe('[CLI] @tauri-apps/cli template', () => { const outExists = existsSync(outPath) if (outExists) { + if (existsSync(cacheOutPath)) { + rmSync(cacheOutPath, { recursive: true, force: true }) + } await move(outPath, cacheOutPath) }