fix(cli): integration tests not failing when build fails (#8746)

This commit is contained in:
Lucas Fernandes Nogueira 2024-02-03 17:18:34 -03:00 committed by GitHub
parent 863bc9e55f
commit ce1655ec22
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 5 deletions

View File

@ -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)
}

View File

@ -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),

View File

@ -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)
}