2020-03-09 23:57:27 +03:00
|
|
|
const fixtureSetup = require('../fixtures/app-test-setup')
|
2020-08-19 05:36:46 +03:00
|
|
|
const { resolve } = require('path')
|
|
|
|
const { writeFileSync, readFileSync } = require('fs')
|
2020-03-09 23:57:27 +03:00
|
|
|
|
|
|
|
describe('[CLI] tauri.js template', () => {
|
2020-07-09 16:40:31 +03:00
|
|
|
it('init a project and builds it', async () => {
|
2020-03-09 23:57:27 +03:00
|
|
|
const cwd = process.cwd()
|
2020-07-09 16:40:31 +03:00
|
|
|
const fixturePath = resolve(__dirname, '../fixtures/empty')
|
|
|
|
const tauriFixturePath = resolve(fixturePath, 'src-tauri')
|
2020-03-09 23:57:27 +03:00
|
|
|
|
2020-07-09 16:40:31 +03:00
|
|
|
fixtureSetup.initJest('empty')
|
2020-03-09 23:57:27 +03:00
|
|
|
|
2020-07-09 16:40:31 +03:00
|
|
|
process.chdir(fixturePath)
|
2020-03-09 23:57:27 +03:00
|
|
|
|
2021-03-25 01:21:03 +03:00
|
|
|
const { init, build } = require('dist/api/cli')
|
|
|
|
await init({
|
2020-07-09 16:40:31 +03:00
|
|
|
directory: process.cwd(),
|
2021-03-25 01:21:03 +03:00
|
|
|
force: true,
|
|
|
|
tauriPath: resolve(__dirname, '../../../../..'),
|
|
|
|
ci: true
|
|
|
|
}).promise
|
2020-03-09 23:57:27 +03:00
|
|
|
|
2020-07-09 16:40:31 +03:00
|
|
|
process.chdir(tauriFixturePath)
|
2020-03-09 23:57:27 +03:00
|
|
|
|
2020-07-09 16:40:31 +03:00
|
|
|
const manifestPath = resolve(tauriFixturePath, 'Cargo.toml')
|
|
|
|
const manifestFile = readFileSync(manifestPath).toString()
|
|
|
|
writeFileSync(manifestPath, `workspace = { }\n\n${manifestFile}`)
|
2020-03-09 23:57:27 +03:00
|
|
|
|
2020-07-09 16:40:31 +03:00
|
|
|
await build({
|
2021-01-30 18:15:47 +03:00
|
|
|
config: {
|
|
|
|
tauri: {
|
|
|
|
bundle: {
|
2021-03-25 07:56:00 +03:00
|
|
|
targets: ['deb', 'app', 'msi', 'appimage'] // we can't bundle dmg on CI so we remove it here
|
2021-01-30 18:15:47 +03:00
|
|
|
}
|
2020-04-07 17:18:37 +03:00
|
|
|
}
|
|
|
|
}
|
2021-01-30 18:15:47 +03:00
|
|
|
}).promise
|
|
|
|
process.chdir(cwd)
|
2020-03-09 23:57:27 +03:00
|
|
|
})
|
|
|
|
})
|