Can anyone help me to understand that behaviour:
when I ran in terminal jest command: all my tests passed
I have also defined package.json script where I do exactly the same command jest and when i run npm run tests jest command is executed and all my tests passed.
BUT:
I run it on dockerimage. I have copy all project files to Docker, install all depend. and run tests.
npm run tests - failed
jest - passed
I am on the build docker image, in terminal run both commands. I see that they are giving different results. I know that it different OS. maybe different libraries, but npm, node and jest versions are identical.
Looks like running npm run tests behave differently. I'm stuck, don't know what to check, and how to debug it. Where the problem might be?
Related
I'm not using npm, so I've downloaded Cypress directly. I'm able to open the Cypress binary directly from the command line, but I can't make it run tests from the command line. Running Cypress run just opens the UI. Cypress run --project /path/to/my/project does open the project in the UI, but doesn't run it. Bizarrely, Cypress version doesn't display the version, it just opens the UI. Even Cypress this-is-not-a-command opens the UI without any errors.
You should use the cypress NPM package to run Cypress from the command line. The binary itself is not designed to be executed for anything other than global open mode. The cypress NPM package contains a command-line utility that makes cypress run, cypress open, and cypress version work like you expect.
If you really really really don't want to use the CLI supplied with the cypress NPM package, you can reference how the CLI translates your command line arguments:
in open mode: https://github.com/cypress-io/cypress/blob/develop/cli/lib/exec/open.js
in run mode: https://github.com/cypress-io/cypress/blob/develop/cli/lib/exec/run.js
Note that these APIs are internal and may change at any time.
So, to do cypress run --project /path/to/project directly on the binary, it would look like this:
cypress-binary --run-project /path/to/project
One of my co-workers added this Ava package to our setup, and it's done something I've never seen a Node package do before: interfere with other packages! Now when I try to run Mocha I get:
$ node_modules/mocha/bin/mocha test/
Test files must be run with the AVA CLI:
$ ava node_modules/mocha/bin/_mocha
I get that Ava would like to run my Mocha tests, but if I wanted that I'd run ava mocha not mocha. And because a co-worker is using it I can't simply uninstall the package.
Is there any way I can run plain Mocha tests on a machine with Ava installed?
One of the files in test/ imports ava and the imported code will recognise that it's not being run with the correct tooling and throw an error.
Might be worth subdividing your test/ directory to keep tests associated with their respective runners.
test/
ava/
SomeAvaTests.js
mocha/
SomeMochaTests.js
This way you can safely run mocha test/mocha/ and vice versa without worrying about treading on each other's toes.
This is a rough one. Two fellow developers and I have been working for nearly 24 hours on this. I have a conf.js that I can navigate to in Terminal and then run protractor conf.js (using the globally installed copy) and it runs perfectly. One at a time, each green dot appears after each successful test, and it takes about 80 seconds. Here's where it gets tricky.
If I force the local installation of Protractor to run by executing (path of project)/node_modules/protractor/bin/protractor conf.js then it fires up, shows me several green dots all at once, then throws an error about not being able to hook into angular. This is causing trouble with integrating with our build, since grunt looks for and uses the local copy of Protractor.
To further complicate matters, one of the two other developers can pull down my repo and run the local protractor installation on my conf.js no problem. It works 100%.
Error while waiting for Protractor to sync with the page: "window.angular is
undefined. This could be either because this is a non-angular page or because your
test involves client-side navigation, which can interfere with Protractor's
bootstrapping. See http://git.io/v4gXM for details"
We've checked all of the following:
Both local and global installations of Protractor are the same version, installed with npm.
Richards-MacBook-Pro:protractor richardpressler$ npm ls protractor
wear-test-web-framework#0.0.1
/path_to_project/wear-test-track0
└── protractor#3.1.1
Richards-MacBook-Pro:protractor richardpressler$ npm ls -g protractor
/usr/local/lib
└── protractor#3.1.1
Selenium is up-to date. We have run both (path to project)/node_modules/protractor/bin/webdriver-manager update as well as webdriver-manager update to update both local and global selenium server installations
I've tried firing up Selenium separately and then pointing Protractor to it so that I can see the output and it looks great when I run the conf.js using the global protractor (protractor conf.js), showing several [Executing] statements each followed by a [Done] statement. However, when I run the local protractor binary with (path to project)/node_modules/protractor/bin/protractor conf.js, I see that Protractor was able to connect to the Selenium instance, but didn't do much afterword:
When the protractor output looks like this:
Richards-MacBook-Pro:protractor richardpressler$ ../../node_modules/protractor/bin/protractor conf.js
Using the selenium server at http://127.0.0.1:4444/wd/hub
[launcher] Running 1 instances of WebDriver
Started
.......................
The Selenium server only outputs this:
10:35:47.612 INFO - Selenium Server is up and running
10:35:49.479 INFO - Executing: [new session: Capabilities [{count=1, browserName=chrome}]])
10:35:49.487 INFO - Creating a new session for Capabilities [{count=1, browserName=chrome}]
Starting ChromeDriver 2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4) on port 34848
Only local connections are allowed.
10:35:50.516 INFO - Done: [new session: Capabilities [{count=1, browserName=chrome}]]
10:35:50.532 INFO - Executing: [set script timeout: 11000])
10:35:50.537 INFO - Done: [set script timeout: 11000]
Has anyone had similar misbehavior by Protractor when comparing the global, command-line version and the locally installed version in the project?
Thanks
Turns out all of the dependencies for protractor, grunt, selenium, etc. were in devDependencies so when I initially ran npm install it simply didn't install all of the sub-dependencies for those packages. If I move them into dependencies in the package.json, then re-run npm install, it works like a charm. Alternatively, running npm install --dev with those dependencies in devDependencies works fine too.
More info on the differences between dependencies, devDependencies, and peerDependencies can be found here: What's the difference between dependencies, devDependencies and peerDependencies in npm package.json file?
We are using frisby to run our integration tests and while developing them, it would be handy to execute one specific one or a group of tests, without having run all of them and see extra noise. Right now I am commenting out all the ones I don't want to run, which is getting tedious.
Is there a way, from the command line, to run specific frisby tests?
So basically, instead of
npm test
I want to be able to say
npm test --name: posts
Or something like that. I found this post about jasmine-only, but I'm not sure it will satisfy my needs.
Thanks so much!
I'm not sure if you're still looking for answer, but this is pretty simple.
Firstly install latest version of jasmine-node from command line: npm install jasmine-node -g
Then to run particular test use: jasmine-node --coffee putTestNameHere
Install jasmine-node module. Execute one file at a time - you can group your test cases in specific file:
jasmin-node moduleTestCases_spec.js
Also, if you want to specify exact test case name to be executed, you can make use of sequenty module. It is a nodejs module, which you can specify the order(and thus the exact test cases to execute).
To run specific test in Frishby just run:
npm test ./folder/filename.js
So lets assume you have an folder say test under that you have a file called api.spec.js
then you will execute like this:
npm test ./test/api.spec.js
Parallely don't forget to specify these below things into your package.json file
"scripts": {
"test": "mocha" }
I'm trying to create a custom build with core-js. Per the documentation, I first ran
npm i core-js && cd node_modules/core-js && npm i
which seemed to be fine. Then, also per the docs I tried
C:\GIT\coreJS_Custom\node_modules\core-js>npm run grunt build:es6.array.from -- --library=on --path=custom uglify
and lots of variations on that theme. It seems to run briefly, with no output at all, and I can't seem to find any generated file. What am I doing wrong?
Also, the above commands were run on the Windows 8.1 cmd terminal.
What's particularly interesting (and frustrating) is that running this
C:\GIT\coreJS_Custom\node_modules\core-js>npm run grunt kjhgjhghkghh
Similarly runs briefly and then seems to succeed.
I'm not sure what my root problem is, but for me, running the grant task on its own, without npm run did the trick
So something like this should be the final product.
C:\GIT\coreJS_Custom\node_modules\core-js>grunt build:es6.array.from --library=on --path="es6-array-from-build-min2" uglify