2021-03-04 17:49:52 +03:00
|
|
|
import { command } from 'execa'
|
2019-02-10 15:26:50 +03:00
|
|
|
|
2022-09-26 16:29:56 +03:00
|
|
|
import { LogHelper } from '@/helpers/log-helper'
|
2022-09-26 16:24:07 +03:00
|
|
|
import { LoaderHelper } from '@/helpers/loader-helper'
|
2019-02-10 15:26:50 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Specific module testing script
|
|
|
|
*
|
|
|
|
* npm run test:module videodownloader:youtube
|
|
|
|
*/
|
2022-09-03 14:12:41 +03:00
|
|
|
;(async () => {
|
2019-02-10 15:26:50 +03:00
|
|
|
const { argv } = process
|
|
|
|
const s = argv[2].toLowerCase()
|
|
|
|
const arr = s.split(':')
|
|
|
|
const [pkg, module] = arr
|
|
|
|
|
|
|
|
try {
|
2022-09-26 16:24:07 +03:00
|
|
|
LoaderHelper.start()
|
2021-12-27 12:09:12 +03:00
|
|
|
await command('npm run train en', { shell: true })
|
2022-09-03 14:12:41 +03:00
|
|
|
const cmd = await command(
|
2022-10-04 09:19:56 +03:00
|
|
|
`cross-env PIPENV_PIPFILE=bridges/python/src/Pipfile LEON_NODE_ENV=testing jest --silent --config=./test/e2e/modules/e2e.modules.jest.json packages/${pkg}/test/${module}.spec.js && npm run train`,
|
2022-09-03 14:12:41 +03:00
|
|
|
{ shell: true }
|
|
|
|
)
|
2019-02-10 15:26:50 +03:00
|
|
|
|
2022-09-26 16:29:56 +03:00
|
|
|
LogHelper.default(cmd.stdout)
|
|
|
|
LogHelper.default(cmd.stderr)
|
2022-09-26 16:24:07 +03:00
|
|
|
LoaderHelper.stop()
|
2019-02-10 15:26:50 +03:00
|
|
|
} catch (e) {
|
2022-09-26 16:29:56 +03:00
|
|
|
LogHelper.default(e.message)
|
2022-09-26 16:24:07 +03:00
|
|
|
LoaderHelper.stop()
|
2019-02-10 15:26:50 +03:00
|
|
|
}
|
|
|
|
})()
|