tatyshev / given2 Goto Github PK
View Code? Open in Web Editor NEWLazy variable evaluation for Jasmine, Mocha, Jest specs, inspired by Ruby and Rspec 💎
License: MIT License
Lazy variable evaluation for Jasmine, Mocha, Jest specs, inspired by Ruby and Rspec 💎
License: MIT License
Branch | Build failing 🚨 |
---|---|
Dependency | webpack |
Current Version | 4.16.2 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
webpack is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
require.ensure
s.The new version differs by 5 commits.
482ff20
4.16.3
6c60e9d
Merge pull request #7798 from webpack/bugfix/empty-chunks-fail
aac4368
fix case where empty chunkgroups cause nested chunkgroups to vanish
a28f44f
Merge pull request #7770 from webpack/bump_jest
20dc30e
Update Jest
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
@tatyshev I've got some ideas for a version 3 of given2 that I think would help to improve the library.
I'd be interested in contributing this code if you're open to that, understandable if not. You've got a great library here so thank you for the work that's gone into it.
While given greatly simplifies our testing the inability to cleanup things initalized in the given functions means that we have to fall back to beforeEach
and afterEach
hooks, these interact in wierd ways with the up/down behavior of the given container.
Suggestion to maintain backwards compatibility:
given('fileName', () => `./${Math.random()}.json`);
given('valueInNeedOfCleaningUp', (e) => {
// Some side effect we don't want to leave in the system.
fs.writeFileSync(given.fileName JSON.stringify({ test: true }));
e.onCleanUp(() => {
fs.deleteFileSync(given.fileName);
})
return true;
});
The expectation would be that cleanup handlers would be run before removing any keys from the cache. Ideally the cleanup handlers could return promises that would be awaited before the next step. Failing that I think it would be reasonable to expect people writing cleanup handlers to capture given values in scope changing the above to:
given('fileName', () => `./${Math.random()}.json`);
given('valueInNeedOfCleaningUp', (e) => {
// capture to use in cleanup
const fileName = given.fileName;
// Some side effect we don't want to leave in the system.
fs.writeFileSync(fileName JSON.stringify({ test: true }));
e.onCleanUp(() => {
// assume this isn't waited for.
fs.deleteFile(fileName, () => { /* no-op */ });
});
return true;
});
If I were to do something like this: given('resource', async () => createResource({...}))
is there any way for given to await the result and then allow access via resource.name
?
Currently, I do something like this:
given('resource', async () => createResource({...}))
it('returns the link properly', async () => {
const resource = await given.resource;
expect.assertions(2);
const { req, res } = await testGraphQL(url,query);
expect(req.status).toStrictEqual(200);
expect(res.data.get).toBe(resource.name)
});
Not sure if is possible but it would be nice to have given automatically await somehow
Branch | Build failing 🚨 |
---|---|
Dependency | webpack |
Current Version | 3.10.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
webpack is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 62 commits.
f010546
update examples
bc840ec
3.11.0
9323ee6
Merge pull request #6398 from addaleax/no-binding
c7cbc35
Merge pull request #6430 from jbottigliero/update/ajv
61b75b7
update ajv + ajv-keywords
8da8b93
Work around Node environment variable bug
ddb1fad
Merge pull request #6408 from ocombe/fix/#6407-empty-array
2aebfbe
fix(ConcatenatedModule): don't throw on arrays with empty values
3972d9a
Merge pull request #6391 from nerdkid93/patch-1
e4375f8
Avoid relying on Node’s internals
0dd1727
change polymer loader link
33f518b
Merge pull request #6300 from nename0/fix-6243
80ed1c4
Merge pull request #6335 from Connormiha/banner-plugin-optimize
5d93c53
Minor optimize banner plugin
1895b76
Add Tests checking chunkhash of runtime chunk only changes if needed
There are 62 commits in total.
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
Hi!
First of all, thanks for this wonderful library! We've gotten a ton of milage out of it at https://eagronom.com as it allows us to write yarn tests in a really similar way to how we structure our rspec tests. We experimented with a couple of other tools that promised the same result, but they all fell short.
One problem we've run into is with how the library interacts with beforeEach
. In tests where we set up mock return values or set up document.body.innerHTML, the following option does not work:
const someMock = jest.fn()
describe('somefunction()', () => {
beforeEach(() => {
someMock.mockReturnValue(given.returnValue)
})
given('returnValue', () => 1)
it('returns given result', () => {
expect(someMock()).toEqual(1)
})
})
This fails:
somefunction()
✕ returns given result (8ms)
● somefunction() › returns given result
expect(received).toEqual(expected)
Expected value to equal:
1
Received:
undefined
It seems as if the beforeEach is run before given2 lazy values are set up, causing errors. I assue it's because how given2 uses beforeEach under the hood as well.
The workaround is to do this instead:
given('!mymock', () => someMock.mockReturnValue(1))
However this solution, it gets really cumbersome in larger tests.
Is there a better way to being able to use given2 and beforeEach together?
Branch | Build failing 🚨 |
---|---|
Dependency | jasmine |
Current Version | 3.1.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
jasmine is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
Please see the release notes
The new version differs by 15 commits.
3ed35d3
bump version to 3.2.0
a1c3369
Merge pull request #139 from fossabot/master
cf155f7
Add license scan report and status
18e0459
Merge branch 'elliot-nelson-enelson/unknownOptionsExitCode'
71df19f
Unknown command line options produce exit code 1
869ad0c
Add option "require(s)" to command line and config file
1f60cbc
Merge branch 'susisu-add-force-color-option'
51624e3
Change option name --force-color to --color
2fade44
Add description for --force-color option
3ed7ea5
Add --force-color option
0f20d7e
Merge branch 'cancerberoSgx-master'
a906d34
fix --filter in README
8177c58
fix unwanted change
7f89fd7
3.1.0
a472a0d
filtering note in readme
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
Branch | Build failing 🚨 |
---|---|
Dependency | eslint-plugin-import |
Current Version | 2.8.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
eslint-plugin-import is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 101 commits.
180d71a
bump plugin to v2.9.0
0231c78
Merge pull request #1026 from isiahmeadows/patch-1
ae5a031
Missed a link
5b0777d
Add no-default-export
+ docs/tests (#936)
ff3d883
Merge pull request #1025 from patrick-steele-idem/update-dependencies
654d284
Merge pull request #1024 from patrick-steele-idem/issue-1023
9b20a78
Upgraded "find-root" and "lodash.get" for the webpack resolver
8778d7c
Fixes #1023 - Load exceptions in user resolvers are not reported
91cfd6d
Merge pull request #1022 from nevir/patch-1
0e729c7
no-self-import is unreleased
219a8d2
Merge pull request #1012 from silvenon/extensions-export
ab49972
Support export declarations in extensions rule
3268a82
Merge pull request #1010 from silvenon/extensions
fdcd4d9
Add a .coffee test proving extension resolve order
bc50394
Merge pull request #1009 from silvenon/extensions
There are 101 commits in total.
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
Branch | Build failing 🚨 |
---|---|
Dependency | mocha |
Current Version | 5.0.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
mocha is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 15 commits.
09ce746
Release v5.0.1
70027b6
update changelog for v5.0.1 [ci skip]
44aae9f
add working wallaby config
412cf27
[Update] license year
b7377b3
rename help-wanted to "help wanted" in stale.yml
d975a6a
fix memory leak when run in v8; closes #3119
3509029
update .gitignore to only ignore root mocha.js [ci skip]
b57f623
fix: When using --delay, .only() no longer works. Issue #1838
cd74322
Slight copy update on docs for test directory
f687d2b
update docs for the glob
14fc030
Add all supported wallaby editors
2e7e4c0
rename "common-mistake" label to "faq"
bca57f4
clarify docs on html, xunit and 3p reporters; closes #1906
2fe2d01
Revert "fix travis "before script" script"
c0ac1b9
fix travis "before script" script
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:
.travis.yml
If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.
Greenkeeper has checked the engines
key in any package.json
file, the .nvmrc
file, and the .travis.yml
file, if present.
engines
was only updated if it defined a single version, not a range..nvmrc
was updated to Node.js 10.travis.yml
was only changed if there was a root-level node_js
that didn’t already include Node.js 10, such as node
or lts/*
. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.For many simpler .travis.yml
configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
4.35.3
to 4.36.0
.This version is covered by your current version range and after updating it in your project the build failed.
webpack is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
append
option now supports the default placeholders in addition to [url]
"..."
when overriding options.The new version differs by 42 commits.
95d21bb
4.36.0
aa1216c
Merge pull request #9422 from webpack/feature/dot-dot-dot-merge
b3ec775
improve merging of resolve and parsing options
53a5ae2
Merge pull request #9419 from vankop/remove-valid-jsdoc-rule
ab75240
Merge pull request #9413 from webpack/dependabot/npm_and_yarn/ajv-6.10.2
0bdabf4
Merge pull request #9418 from webpack/dependabot/npm_and_yarn/eslint-plugin-jsdoc-15.5.2
f207cdc
remove valid jsdoc rule in favour of eslint-plugin-jsdoc
31333a6
chore(deps-dev): bump eslint-plugin-jsdoc from 15.3.9 to 15.5.2
036adf0
Merge pull request #9417 from webpack/dependabot/npm_and_yarn/eslint-plugin-jest-22.8.0
37d4480
Merge pull request #9411 from webpack/dependabot/npm_and_yarn/simple-git-1.121.0
ce2a183
chore(deps-dev): bump eslint-plugin-jest from 22.7.2 to 22.8.0
0beeb7e
Merge pull request #9391 from vankop/create-hash-typescript
bf1a24a
#9391 resolve super call discussion
bd7d95b
#9391 resolve discussions, AbstractMethodError
4190638
chore(deps): bump ajv from 6.10.1 to 6.10.2
There are 42 commits in total.
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.