MartinStenzig / cds-bug-5

Mocha problem in 7.1.1

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mocha Test Problem

Test Replication

  1. Clone this repository
  2. Run npm install
  3. Run npm test

Expected Result: I would assume CDS would spin up a local server and run the tests against it. However, this is the output I receive

; npm test

> cds-bug-5@1.0.0 test
> mocha



  0 passing (0ms)

Solution

Do not use async and describe together. Changing the code to the following will work

const cds = require('@sap/cds/lib')
const path = require('path')
//const fs = require('fs')

const {expect,GET} = cds.test(path.join(__dirname, '/..')).verbose()

describe('Destination Service', function () {

    let status
    before(async function () {
          status  = (await GET `/catalog/Books`).status
    })
    
    it ('should return a list of destinations', async function () {
        
        expect (status) .to.be.equal (200)
    })

})

About

Mocha problem in 7.1.1


Languages

Language:JavaScript 63.0%Language:CAP CDS 37.0%