Questions tagged [lab]

Lab is a simple test utility for node.

Unlike other test utilities, lab uses domains instead of uncaught exception and other global manipulation. Our goal with lab is to keep the execution engine as simple as possible, and not try to build an extensible framework. lab works with any assertion library that throws an error when a condition isn't met.

Links:

92 questions
32
votes
9 answers

Can't resolve '@material-ui/lab/Slider' in {path}

I imported the Slider: import Slider from '@material-ui/lab/Slider'; and have returned in the render. The code is not getting compiled and is throwing an error: Module not found: Error: Can't resolve '@material-ui/lab/Slider' in {path}. Could…
technoite
  • 323
  • 1
  • 3
  • 4
11
votes
4 answers

How do I override config values at runtime with node-config?

I'd like to override some values at test-time, specifically setting my retries for an http service to 1 (immediate failure, no retries). Our project uses node-config. According to the docs I can override with NODE_CONFIG env variable: node myapp.js…
jcollum
  • 43,623
  • 55
  • 191
  • 321
7
votes
1 answer

Comparison between `lab` and `code` vs `mocha` and `chai` nodejs libraries

I am new to node.js and I have decided that I will be using hapijs for my web and API implementations. However, I have found that the hapi community built and use lab and code for the test and assertion libraries, which are a rewrite of mocha and…
agarcian
  • 3,909
  • 3
  • 33
  • 55
7
votes
2 answers

Hapi Lab why Test failed when all the tests are passed

Does anyone know the meaning of ? npm ERR! Test failed. See above for more details. 3 tests complete Test duration: 873 ms The following leaks were detected:lr npm ERR! Test failed. See above for more details. I run my 3 tests I get a…
Whisher
  • 31,320
  • 32
  • 120
  • 201
6
votes
1 answer

Unit testing Mongoose models in separate files causes issues (using Mockgoose & Lab)

Whenever a Mongoose model is attempted to load after it's already loaded, an error is thrown, such as: error: uncaughtException: Cannot overwrite Account model once compiled. date=Fri Feb 26 2016 10:13:40 GMT-0700 (MST), pid=19231, uid=502, gid=20,…
Justin
  • 1,959
  • 5
  • 22
  • 40
3
votes
0 answers

export Lab nodejs

I have a problem, I try using exports.something or global.something with the library Lab, but I have the following problem. includes a lab script that is not exported via exports.lab% I can only use it with the export in each file ? My file of…
3
votes
1 answer

How to get HSV and LAB color space?

I'm using OpenCV with Python. My code is: img_hsv = cv2.cvtColor(image,cv.CV_BGR2HSV) img_lab = cv2.cvtColor(image,cv.CV_BGR2Lab) When I access to a pixel value I'm getting values in RGB space, for example: img_hsv[x][y] = [255,255,255] How can I…
Jota
  • 697
  • 10
  • 24
2
votes
1 answer

Add the same value labels to multiple dataframe columns using expss::val_lab

I'm trying to add the same value labels to multiple columns in a dataframe using the expss::val_lab function, but any labelling function in expss well work for me. #Example data ex1 <- c(1,1,2,2,3,3,4,4,5,5) ex2 <- c(5,4,3,2,1,1,2,3,4,5) ex6 <-…
Mike
  • 23
  • 4
2
votes
1 answer

hapi lab AssertionError [ERR_ASSERTION]: Plugin crumb already registered

i'm not sure why i am receiving this. I am trying to create a simple test while using @hapi/crumb. i am only registering it once in my server.js. const Path = require("path"); const hapi = require("hapi"); const inert = require("inert"); const…
shorif2000
  • 2,582
  • 12
  • 65
  • 137
2
votes
1 answer

ValidationError: child "password" fails because ["password" is required]

ValidationError: child "password" fails because ["password" is required] error is showing when run the test I am using hapijs v17.2.3 and mongodb as back-end. I am trying to perform unit testing using the lab and code . This is my tests.js 'use…
jeslin
  • 21
  • 5
2
votes
1 answer

What is the best approach to test a HapiJS plugin, with Lab?

What is the best way to test a HapiJS plugin, for example one plugin that add routes and handlers. Since I have to create an instance of Hapi.Server to run the plugins, should I define all the tests from the app's root, for all the plugins ? or…
acmoune
  • 2,981
  • 3
  • 24
  • 41
2
votes
2 answers

How to use Sinon to stub out knex calls in Hapi/Lab test?

I'm trying to set up a testing pattern for a new Hapi app. I've used Mocha and Chai in the past with Express, but I'm trying to use Lab and Code to stay in the Hapi ecosystem. I'm also using Bookshelf and Knex to handle database interaction. So I…
rschlachter
  • 720
  • 1
  • 9
  • 20
2
votes
1 answer

How do I get Istanbul to report coverage for Lab/Hapi.js tests?

edit: a few months later I migrated over to Lab completely, it works great, including coverage. Maybe at the time I wrote this Lab didn't have a good coverage tool. I've gotten this working before. Was working this morning. Suddenly, it's not.…
jcollum
  • 43,623
  • 55
  • 191
  • 321
2
votes
1 answer

How to debug on console with Hapi.js Lab test framework?

Mocha has the option to run tests with mocha debug, just like node debug, allowing debug within a REPL console. How can I do REPL debug with Hapi Lab?
paulodiovani
  • 1,208
  • 2
  • 16
  • 34
2
votes
0 answers

Lab reports < 100% coverage depsite covering all paths

I have a test that checks if a server's been configured correctly. The code for both the server and test are in the gist. However, running lab --environment TEST --verbose --coverage --reporter console --output stdout --reporter html --output…
jackyalcine
  • 469
  • 1
  • 8
  • 21
1
2 3 4 5 6 7