Functional Tests with TYPO3 v10 no composer autoload - testing

When I try to run a functional test which uses the class TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\AbstractTestCase I get an error Class 'TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\AbstractTestCase' not found.... Is this an composer autoloader problem? Any Ideas how to fix this?
/usr/bin/php7.4 /mypath/typo3_10/vendor/phpunit/phpunit/phpunit --bootstrap /mypath/typo3_10/vendor/typo3/testing-framework/Resources/Core/Build/FunctionalTestsBootstrap.php --configuration /mypath/typo3_10/vendor/typo3/testing-framework/Resources/Core/Build/FunctionalTests.xml /mypath/typo3_10/web/typo3/sysext/seo --teamcity
is the command in PHPStorm.

"autoload-dev": {
"psr-4": {
"TYPO3\\CMS\\Frontend\\Tests\\": "web/typo3/sysext/frontend/Tests/",
"TYPO3\\CMS\\Core\\Tests\\": "web/typo3/sysext/core/Tests/"
}
}
the solution is to add the missing Namespaces to the root composer.json and dump the autoloader again

Related

How to add a loader in a Vue/Webpack app to support non JS files used in a dependency of a node module

I have a Vue 2 app that uses Webpack, and I am trying to use in it the node module PSD.js, which in itself utilizes CoffeeScript as part of it's dependencies. When I try to compile i get the error:
Module parse failed: Unexpected character '#' (1:0) You may need an appropriate loader to handle this file type,
referring to the the file ./node_modules/coffee-script/lib/coffee-script/register.js that PSD.js installed as part of it's dependencies when I did npm install psd.
Any ideas on how to make this work?
I understand I need to tell the Vue app how to handle .coffee files with a loader, but I have tried installing coffee-loader, coffee, set the vue.config.js to:
module.exports = {
publicPath: "./",
configureWebpack: {
target: "node-webkit",
node: false,
module: {
rules: [
// ...
{
test: /\.coffee$/,
use: [
{
loader: 'coffee-loader'
}
]
}
]
}
},
lintOnSave: false
};
yet still nothing works, I get the same error. I feel it is because I am not using CoffeeScript directly but rather a node module that I AM using, psd.js, is the one using it. That is why I cannot set lang="coffee" in the script tag attribute of my Vue module (I am using vanilla JS to run everything).
thnx in advance
ADDING MORE INFO:
I use a boilerplate framework to setup my app, and it initialises the vue/webpack app for me indirectly.
To reproduce, and even though this system is for Adobe plugins, you do not need the Adobe host app to see the issue, do:
npm install -g bombino
Then in a folder of your choosing run:
bombino
and fill in these params when asked:
? Name of panel? Hello World
? Use your custom templates or bombino defaults? Bombino
What tooling preset should be used? Vue-CLI
? Which Vue-CLI template should be used? bombino-vue-bare (Absolute minimum)
? Host apps to include: After Effects
? Base CEF Port (between 1024 and 65534) 8666
? Run npm install for you? Yes
then cd into Hello-World and run npm run serve. You should see the app is compiled correctly and is running on some port (8080 or higher if taken).
Now go back to the root folder and install psd.js: npm install psd
then go back into Hello-World and run npm run serve again. This time it will fail to compile with the error I started this question with. Even if you go and install coffee-loader by doing npm install --save coffeescript coffee-loader and change the vue.config.js to be like so:
publicPath: "./",
// Thanks Eric Robinson
configureWebpack: {
target: "node-webkit", // Set the target to node-webkit (https://webpack.js.org/configuration/target/)
node: false, // Don't set certain Node globals/modules to empty objects (https://webpack.js.org/configuration/node/),
module: {
rules: [
// ...
{
test: /\.coffee$/,
use: [
{
loader: 'coffee-loader'
}
]
}
]
}
},
lintOnSave: false
};
or if you do vue use coffee - all of these result in the same error: the compiler/packager doesn't know how to handle the .coffee file (used as a dependency by psd.js).
Thnx again to anyone who has info

Using Quasar Notify plugin in Storybook mdx file (Quasar v2, Storybook, Vue3)

I'm having some issues with the Notify plugin from Quasar. I have already defined the plugin in quasar.config.js and made the necessary imports according to the Quasar documentation. However, I am still facing the error of $q.notify being undefined in the .mdx story file. In Quasar V1, the error was not generated and the code works fine. Thanks in advance!
For anyone interested, I solved it by adding the following in the storybook preview.js file:
app.use(Quasar, {
plugins: {
Notify,
},
config: {
notify:{},
},
}

How run less-plugin-glob in gulp like task?

I want use https://github.com/just-boris/less-plugin-glob this plugin for multi importing less files.
When I run
lessc --glob styles.less styles.css
from terminal - it's work fine, but I dont understand how I could run this command like gulp-task for every style build?
Use the plugins option to pass the plugin to gulp-less. Example:
gulp.task('less', function () {
return gulp.src('./less/**/*.less')
.pipe(less({
plugins: [ require('less-plugin-glob') ]
}))
.pipe(gulp.dest('./dist/css'));
});

Utilising composers asset-installer-paths not working

I'm trying to install a certain package in composer into a certain path, the package name is cyphix333/nbbc and normally it would be installed into vendor/cyphix333/nbbc however I wanted to install it into vendor/nbbc so I tried this in the main project composer.json
"require": {
//......
"cyphix333/nbbc": "dev-master"
},
"extra": {
"asset-installer-paths": {
//.....
"cyphix333/nbbc": "vendor/nbbc"
}
}
However it didn't work, it still installed into vendor/cyphix333/nbbc.
Edit: ...and here is the full data from the extra part, which comes from my php framework yii2:
"extra": {
"yii\\composer\\Installer::postCreateProject": {
"setPermission": [
{
"runtime": "0777",
"web/assets": "0777",
"yii": "0755"
}
],
"generateCookieValidationKey": [
"config/web.php"
]
},
"asset-installer-paths": {
"npm-asset-library": "vendor/npm",
"bower-asset-library": "vendor/bower",
"cyphix333/nbbc": "vendor/nbbc"
}
}
What am I doing wrong here?
1. asset-installer-paths = Composer plugin fxp/composer-asset-plugin
The asset-installer-paths directive belongs to the Composer plugin fxp/composer-asset-plugin.
The plugin is required, for this directive to work. But you are not requiring it in your project repo or globally.
Docu - Installation
composer require "fxp/composer-asset-plugin:~1.0"
or
composer global require "fxp/composer-asset-plugin:~1.0"
2. Is cyphix333/nbbc a Bower or NPM asset?
No.
3. What am I doing wrong here?
You think, that you can use asset-installer-paths directive to move your package to a specific folder. You can't. Because your repo is not an Bower or NPM asset.
4. How can i move my package from vendor/cyphix333/nbbc to vendor/nbbc?
Stop trying that. It's wasted time. Why? Composer has an Autoloader and he does the mapping from classname to filename. Please do not care about the path, just define an autloading strategy (files or classmap) and start using your class.
If you really need to copy stuff, you might use the scripts section of your composer.json.
https://getcomposer.org/doc/articles/scripts.md

Running DOH on the command line with node.js

My first attempt to run tests using Dojo 1.8.3 on the command line with
node was thwarted by this error message:
../dojo/dojo.js:15
ode:function(){return _25;},guardCheckComplete:_37};};if(1){var _38=location.p
^
ReferenceError: location is not defined
The workaround is to use the uncompressed source instead of the release,
since the optimized version only seems to work in a browser. Next I tried a configuration script
// bootstrap.js
dojoConfig = {
baseUrl: ".",
packages:[{name: 'dojo', location: '../dojo_src'}],
deps: ['./ui_test.js']
};
require('../dojo_src/dojo.js');
And a simple test
// ui_test.js
dojo.require("doh.runner");
doh.register("test_1", [
function four_eq_4() {
var x = 4;
doh.is(x.toString(), "4");
}
]);
doh.run();
console.log("done.");
When I run the tests doh.run() does not seem to have an effect
$ node bootstrap.js
done.
My directory structure:
/app
bootstrap.js
ui_test.js
/util/doh
/dojo_src
What is the correct way to use DOH on the command line?
The answer is simple, but not obvious. Run with load=doh to invoke the test runner.
$ node bootstrap.js load=odh