mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-08-16 11:20:28 +03:00
fix(cli): integration tests not failing when build fails (#8746)
This commit is contained in:
parent
863bc9e55f
commit
ce1655ec22
@ -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)
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ pub fn run(args: Vec<String>, bin_name: Option<String>, callback: JsFunction) ->
|
||||
let function: ThreadsafeFunction<bool, ErrorStrategy::CalleeHandled> = 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),
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user