We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If you filter an object, and try to strictEqual it with a POJO with the filtered fields, the assertion fails.
strictEqual
import {expect} from '@playwright/test' import stdlib from '@logdna/stdlib' const o = { field: 'val' , field2: 'val2' } const e = {field: 'val'} const f = stdlib.object.filter(o, (k) => k !== 'field2') console.log(e) console.log(f) expect(e).toStrictEqual(f)
I'm not sure where playwright gets it's expect library from, and couldn't find out with a few minutes of searching.
expect
> node fail.js { field: 'val' } [Object: null prototype] { field: 'val' } /Users/jmoses/dev/logdna/qa-e2e-pipeline/node_modules/@playwright/test/lib/matchers/expect.js:131 if (!testInfo) return matcher.call(target, ...args); ^ Ze [Error]: expect(received).toStrictEqual(expected) // deep equality Expected: {"field": "val"} Received: serializes to the same string at Proxy.<anonymous> (/Users/jmoses/dev/logdna/qa-e2e-pipeline/node_modules/@playwright/test/lib/matchers/expect.js:131:37) at file:///Users/jmoses/dev/logdna/qa-e2e-pipeline/fail.js:15:11 at ModuleJob.run (node:internal/modules/esm/module_job:198:25) at async Promise.all (index 0) at ESMLoader.import (node:internal/modules/esm/loader:385:24) at loadESM (node:internal/process/esm_loader:88:5) at handleMainPromise (node:internal/modules/run_main:61:12) { matcherResult: { actual: { field: 'val' }, expected: [Object: null prototype] { field: 'val' }, message: '\x1B[2mexpect(\x1B[22m\x1B[31mreceived\x1B[39m\x1B[2m).\x1B[22mtoStrictEqual\x1B[2m(\x1B[22m\x1B[32mexpected\x1B[39m\x1B[2m) // deep equality\x1B[22m\n' + '\n' + 'Expected: \x1B[32m{"field": "val"}\x1B[39m\n' + 'Received: serializes to the same string', name: 'toStrictEqual', pass: false } }
> npm list | grep -E 'playwright/test|logdna/stdlib' ├── @logdna/[email protected] ├── @playwright/[email protected]
The text was updated successfully, but these errors were encountered:
import {expect} from '@playwright/test' import {omit} from 'lodash-es' const o = { field: 'val' , field2: 'val2' } const e = {field: 'val'} const f = omit(o, ['field2']) console.log(e) console.log(f) expect(e).toStrictEqual(f)
does work as expected
Sorry, something went wrong.
No branches or pull requests
If you filter an object, and try to
strictEqual
it with a POJO with the filtered fields, the assertion fails.I'm not sure where playwright gets it's
expect
library from, and couldn't find out with a few minutes of searching.The text was updated successfully, but these errors were encountered: