mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-18 16:11:38 +03:00
abd5c698bd
* feat(tauri.js) add API endpoint proxy * feat(tauri.js) always resolve/reject proxy promise * chore(proxy) wait for onTauriInit to start direct proxy to window.tauri * feat(tests) add project for initial e2e test * chore(tauri) remove whitespaces on runner.rs * chore(test): remove updater.rs * feat(tests) move e2e test to tauri.js/test/jest thanks to @laegel for the awesome work moving the test code to jest * feat(tests) prepare build for modes tests * fix(tests) properly run build tests * feat(tests) add dev e2e test * fix(tests) cleanup * chore(tests) move e2e test from express to http.createServer * chore(tauri.js) husky back to 4.0.10 * chore(tests) custom transformer to export with default * chore(tests) use jest mapping instead of relative paths * chore(tests) move dev e2e test to http.createServer * chore(tests) move dev/build e2e test to tes.each instead of for loop * chore(tauri.js) add comment to non-webpack-require.ts * chore(tests) change test.each to it.each * chore(tests) adjust it.each message signature * fix(tests) adjust to properly run on initial build * fix(tests) properly cleanup * fix(tests) wait server.close to reject test * fix(tests) wait server.close to resolve test * fix(actions) install webkit2gtk-4.0 on test-tauri-js-cli * fix(ci) install tauri-cli on test-tauri-js-cli * fix(tauri.js) lint errors Co-authored-by: Lucas Nogueira <lucas@quasar.dev> Co-authored-by: nothingismagick <denjell@sfosc.org>
55 lines
1.2 KiB
JavaScript
55 lines
1.2 KiB
JavaScript
const express = require('express')
|
|
const cors = require('cors')
|
|
const app = express()
|
|
app.use(cors())
|
|
app.use(express.json())
|
|
const port = 7000
|
|
let appPid
|
|
|
|
app.post('/reply', (req, res) => {
|
|
if (req.body && req.body.msg !== 'TEST') {
|
|
throw new Error(`unexpected reply ${JSON.stringify(req.body)}`)
|
|
}
|
|
console.log('App event replied')
|
|
exit(0)
|
|
})
|
|
|
|
const server = app.listen(port, () => console.log(`Test listening on port ${port}!`))
|
|
|
|
const exit = code => {
|
|
server.close()
|
|
process.kill(appPid)
|
|
process.exit(code)
|
|
}
|
|
|
|
const path = require('path')
|
|
const dist = path.resolve(__dirname, 'dist')
|
|
|
|
const build = require('../cli/tauri.js/dist/api/build')
|
|
build({
|
|
build: {
|
|
devPath: dist
|
|
},
|
|
ctx: {
|
|
debug: true
|
|
},
|
|
tauri: {
|
|
embeddedServer: {
|
|
active: true
|
|
}
|
|
}
|
|
}).then(() => {
|
|
const spawn = require('../cli/tauri.js/dist/helpers/spawn').spawn
|
|
const artifactPath = path.resolve(__dirname, 'src-tauri/target/debug/app')
|
|
appPid = spawn(
|
|
process.platform === 'win32' ? `${artifactPath}.exe` : artifactPath.replace('debug/app', 'debug/./app'),
|
|
[],
|
|
null
|
|
)
|
|
|
|
// if it didn't reply, throw an error
|
|
setTimeout(() => {
|
|
throw new Error("App didn't reply")
|
|
}, 2000)
|
|
})
|