Move building Newsletter tests to their job
[MAILPOET-6178]
This commit is contained in:
committed by
Rostislav Wolný
parent
e2e1346649
commit
784d7c1189
@@ -330,6 +330,7 @@ jobs:
|
||||
name: 'JS Newsletter Editor Tests'
|
||||
command: |
|
||||
mkdir test-results/mocha
|
||||
./do compile:js --env production --only-tests
|
||||
./do t:newsletter-editor test-results/mocha/newsletter_editor_junit.xml
|
||||
- run:
|
||||
name: 'JS Tests'
|
||||
|
@@ -198,15 +198,17 @@ class RoboFile extends \Robo\Tasks {
|
||||
return $collection->run();
|
||||
}
|
||||
|
||||
public function compileJs($opts = ['env' => null, 'skip-tests' => false]) {
|
||||
public function compileJs($opts = ['env' => null, 'skip-tests' => false, 'only-tests' => false]) {
|
||||
if (!is_dir('assets/dist/js')) {
|
||||
mkdir('assets/dist/js', 0777, true);
|
||||
}
|
||||
$this->_exec('rm -rf ' . __DIR__ . '/assets/dist/js/*');
|
||||
if (!$opts['only-tests']) {
|
||||
$this->_exec('rm -rf ' . __DIR__ . '/assets/dist/js/*');
|
||||
}
|
||||
$env = ($opts['env']) ?
|
||||
sprintf('./node_modules/.bin/cross-env NODE_ENV="%s"', $opts['env']) :
|
||||
null;
|
||||
return $this->_exec($env . ' ./node_modules/webpack/bin/webpack.js --env BUILD_TESTS=' . ($opts['skip-tests'] ? 'skip' : 'build'));
|
||||
return $this->_exec($env . ' ./node_modules/webpack/bin/webpack.js --env BUILD_TESTS=' . ($opts['skip-tests'] ? 'skip' : 'build') . '--env BUILD_ONLY_TESTS=' . ($opts['only-tests'] ? 'true' : 'false'));
|
||||
}
|
||||
|
||||
public function compileCss($opts = ['env' => null]) {
|
||||
|
@@ -265,6 +265,7 @@ const publicConfig = {
|
||||
// Newsletter Editor Tests Config
|
||||
const testConfig = {
|
||||
name: 'test',
|
||||
mode: PRODUCTION_ENV ? 'production' : 'development', // Add mode directly to testConfig
|
||||
entry: {
|
||||
vendor: 'webpack-vendor-index.jsx',
|
||||
testNewsletterEditor: [
|
||||
@@ -529,6 +530,12 @@ module.exports = (env) => {
|
||||
if (env && env.BUILD_TESTS === 'build') {
|
||||
configs.push(testConfig);
|
||||
}
|
||||
|
||||
// If only the test build is requested
|
||||
if (env && env.BUILD_ONLY_TESTS === 'true') {
|
||||
return [testConfig];
|
||||
}
|
||||
|
||||
return configs.map((conf) => {
|
||||
const config = Object.assign({}, conf);
|
||||
if (
|
||||
|
Reference in New Issue
Block a user