question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to use domainPath in unit tests

See original GitHub issue

Hi, I’m trying to write unit tests for commands. My directory structure is following:

`|-- src
 |   |-- domain
 |       `-- lib
 |           `-- item
 |               |-- aggregate.js 
 |               |-- command.js 
 |               `-- event.js
  `-- tests
       `-- test.js

The issue is that referencing the item folder from tests folder doesn’t work if in test.js i have: const domain = require('cqrs-domain')({ domainPath: path.join(__dirname, '../src/domain/lib') }); I have checked the examples in integrationTests but I don’t think I’m doing anything wrong. Thanks for any help

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
bikerpcommented, Feb 15, 2019

Ok, so when I require ‘cqrs-domain’ package directly from the tested folder and it works. Thanks

0reactions
nanovcommented, Feb 14, 2019

You did answer yourself, I guess you would have to introduce another folder layer in order for this to work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - How to get Directory while running unit test - Stack Overflow
You can do it like this: using System.IO; Path.GetFullPath(Path.
Read more >
Domain and Paths | Computer Science Engineering | DBS Talks
Domain and Paths ! The Domain Path module allows the creation of separate path aliases per domain for nodes created using the Domain...
Read more >
Unit test reports - GitLab Documentation
Use name and path to find and rerun the test locally for verification. To copy the name of all failed tests, at the...
Read more >
Unit Testing - Viash
This tutorial uses a sample component named md_url_checker to explain how to write a unit test for Viash. To follow along, start by...
Read more >
Build unit tests | Firebase Security Rules - Google
Use the Firebase Emulators to run and automate unit tests in a local environment. ... https://<database_name>.firebaseio.com/path/to/my/data.json.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found