Skip to content

Commit

Permalink
[Messenger] fix(tests): fix standalone tests execution
Browse files Browse the repository at this point in the history
  • Loading branch information
alekitto committed Nov 9, 2023
1 parent 3ef1534 commit 3111adf
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion fixtures/autoload.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { dirname } = require('path');

try {
require.resolve('@jymfony/autoload');
require.resolve('@jymfony/autoloader');
} catch (e) {
if ('MODULE_NOT_FOUND' === e.code) {
process.env.LAMBDA_TASK_ROOT = dirname(dirname(dirname(dirname(__dirname))));
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
},
"devDependencies": {
"@jymfony/debug": "https://github.com/jymfony/debug.git",
"@jymfony/dotenv": "https://github.com/jymfony/dotenv.git",
"@jymfony/filesystem": "https://github.com/jymfony/filesystem.git",
"@jymfony/testing": "https://github.com/jymfony/testing.git",
"mocha": "^10.2"
Expand Down
2 changes: 1 addition & 1 deletion src/GenericRuntime.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const RuntimeInterface = Jymfony.Component.Runtime.RuntimeInterface;
* that knows how to deal with each of them;
* - "error_handler" defines the class to use to handle errors;
* - "env_var_name" and "debug_var_name" define the name of the env
* vars that hold the Symfony env and the debug flag respectively.
* vars that hold the Jymfony env and the debug flag respectively.
*
* The app-callable can declare arguments among either:
* - "env" to get an object containing all the environment variables;
Expand Down
16 changes: 9 additions & 7 deletions src/JymfonyRuntime.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const GenericRuntime = Jymfony.Component.Runtime.GenericRuntime;
const JymfonyErrorHandler = Jymfony.Component.Runtime.Internal.JymfonyErrorHandler;

/**
* Knows the basic conventions to run Symfony apps.
* Knows the basic conventions to run Jymfony apps.
*
* In addition to the options managed by GenericRuntime, it accepts the following options:
* - "env" to define the name of the environment the app runs in;
Expand All @@ -19,16 +19,15 @@ const JymfonyErrorHandler = Jymfony.Component.Runtime.Internal.JymfonyErrorHandl
*
* When the "debug" / "env" options are not defined, they will fallback to the
* "APP_DEBUG" / "APP_ENV" environment variables, and to the "--env|-e" / "--no-debug"
* command line arguments if "symfony/console" is installed.
* command line arguments if "jymfony/console" is installed.
*
* When the "symfony/dotenv" component is installed, .env files are loaded.
* When "symfony/error-handler" is installed, it is registered in debug mode.
* When the "jymfony/dotenv" component is installed, .env files are loaded.
* When "jymfony/debug" is installed, it is registered in debug mode.
*
* On top of the base arguments provided by GenericRuntime,
* this runtime can feed the app-callable with arguments of type:
* - Request from "symfony/http-foundation" if the component is installed;
* - Application, Command, InputInterface and/or OutputInterface
* from "symfony/console" if the component is installed.
* from "jymfony/console" if the component is installed.
*
* This runtime can handle app-callables that return instances of either:
* - Application,
Expand Down Expand Up @@ -67,7 +66,10 @@ export default class JymfonyRuntime extends GenericRuntime {

const prodEnvs = options.prod_envs ?? [ 'prod' ];
const input = JymfonyRuntime.#getInput(options);
if (!(options.disable_dotenv ?? false) && !!options.project_dir) {
if (
!(options.disable_dotenv ?? !ReflectionClass.exists('Jymfony.Component.Dotenv.Dotenv')) &&
!!options.project_dir
) {
const testEnvs = options.test_envs ?? [ 'test' ];
try {
(new Jymfony.Component.Dotenv.Dotenv(envKey, debugKey))
Expand Down

0 comments on commit 3111adf

Please sign in to comment.