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
|
|
|
|
2020-07-09 16:40:31 +03:00
|
|
|
const init = require('api/init')
|
|
|
|
init({
|
|
|
|
directory: process.cwd(),
|
|
|
|
force: 'all',
|
|
|
|
tauriPath: resolve(__dirname, '../../../../..')
|
|
|
|
})
|
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
|
|
|
|
2021-01-30 18:15:47 +03:00
|
|
|
const { build } = require('dist/api/cli')
|
2020-07-09 16:40:31 +03:00
|
|
|
await build({
|
2021-01-30 18:15:47 +03:00
|
|
|
config: {
|
|
|
|
tauri: {
|
|
|
|
bundle: {
|
|
|
|
targets: ['deb', 'osx', 'msi', 'appimage'] // we can't bundle dmg on CI so we remove it here
|
|
|
|
}
|
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
|
|
|
})
|
|
|
|
})
|