Code Monkey home page Code Monkey logo

Comments (1)

knowlsie avatar knowlsie commented on June 12, 2024

I'm not at a point where I fully understand this bug yet.

Within my unit tests, here's what happens.

it('should return correct response', function (done) {
  [...]
  lambdaLocal.execute({
    event: request,
    lambdaPath: './lambda/index.js',
    profileName: 'default',
    timeoutMs: 3000,
    mute: true,
    callback(err, data) {
      if (err) {
        throw err;
      } else {
        expect(data).eql(response);
        done();
      }
    },
  });
});

lambda-local basically executes the lambda function as it usually would, then calls callback(err, data) (using the same data used for context.done()). This makes it run my checks, which work if the response is correct. The issue is when the response isn't correct. Then it just times out rather than showing how the response and the data were different.

The issue seems to be that the assert clause is throwing the error in a block of the lambda-local code (where it calls callback) rather than within the Mocha file. This means it never hits done, so times out. This still gives an error, so it tells you when stuff is broken, but really not very clearly.

What I don't understand is why this callback method works for 25/28 tests, but doesn't work for the remaining 3 tests that use the requesters. The main difference is the time taken to do the request, so it feels like it might be something to do with asynchronicity, but I can't figure it out yet. My plan is to implement the future changes to the SDK, see if that fixes it, then go from there.

from alexa-room-finder.

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.