I'm using PhpStorm with a Laravel project and have set up a few basic JS tests using AVA.
They all work fine when I run them in the command line. e.g.:
example.text.js
import test from 'ava';
test('just a mockup', async (t) => {
let i = 1;
t.is(1,i);
});
If I run this in the terminal I get:
npm run ava src/example.test.js
ava [...]
ava "src/example.test.js"
1 passed
However if I setup a run configuration and run it via the run window of PhpStorm I get:
npm run ava src/example.test.js
ava [...]
ava "src/example.test.js"
⠋
⠙
⠹
⠸
⠼
⠴
⠦
⠧
⠧ just a mockup…
1 passed
⠇ just a mockup…
1 passed
1 passed
Which is the entire text "animation".
It's not really a problem but it's just annoying when there's many tests since you have to plow through all that junk to get to the actual meaningful information.
Is there any way to get the run window to animate the text?
Update
In case it helps anyone, I'm moving the comment conversation here:
There are 2 separate bug reports/feature requests in webstorm
WEB-19849 Support ANSI commands to show progress correctly to allow ANSI commands in general (which is how the animations are achieved)
WEB-21788 Support ava test runner to allow the Webstom test interface for ava tests
In addition as a temporary solution for myself using the tap output (--tap) in my run configuration which looks a bit nicer.
Related
Recently I ran into a problem that it seems no one know how to solve.
I want to run async code (#1) when I ...
start dev ( i.e. npm run dev or npm run serve )
before compiling
That means, the async code can only run once!
And I can't use the feature of of "Service Plugin" (#2) in Vue Cli to do that.
Because it's async, I even can't use any webpack hook list here (#3)
BUT!
I knew that can be achieved by using Vite (#4)
I just out of idea how to do that in Vue CLI (after spent tons of hours)
Any expert have an idea?
Note
#1 This should be not important at all, because it's an implementation details, but I'll just leave it here: The async task for me is starting a local websocket server.
#2 Because you can write down async code in Service Plugin, for more info, check this
#3 You might see a webpack compiler hook called beforeRun can support async, but sorry, that also doesn't work for me.
#4 As shown here, you can see there's a method called configResolved, which can let you do async task, and achieve what I want as I described in this post. I'm not considering to choose Vite for just solving this problem, because this would be too overkill.
In my project we had Jest running just fine and as far as I know no test dependencies were changed. When tests would fail it would log out the details of what was expected versus what was received. But if I have a failing test now (or try to make it fail like the following example) all I get is an error around pretty-format options:
when provided no parameters other than text › default values are set correctly
pretty-format: Unknown option "maxWidth".
48 |
49 | it('default values are set correctly', async () => {
> 50 | expect(element.variant).toBe('primarzy');
It should be telling me that it expected "primarzy" (misspelled on purpose) but got "primary". This is happening no matter which test suite has a failed test.
So for anyone else who encounters this, apparently different packages in my test dependencies were trying to run different versions of pretty-format breaking failed test output. The fix for me was just manually installing pretty-format:
npm i pretty-format --save-dev
Everything works fine after that.
I want to put break point on my generator code, but I don't know how to run the command on the debug mode.
I wrote generator using source_gen and build_runner
class MyGenerator extends GeneratorForAnnotation<Todo> {
#override
FutureOr<String> generateForAnnotatedElement(
Element element, ConstantReader annotation, BuildStep buildStep) {
return "// Hey! Annotation found!";
}
}
run commad flutter packages pub run build_runner build*
copy build.dart to root folder of project
add new run configuration
run debug, now you can debug your code generator!
* the packages is optional, you can just run flutter pub run build_runner build
Ivan's answer worked for me, but every time I changed a file that was using an annotation - the build process outputted:
[SEVERE] Terminating builds due to build script update
[INFO] Terminating. No further builds will be scheduled
and then renamed the build script itself from build.dart to build.dart.cached, and then exit with code 75.
After digging through the build_runner code, I discovered that this behavior can be mitigated by using the following Program Arguments:
serve --skip-build-script-check
(i.e. instead of just serve as Ivan suggested).
There may be some negative consequences; in the build_runner source code, in options.dart, I saw this:
// For testing only, skips the build script updates check.
bool skipBuildScriptCheck;
I used Git to pull a project
I then start IntelliJ, and say: Open Project.
The project itself looks like it has 4 modules, Lab1, Lab2, Solution2, Solution2
I open the full project. In Lab1, i want to run to see how my web page looks, but when i say: Run main.dart the error kicked back is:
C:\code\dart-sdk\bin\dart.exe --ignore-unrecognized-flags --checked --enable-vm-service:51293 --trace_service_pause_events C:\code\workspace\tw_remoting_training\codelab_01\web\main.dart
Observatory listening on http://127.0.0.1:51293
The built-in library 'dart:html' is not available on the stand-alone VM.
'package:remoting_training/remoting_printer.dart': error: line 20 pos 1: library handler failed
import 'dart:html';
^
Process finished with exit code 254
Im not sure what is going on here though. As a secondary option, i will also try to Right-Click on index.html and click: Open with > Dartium but that shows a blank page. It shouldve done 4 async calls which printed strings to the screen.
Is there something I am missing? Is it not running because of it being a module in a project?
If your Dart script imports dart:html or a library that imports dart:html you can run that script only from the Dartium browser (by adding a script tag to HTML that points the that Dart script, or if you run it through pub build or dart2js in any browser), but it can't be run from the console.
With dart:io it's exactly the opposite, it can't be run in the browser.
I'm running tests with npm test - that actually runs a grunt task grunt casperjs:
casperjs:{
options:{},
files:
['./test_index.js',
'./test_map_regression.js',
'./test_index_get_gush.js'] /
},
using the grunt-casperjs-plugin in order to automate testing with slimerjs along with phantomjs, both running under casperjs in Travis-ci.
In order to do that, I need to pass the engine as a variable from the command line. something like:
casperjs --engine=slimerjs test_suite.js
Question: I can't find a way to pass the options from grunt cli (and I assume npm command line options would delegate to grunt. correctly?) to the files array.
I tried to add:
var engine = grunt.option('engine') || 'phantomjs';
engine = '--engine='+engine;
and then in the file array do:
files:['./test_index.js '+engine,
'./test_map_regression.js '+enging,
'./test_index_get_gush.js '+engine]
but seems that file array has to get real file names without the added args.
I'll be glad for any ideas on how to solve this through.
I haven't tested this, but looking at the grunt-casperjs source, it looks as though you would want to pass the engine as an option.
So, something like this should work:
casperjs:{
options: {
'engine': 'slimerjs'
},
files: [
'./test_index.js',
'./test_map_regression.js',
'./test_index_get_gush.js'
]
}