i am new about this kind of stuff but ive be hearing a lot about how good is nodejs but when i running the code in basic electron (with main.js and npm start) its completely success but when i running the same code in mocha(with npm test mocha ) so much syntax error is mocha and electron have different partition?? i run the same code but just in different run test
my version windows 10 mocha 8.3.1 electron 9.4.3
console.log('bisaaaaaa'); const electron = require('electron'); const path = require('path'); const fs = require('fs'); const axios = require('axios'); const dialog = electron.remote.dialog; var uploadFile = document.getElementById('upload'); global.filepath = undefined; uploadFile.addEventListener('click', () => { // If the platform is 'win32' or 'Linux' if (process.platform !== 'darwin') { dialog.showOpenDialog({ title: 'pilih file', defaultPath: path.join(__dirname, '../assets/'), buttonLabel: 'UPLOAD', filters: [ { name: 'image Files', extensions: ['txt', 'docx','jpg','jpeg','png'] }, ], properties: ['openFile'] }).then(file => { console.log(file.canceled); if (!file.canceled) { global.filepath = file.filePaths[0].toString(); console.log(global.filepath); } }).catch(err => { console.log(err) }); } else { // If the platform is 'darwin' (macOS) dialog.showOpenDialog({ title: 'pilih file', defaultPath: path.join(__dirname, '../assets/'), buttonLabel: 'UPLOAD', filters: [ { name: 'image Files', extensions: ['txt', 'docx','jpg','jpeg','png'] }, ], properties: ['openFile', 'openDirectory'] }).then(file => { console.log(file.canceled); if (!file.canceled) { global.filepath = file.filePaths[0].toString(); console.log(global.filepath); } }).catch(err => { console.log(err) }); } }); https://stackoverflow.com/questions/66701985/success-running-in-basic-electron-but-error-in-mocha-test March 19, 2021 at 11:05AM
没有评论:
发表评论