1
1
mirror of https://github.com/aelve/guide.git synced 2024-11-22 11:33:34 +03:00
guide/front/tests/index.ts
avele 0336942072
Frontend E2E tests (#404)
Frontend E2E tests
2019-10-29 00:54:54 +04:00

28 lines
710 B
TypeScript

import createTestCafe from 'testcafe'
(async () => {
try {
const isProduction = process.env.NODE_ENV === 'production'
const startingServer = isProduction
// @ts-ignore cause typescript throws compilation error if can't find the file
? (await import('../dist/server'))
: (await import('../server'))
await startingServer.default
const testcafe = await createTestCafe('localhost')
const failedCount = await testcafe
.createRunner()
.src('tests/tests.js')
.browsers('chrome')
.run()
testcafe.close()
const exitCode = failedCount ? 1 : 0
process.exit(exitCode)
} catch (error) {
console.error(error)
process.exit(1)
}
})()