mirror of
https://github.com/standardnotes/web.git
synced 2024-10-27 16:31:40 +03:00
3e4e7fd0e0
* feat: add building of SNJS Docker image for e2e testing purposes * fix: contents of snjs package * feat: add running e2e test suite * fix: include mocha directory in the snjs yarn package * fix: add triggering e2e tests with specific image tag * fix: mocha tests url * fix: add tests before publishing new version * fix: temporary skip linter errors * Revert "fix: temporary skip linter errors" This reverts commit c989536930a291677f6ef8cad402feb13f066b8c. * fix: replace test libraries with unpkg CDN versions * fix: update yarn lock and remove cached libs * fix: add missing library to mocha tests * fix: restore chai-as-promised built version * fix: serving sncrypto-web in mocha test suite * fix: add copy of sncrypto-web to gitignore files
30 lines
954 B
JavaScript
30 lines
954 B
JavaScript
/* Used for running mocha tests */
|
|
const connect = require('connect')
|
|
const serveStatic = require('serve-static')
|
|
const fs = require('fs')
|
|
|
|
const isDev = process.argv[2] === '--dev'
|
|
const port = isDev ? 9002 : 9001
|
|
|
|
const snCryptoDistFilePath = `${__dirname}/../sncrypto-web/dist/sncrypto-web.js`
|
|
if (!fs.existsSync(snCryptoDistFilePath)) {
|
|
console.error(
|
|
`Could not find sncrypto dist file under: ${snCryptoDistFilePath}. Please consider building the project first`,
|
|
)
|
|
|
|
process.exit(1)
|
|
}
|
|
|
|
fs.copyFileSync(snCryptoDistFilePath, `${__dirname}/mocha/vendor/sncrypto-web.js`)
|
|
|
|
connect()
|
|
.use(serveStatic(__dirname))
|
|
.listen(port, () => {
|
|
const url = `http://localhost:${port}/mocha/test.html`
|
|
console.log(`Test Server Started on ${url}`)
|
|
if (!isDev) {
|
|
const start = process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'start' : 'xdg-open'
|
|
require('child_process').exec(start + ' ' + url)
|
|
}
|
|
})
|