1
1
mirror of https://github.com/leon-ai/leon.git synced 2024-12-19 14:52:21 +03:00
leon/scripts/test-module.js

33 lines
888 B
JavaScript
Raw Normal View History

import { command } from 'execa'
2019-02-10 15:26:50 +03:00
import { LogHelper } from '@/helpers/log-helper'
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 {
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(
`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
LogHelper.default(cmd.stdout)
LogHelper.default(cmd.stderr)
LoaderHelper.stop()
2019-02-10 15:26:50 +03:00
} catch (e) {
LogHelper.default(e.message)
LoaderHelper.stop()
2019-02-10 15:26:50 +03:00
}
})()