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'
]
}
Related
I am attempting to get the volar vue language server to work in place of vetur for neovim's native lsp.
Using both lspconfig and lspinstall I was able to create a working custom install for sumneko_lua (unrelated but had to manually build due to some issues with the built-in :LspInstall lua). Below is that code duplicated and modified for an attempt at using this new vue server:
local vue_config = require'lspinstall/util'.extract_config('vuels')
vue_config.default_config.cmd = {'node', './node_modules/vscode-vue-languageservice/out/index.js', '--stdio'}
require'lspinstall/servers'.newvue = vim.tbl_extend('error', vue_config, {
install_script = [[
! test -f package.json && npm init -y --scope=lspinstall || true
npm install vscode-vue-languageservice#latest
]],
uninstall_script = nil
})
Running :LspInstall newvue installs properly, however :LspInfo shows this language server is attached to the buffer (of a .vue file) but not active. I believe the issue is with this path: ./node_modules/vscode-vue-languageservice/out/index.js. It exists, but may not be the correct entry point? The default vue ls simply has vls as the command because it provides a binary. Am I missing something in this package? I have yet to come across another language server without a single binary to pick out.
Thanks!
Can you try an absolute path to the out.js file? In my pretty elaborate config for a custom Volar install I'm using something just /home/myuser/dev/volar/packages/server/out/index.js (where the volar folder is just the whole volar cloned github repo). My full config is here
I don't think you can use relative paths like you did. I know you're assuming that the "./node_modules" means "workspace directory" but it's hard to tell in which directory nvim-lspconfig opens up those executables.
I have yet to come across another language server without a single binary to pick out.
Volar also provides a binary, it's volar-server (after running npm i -g #volar/server), it's just with a custom install (ie. alongside the real volar) you can't use it, because I assume you want to use your local install with custom code.
As for more indepth debugging/logging, you can check ~/.cache/nvim/lsp.log to see why the language server dies in detail.
I am using WebdriverIO/Cucumber (wdio-cucumber-framework) for my test automation. I want to get the test execution result in a HTML file. As of now I am using Spec Reporter (wdio-spec-reporter). Which helps to print the results in console window. But I want all the execution reports in a HTML file.
How can I get WebdriverIO test execution result in a HTML file?
Thanks.
OK, finally got some spare time to tackle your question #Thangakumar D. WebdriverIO reporting is a vast subject (there are multiple ways to generate such a report), so I'll go ahead and start with my favorite reporter: Allure!
Allure Reporter:
[Preface: make sure you're in your project root]
Install your package (if you haven't already): npm install wdio-allure-reporter --save-dev
Install Allure CommandLine (you'll see why later): npm install -g allure-commandline --save-dev
Setup your wdio.config.js file to support Allure as a reporter
wdio.config.js:
reporters: ['allure', 'dot', 'spec', 'json'],
reporterOptions: {
outputDir: './wdio-logs/',
allure: {
outputDir: './allure-reports/allure/'
}
}
Run your tests! Notice that, once your regression ends, your /allure-results/ folder has been populated with multiple .json, .txt, .png (if you have screenshot errors), and .xml files. The cotent of this folder is going to be used by Allure CommandLine to render you HTML report.
Go to your /allure-results/ folder and generate the report via: allure generate <reportsFolderPath> (do it like this allure generate .
If you want your /allure-reports/ folder inside /allure-results/)
Now go into your /allure-reports folder and ope index.html into your browser of choice (use Firefox for starters)
Note: The generated index.html file won't have all the content loaded on Chrome unless you do some tweaks. It's due to default WebKit not being able to load all the AJAX calls required. Read more about it here.
If you're successfully completed all the previous steps, it should look something like this:
Hope this helped. Cheers!
Note: I'll try to UPDATE this post when I get some more time with other awesome ways to generate reports from your WebdriverIO reporter logs, especially if this post gets some love/upvotes along the way.
e.g.: Another combo that I enjoy using being: wdio-json-reporter/wdio-junit-reporter coupled with a easy-to-use templating language, Jinja2.
I have been using Mochawesome reporter and it looks beautiful, check it out
here.
Mochawesome reporter generates the mochoawesome.json which then can be used to create a beautiful report using Mochawesome report generator
Installation:
> npm install --save wdio-mochawesome-reporter
> npm install --save mochawesome-report-generator#2.3.2
It is easier to integrate by adding this line in the wdio.conf.js:
// sample wdio.conf.js
module.exports = {
// ...
reporters: ['dot', 'mochawesome'],
reporterOptions: {
outputDir: './', //mochawesome.json file will be written to this directory
},
// ...
};
Add the script to package.json:
"scripts": {
"generateMochawesome": "marge path/to/mochawesome.json --reportTitle 'My project results'"
},
I am new to webpack and attempting to use it together with the Babel loader to write a library in ES6. I also want to use Karma/PhantomJS for a testing pipeline.
I have hit an odd issue where PhantomJS indicates that ES6 code didn't get converted when I run the tests:
SyntaxError: Use of reserved word 'let' in strict mode
at webpack:///say/hello.js:2:0 <- say/hello.spec.js:22929
But this only happens when I export my webpack config as a function (to take advantage of environment as per https://webpack.js.org/configuration/configuration-types/#exporting-a-function-to-use-env). Exporting config as an object is fine.
I have made a public repo to help others reproduce this at https://github.com/agentreno/es6-library-example with the npm 'test' and 'test:broken' tasks to demonstrate. I would greatly appreciate any assistance.
The problem is not the webpack config, but how you use it in your karma.config on line 37. The webpack option in the karma config expects an object, but you're giving it a function. You actually need to call the function to get the resulting object, which webpack usually does for you when you run webpack from the command line.
As you're not currently using env (the input parameter to the webpack function), you can simply call it:
webpack: webpackConfig(),
But when you start having conditions based on this, you'd need to pass the correct values. Let's say you're using the example mentioned in the docs: --env.production and --env.platform=web. Webpack will call the function as follows:
webpackConfig({ production: true, target: 'web' })
Using IntelliJ/WebStorm if I run tsc from a FileWatcher, my compile errors are linked to the files in the editor, such that if I double-click on a compiler error, it opens that file and takes me to the offending line of code.
However if I run Grunt, either via the integrated Grunt console, or via a FileWatcher, the compile errors do not have links and I have to manually open the file and goto the offending line number.
Is there any way to get the compile errors comming from Grunt integrated as links, like the TypeScript FileWatcher's invocation of tsc does?
When running Grunt as a file watcher, you can set up filters to make links clickable. You can use existing filters as example: open your file watcher settings, press Output Filters..., open the filter settings and copy the regular expression specified there. See http://www.jetbrains.com/webstorm/webhelp/add-filter-dialog.html
In Webstorm 8, it is not possible to apply regular expression filters on Grunt console output.
The way to go, as mentioned by lena, is to call Grunt directly via an External tool entry, and set up appropriate regex filters, such as:
For grunt-ts:
$FILE_PATH$\($LINE$,$COLUMN$\):.*
For grunt-tslint:
...$FILE_PATH$\[$LINE$,\s$COLUMN$\]:.*
Also see my comment above regarding a caveat for grunt-tslint in some environments.
I believe the '>>' added by grunt-typescript is throwing it off. Try grunt-ts (disclaimer : one of the authors) which is tested with webstorm https://github.com/grunt-ts/grunt-ts
I noticed in Webstorm 9, the built-in Grunt console was filtering/linking on typescript compile errors with grunt-typescript. I am not sure if this is a recent change or not, but it was linking this for example,
So, I went into grunt-tslint/node_modules/tslint/build/formatters, and copied proseFormatter.js to ./myproseFormatter.js. Then I tweaked it so the tslint output format would match the compile error format, by replacing square brackets with parens, and removing the whitespace between line and column number. Finally, I referenced my custom formatter in my gruntfile tslint config by adding the formatter and formattersDirectory properties:
tslint: {
options: {
configuration: grunt.file.readJSON('tslint.json'),
formatter: 'myprose',
formattersDirectory: './'
},
all: {
src: [ 'app/**/*.ts' ]
}
}
and it worked!
Anyone know if and how it's possible to run casperjs from within the phantomjs shell (a.k.a InteractiveModeREPL )?
I've also tried passing the direct path to the casper.js module and that has not worked either.
Progress/Update:
Tried phantomjs.injectJs('C:/casperjs/module/casper.js'); but got Error: Cannot find module 'colorizer' I guess I'm getting close.
This gets me closer but still missing path:
phantomjs.injectJs('C:/casperjs/module/bin/bootstrap.js')
errors out with Cannot find package.json at C:/package.json
OK, looks like I can pass the --casper-path option when starting phantomjs (see - casper/bin/bootstrap.js: line 189).
OK that worked. (passing the option did not work but setting the path inside of phantom did).
So to get this stuff to run inside the phantomjs shell first you need to set a casperPath variable in the phantom global object.
phantom.casperPath = "C:/casper";
Then you need to inJect caspers's bootstrap.js file.
phantom.injectJs("C:/casper/bin/bootstrap.js");
Now you can instantiate a casper object and play with it in the shell.
var casper = require("casper").create();
enjoy.