Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Feb 22 16:20
    depfu[bot] labeled #794
  • Feb 22 16:20
    depfu[bot] opened #794
  • Feb 22 15:15

    depfu[bot] on update

    Update eslint-config-prettier t… (compare)

  • Feb 16 01:30
    depfu[bot] labeled #793
  • Feb 16 01:30
    depfu[bot] opened #793
  • Feb 16 00:25

    depfu[bot] on update

    Update eslint-plugin-markdown t… (compare)

  • Feb 13 20:50

    depfu[bot] on update

    (compare)

  • Feb 13 20:50
    depfu[bot] closed #791
  • Feb 13 20:50
    depfu[bot] commented #791
  • Feb 13 20:50
    depfu[bot] labeled #792
  • Feb 13 20:50
    depfu[bot] opened #792
  • Feb 13 19:45

    depfu[bot] on update

    Update karma to version 6.1.1 (compare)

  • Feb 04 03:50

    depfu[bot] on update

    (compare)

  • Feb 04 03:50
    depfu[bot] closed #790
  • Feb 04 03:50
    depfu[bot] commented #790
  • Feb 04 03:50
    depfu[bot] labeled #791
  • Feb 04 03:50
    depfu[bot] opened #791
  • Feb 04 02:46

    depfu[bot] on update

    Update karma to version 6.1.0 (compare)

  • Feb 03 00:35

    depfu[bot] on update

    (compare)

  • Feb 03 00:35
    depfu[bot] closed #789
Alex J Burke
@alexjeffburke
re unexpectedjs/unexpected#781 - that handles one case, but just noting that we still have the issue the other way round. Namely, if you refactored some code and changed the subject from an {} to a new Map(), you will have weird results because the properties attached to the Map object will be checked rather than the .set() mappings it contains
perhaps that's a vote for having Map in core so that just can't happen - to answer your Q @papandreou, I think the plugin is actually in a good state as it stands - I did a pretty extensive rework leading up to v2 that ported all the v11 "to satisfy" behaviours
Andreas Lind
@papandreou
Then now might be the time to onboard it :)
Sune Simonsen
@sunesimonsen
🤠
Andreas Lind
@papandreou
@alexjeffburke, yeah, you’re right about that. Whether or not we pull in u-set or u-map it might make sense to similarly assert that the subject isn’t a Map/Set/WeakMap/WeakSet instance — as it’s very unlikely to assert what you want.
Alex J Burke
@alexjeffburke
@papandreou was thinking along similar lines
Andreas Lind
@papandreou
We can fold that into the PR, should probably also be semver-major
Andreas Lind
@papandreou
Done
Andreas Lind
@papandreou
I've played around with camelCase assertion syntax in core: unexpectedjs/unexpected#784
It's a super inefficient implementation for now, but LMK if there's appetite for getting something like this in, or if you have feedback about the syntax or feature set.
I hope we'd be able to use the type generation part of unassessed on top :)
Sune Simonsen
@sunesimonsen
Marry Christmas ❤️🎄
Andreas Lind
@papandreou
Merry Christmas! 🤗
Gert Sønderby
@gertsonderby
Glædelig Jul.
Sune Simonsen
@sunesimonsen
Happy New Year 💥💫🔥
Andreas Lind
@papandreou
Happy New Year! :tada: :wine_glass:
Alex J Burke
@alexjeffburke
Same wish from me, have a nice start everyone :)
Peter Müller
@Munter
Happy new year! Here's to 2021 being better than 2020
Gustav Nikolaj
@gustavnikolaj
Happy new year everyone :) And welcome back to the home office
Andreas Lind
@papandreou
Here we are again :weary: :smile_cat:
Sune Simonsen
@sunesimonsen
Funny right from the morning @gustavnikolaj 😅
@papandreou sorry for not looking at your camel case spike yet, I'm in Svendborg until Wednesday, but I'll take a look when I have some time.
Andreas Lind
@papandreou
No rush at all! There's still plenty of stuff to fix on it. It would be nice to get some feedback on the api when you have time, you can just ignore everything except the new test: https://github.com/unexpectedjs/unexpected/pull/784/files#diff-d03ea72142f3971d3a3e4ff1b79deedba7269b7530be66d24150ab4f20520473R1
Sune Simonsen
@sunesimonsen
Will do.
Andreas Lind
@papandreou
Thanks
Gustav Nikolaj
@gustavnikolaj
By default mocha looks for test files in ./test/*.js, and with the --recursive option it will use the equivalent of ./test/**/*.js. I'd like to change that to **/test/*.js and ideally through configuration. I cannot find anything about it in the docs nor on the website. Do you have any clue about how to do that?
Gustav Nikolaj
@gustavnikolaj
Figured it out. You can use a spec-key in your config object and make it a list of globs. :)
Andreas Lind
@papandreou
:heavy_check_mark:
Peter Müller
@Munter
There's a lot of docs that need to be updated to the more modern takes that mocha has now
Config files in jason/yaml, async functions for tests instead of done callbacks etc
Gustav Nikolaj
@gustavnikolaj
I need to build a static site, but one with translated content --- and urls. Are you aware of any tools handling things like that?
Peter Müller
@Munter
How is this test passing? What am I missing?
import unexpected from 'unexpected';
import unexpectedExpress from 'unexpected-express';
import express from 'express';

import { partnerAdsTrackingMiddleware } from './partnerAdsTrackingMiddleware';

const expect = unexpected.clone().use(unexpectedExpress);

const app = express()
  .use(partnerAdsTrackingMiddleware())
  .use((req, res) => res.send('OK'));

describe('partnerAdsTrackingMiddleware', () => {
  it('should not set a cookie when no partner information is present', () => {
    expect(app, 'to yield exchange', {
      request: 'GET /?paid=foo&pacid=bar',
      response: {
        statusCode: 999,
      },
    });
  });
});
async. jesus. I'm getting rusty
Andreas Lind
@papandreou
Is it not triggering the footgun protection?
Peter Müller
@Munter
No
Have any of you tested the setting of cookie headers? I think I need a custom assertion with https://www.npmjs.com/package/set-cookie-parser or something
Andreas Lind
@papandreou
You mean Cookie the request header or Set-Cookie the response header? I've always just put those in by hand.
Peter Müller
@Munter
Set-Cookie. I'd like to assert on the content and metadata of it
Andreas Lind
@papandreou
It's still fairly simple strings, so I probably wouldn't go overboard in custom assertions.
Peter Müller
@Munter
How does the response object from unexpected-express deal with multiple Set-Cookie headers?
Andreas Lind
@papandreou
It populates a messy.Headers instance with them which supports repeated headers
Peter Müller
@Munter
Do I get an array out then?
Andreas Lind
@papandreou
getAll returns an array:
const messy = require('messy');
new messy.Headers('Set-Cookie: foo=bar\nSet-Cookie: baz=quux').getAll('Set-Cookie'); // [ 'foo=bar', 'baz=quux' ]
So something like: const context = await expect(app, 'to yield exchange', ...) and then context.httpResponse.headers.getAll('Set-Cookie')
Peter Müller
@Munter

I was thinking something like

    await expect(app, 'to yield exchange', {
      request: 'GET /?paid=foo&pacid=bar',
      response: expect.it(
        'when passed as parameter to',
        require('set-cookie-parser').parse,
        'to satisfy',
        [{ ... }]
      ),
    });

But I think I am holding it wrong

Error: unexpected-express: Response object specification incomplete.
Andreas Lind
@papandreou
Hmm, yeah, I don't think expect.it is supported in that position
Peter Müller
@Munter
Ended up with ensuring that there are not multiple Set-Cookie headers and passing parameters to functions:
  it('should filter unknown values out of cookie value', async () => {
    await expect(app, 'to yield exchange', {
      request: 'GET /?paid=foo&pacid=bar&unknown=1234',
      response: {
        headers: {
          'Set-Cookie': expect.it(
            'when passed as parameter to',
            parse,
            'to satisfy',
            [
              {
                name: 'partner-ads',
                value: expect.it(
                  'when passed as parameter to',
                  JSON.parse,
                  'to satisfy',
                  { paid: 'foo', pacid: 'bar' }
                ),
                maxAge: 3456000,
                path: '/',
                sameSite: 'Lax',
              },
            ]
          ),
        },
      },
    });
  });
Gustav Nikolaj
@gustavnikolaj
What's everyone's take on esbuild? https://esbuild.github.io/
Sune Simonsen
@sunesimonsen
That we should remove the need for building things while developing ;-) and the production build will be faster :joy: