Giter Site home page Giter Site logo

Comments (8)

nicck avatar nicck commented on August 30, 2024

Actually when I save file something interesting appears in output:

Running Mocha with Node.js at /usr/local/bin/node

Applying Mocha options:
  {
    "recursive": true
  }

Test file(s):


  0 passing (0ms)

###end
------------------------------------
finish failuare amount:0
------------------------------------

Usually I run my tests via yarn test or npm test which invoke following command: mocha -r dotenv/config --recursive ./test dotenv_config_path=.env.test. I've added some options to workspace settings:

    "mocha.options": {
        "recursive": true
    },
    "mocha.requires": ["dotenv/config"]

not sure how can I pass dotenv_config_path=.env.test to mocha.

from mocha-sidebar.

maty21 avatar maty21 commented on August 30, 2024

Do you have some sample code that I can test and debug it for you tks

from mocha-sidebar.

maty21 avatar maty21 commented on August 30, 2024

@nicck does your tests running from mocha command line?

from mocha-sidebar.

nicck avatar nicck commented on August 30, 2024

I've created a small repo to show the problem: https://github.com/nicck/mocha-sidebar-test-app

~/Code/testapp master
❯ yarn     
yarn install v0.27.5
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 0.83s.
                                                                                                                        
~/Code/testapp master
❯ yarn test
yarn test v0.27.5
$ mocha -r dotenv/config --recursive ./test dotenv_config_path=.env.test
Warning: Could not find any test files matching pattern: dotenv_config_path=.env.test


  env
    ✓ works

  doit
    ✓ works
    1) does not work


  2 passing (12ms)
  1 failing

  1) doit does not work:

      Error: Expected 123 to equal 321
      + expected - actual

      -123
      +321
      
      at assert (node_modules/expect/lib/assert.js:29:9)
      at Expectation.toEqual (node_modules/expect/lib/Expectation.js:81:30)
      at Context.it (test/app/doit.test.js:18:29)



error Command failed with exit code 1.

it works from command line as expected.

from mocha-sidebar.

nicck avatar nicck commented on August 30, 2024

@maty21 please let me know if I can help with reproducing this issue or you need any more details.

from mocha-sidebar.

maty21 avatar maty21 commented on August 30, 2024

Tks man I will debug it in the weekend :)

from mocha-sidebar.

yehiyam avatar yehiyam commented on August 30, 2024

@nicck We need to figure out how to support dotenv, but as a workaround you could add the env from the file to mocha.env settings.
I was able to get your tests to run with these settings:

{
    "mocha.requires": [
        "dotenv/config"
    ],
    "mocha.options": {
        "recursive":true
    },
    "mocha.env": {
        "NODE_ENV":"test",
        "OAUTH_CLIENT_ID":987
    }
}

from mocha-sidebar.

maty21 avatar maty21 commented on August 30, 2024

fixed in version 0.14.30

from mocha-sidebar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.