mirror of
https://github.com/chylex/Lightning-Tracker.git
synced 2025-04-07 11:15:44 +02:00
Add support for Codeception code coverage
This commit is contained in:
parent
42c517a696
commit
91efd38c3f
18
.idea/runConfigurations/Test__Cover_.xml
Normal file
18
.idea/runConfigurations/Test__Cover_.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Test (Cover)" type="CodeceptionConfigurationType" factoryName="Codeception">
|
||||
<CommandLine workingDirectory="$PROJECT_DIR$" />
|
||||
<PhpTestRunnerSettings method="" scope="ConfigurationFile" options="--coverage --coverage-xml --coverage-html" />
|
||||
<method v="2">
|
||||
<option name="GulpBeforeRunTask" enabled="true">
|
||||
<node-interpreter>project</node-interpreter>
|
||||
<node-options />
|
||||
<gulpfile>$PROJECT_DIR$/build/gulpfile.js</gulpfile>
|
||||
<tasks>
|
||||
<task>prepareCoverage</task>
|
||||
</tasks>
|
||||
<arguments />
|
||||
<envs />
|
||||
</option>
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
@ -1,3 +1,3 @@
|
||||
<component name="DependencyValidationManager">
|
||||
<scope name="No Formatting" pattern="file[LightningTracker]:res/~resources/fonts//*||file[LightningTracker]:res/~resources/css/icons.css||file[LightningTracker]:composer.lock" />
|
||||
<scope name="No Formatting" pattern="file[LightningTracker]:res/~resources/fonts//*||file[LightningTracker]:res/~resources/css/icons.css||file[LightningTracker]:composer.lock||file:build/coverage/composer.lock" />
|
||||
</component>
|
24
build/coverage/codeception.yml
Normal file
24
build/coverage/codeception.yml
Normal file
@ -0,0 +1,24 @@
|
||||
paths:
|
||||
tests: tests
|
||||
output: tests/_output
|
||||
data: tests/_data
|
||||
support: tests/_support
|
||||
envs: tests/_envs
|
||||
actor_suffix: Tester
|
||||
extensions:
|
||||
enabled:
|
||||
- Codeception\Extension\RunFailed
|
||||
coverage:
|
||||
enabled: true
|
||||
remote: true
|
||||
include:
|
||||
- './*'
|
||||
exclude:
|
||||
- 'c3.php'
|
||||
- 'codeception.yml'
|
||||
- 'composer.json'
|
||||
- 'composer.lock'
|
||||
- '~database/*'
|
||||
- '~resources/*'
|
||||
- 'tests/*'
|
||||
- 'vendor/*'
|
6
build/coverage/composer.json
Normal file
6
build/coverage/composer.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"require-dev": {
|
||||
"codeception/codeception": "4.1.7",
|
||||
"codeception/c3": "2.4"
|
||||
}
|
||||
}
|
3634
build/coverage/composer.lock
generated
Normal file
3634
build/coverage/composer.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
12
build/coverage/index.php
Normal file
12
build/coverage/index.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/** @noinspection PhpMissingStrictTypesDeclarationInspection */
|
||||
|
||||
require __DIR__.'/c3.php';
|
||||
|
||||
/** @noinspection ConstantCanBeUsedInspection */
|
||||
if (version_compare(PHP_VERSION, '7.4', '<')){
|
||||
die('Lightning Tracker requires PHP 7.4 or newer.');
|
||||
}
|
||||
|
||||
require __DIR__.'/bootstrap.php';
|
||||
?>
|
@ -7,6 +7,7 @@ const del = require("del");
|
||||
const glob = require("glob");
|
||||
const merge = require("merge-stream");
|
||||
|
||||
const childProcess = require("child_process");
|
||||
const crypto = require("crypto");
|
||||
const fs = require("fs");
|
||||
const fse = require("fs-extra");
|
||||
@ -109,8 +110,12 @@ function taskPrepareTests(cb){
|
||||
|
||||
if (fs.existsSync(output)){
|
||||
for(const file of fs.readdirSync(output)){
|
||||
if (file !== ".gitignore"){
|
||||
fs.unlinkSync(path.join(output, file));
|
||||
if (file !== ".gitignore" && !file.endsWith("coverage.serialized") && !file.endsWith("coverage.xml")){
|
||||
const fullPath = path.join(output, file);
|
||||
|
||||
if (fs.lstatSync(fullPath).isFile()){
|
||||
fs.unlinkSync(fullPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -118,6 +123,24 @@ function taskPrepareTests(cb){
|
||||
cb();
|
||||
}
|
||||
|
||||
function taskPrepareCoverage(cb){
|
||||
const tests = "../tests";
|
||||
const www = "../server/www";
|
||||
const wwwtests = www + "/tests";
|
||||
|
||||
fse.copySync("./coverage", www);
|
||||
fs.mkdirSync(wwwtests);
|
||||
|
||||
for(const file of glob.sync(tests + "/*.yml")){
|
||||
fs.copyFileSync(file, wwwtests + "/" + path.basename(file));
|
||||
}
|
||||
|
||||
childProcess.execSync("composer install", { cwd: www });
|
||||
cb();
|
||||
}
|
||||
|
||||
exports.default = series(taskClean, taskCopy, taskCSS, taskHash);
|
||||
// noinspection JSUnusedGlobalSymbols
|
||||
exports.prepareTests = series(taskClean, taskCopy, taskCSS, taskHash, taskPrepareTests);
|
||||
// noinspection JSUnusedGlobalSymbols
|
||||
exports.prepareCoverage = series(taskClean, taskCopy, taskCSS, taskHash, taskPrepareTests, taskPrepareCoverage);
|
||||
|
@ -8,3 +8,7 @@ actor_suffix: Tester
|
||||
extensions:
|
||||
enabled:
|
||||
- Codeception\Extension\RunFailed
|
||||
coverage:
|
||||
enabled: true
|
||||
remote: true
|
||||
c3_url: 'http://localhost'
|
||||
|
@ -69,8 +69,9 @@ class Acceptance extends Module{
|
||||
$dir_backup = __DIR__.'/../../../server/www-backup';
|
||||
$dir_www = __DIR__.'/../../../server/www';
|
||||
$dir_tmp = $dir_www.'-tmp';
|
||||
$dir_c3 = $dir_www.'/tests/_output/c3tmp';
|
||||
|
||||
if (is_dir($dir_backup)){
|
||||
if (is_dir($dir_backup) && !is_dir($dir_c3)){
|
||||
$delete = new RecursiveDirectoryIterator($dir_www, FilesystemIterator::SKIP_DOTS);
|
||||
|
||||
foreach(new RecursiveIteratorIterator($delete, RecursiveIteratorIterator::CHILD_FIRST) as $path){
|
||||
|
Loading…
Reference in New Issue
Block a user