enova / givens Goto Github PK
View Code? Open in Web Editor NEWEasy test setup without side effects.
License: MIT License
Easy test setup without side effects.
License: MIT License
The workflow CI.yml is referencing action actions/checkout using references v1. However this reference is missing the commit a6747255bd19d7a757dbdda8c654a9f84db19839 which may contain fix to the some vulnerability.
The vulnerability fix that is missing by actions version could be related to:
(1) CVE fix
(2) upgrade of vulnerable dependency
(3) fix to secret leak and others.
Please consider to update the reference to the action.
Make the image in the readme point to a full url instead of a relative url
This library is analogous to let
in rspec, but there isn't an equivalent for let!
. We are using it for cypress tests and we almost always want to eagerly evaluate our given
variables (because they correspond to API calls we want to resolve before the test starts), so it would be really nice if there was a shorthand for this eager evaluation. Currently our tests looks something like
given('a', () => createSomething());
given('b', () => createSomethingElse());
beforeEach(() => {
given.a;
given.b;
});
it('works', () => { /* */ });
But if this library supported that behavior we could remove the beforeEach
. There are a few APIs I have thought might work but I'm open to other suggestions:
// lots of different naming options here - now / eager / bang / other ideas?
given.now('a', () => createSomething());
// this one is a bit more complex to implement but I think it can be made to work with template literal types
// https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html
given('!a', () => => createSomething());
// or to make it look less like a boolean operator
given('a!', () => => createSomething());
I think this is relatively easy to implement by adding a __lazy__
property to the given
object (pretty much identical to the __props__
property), and pushing in true
or false
based on how this function is called. Then you can add a beforeEach
that checks the top of the list to decide if it should access given[key]
. I'm happy to submit a PR if we can agree on an API.
report coverage to codecov for both unit and jest integration tests
This was not already done because jest does not play nice with nyc or with covering node_modules
Using vanilla Node withour preprocessors, importing givens
returns an object with property default
, but type says it's a function:
https://stackblitz.com/edit/node-j89pac?file=index.js
// run `node index.js` in the terminal
import givens from 'givens'
console.log(givens) // { default: fn } instead of givens
This is because you transpile it to exports.default = fn
instead of module.exports = fn
, I think
Related: vitest-dev/vitest#352
Add npm run lint to the CI workflow
makefile does a lot of duplicate building, making the install step take a very long time.
part of this fix potentially requires a newer version of make to be installed on the actions ci server.
The following currently gives typescript compile errors
given("var", async () => {
const var = await doWorkToGetVar();
return var;
});
Error:
Argument of type '() => Promise<string>' is not assignable to parameter of type '() => string'
Is it possible for givens to asynchronously instantiate the lazy declarations?
Hello, I'm working on an angular project that is using jasmine through karma,
when i try to use givens i get the error in the title.
by changing the regex that are used to evaluate the context to: /(jasmine\\.js|jasmine\/lib\/loader\.js)/
and /Env\.describe|Env\/this.describe/
respectively the test seems to work.
getContextInfo@http://localhost:9876/_karma_webpack_/vendor.js:137425:21
given@http://localhost:9876/_karma_webpack_/vendor.js:137493:46
88403/</<@http://localhost:9876/_karma_webpack_/main.js:8172:14
32600/</ZoneDelegate.prototype.invoke@http://localhost:9876/_karma_webpack_/polyfills.js:414:30
32600/</Zone.prototype.run@http://localhost:9876/_karma_webpack_/polyfills.js:174:47
wrapDescribeInZone/<@http://localhost:9876/_karma_webpack_/vendor.js:169990:33
addSpecsToSuite@http://localhost:9876/absolute/Users/vjustov/some-project/node_modules/karma-jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?b9e399d056ab3608dfb7a9a60a397876081d58cd:1991:25
Env/this.describe@http://localhost:9876/absolute/Users/vjustov/some-project/node_modules/karma-jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?b9e399d056ab3608dfb7a9a60a397876081d58cd:1956:22
58991/</</</jasmineEnv[methodName]@http://localhost:9876/_karma_webpack_/vendor.js:169895:42
describe@http://localhost:9876/absolute/Users/vjustov/some-project/node_modules/karma-jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?b9e399d056ab3608dfb7a9a60a397876081d58cd:7727:18
88403/<@http://localhost:9876/_karma_webpack_/main.js:8170:13
32600/</ZoneDelegate.prototype.invoke@http://localhost:9876/_karma_webpack_/polyfills.js:414:30
32600/</Zone.prototype.run@http://localhost:9876/_karma_webpack_/polyfills.js:174:47
wrapDescribeInZone/<@http://localhost:9876/_karma_webpack_/vendor.js:169990:33
addSpecsToSuite@http://localhost:9876/absolute/Users/vjustov/some-project/node_modules/karma-jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?b9e399d056ab3608dfb7a9a60a397876081d58cd:1991:25
Env/this.fdescribe@http://localhost:9876/absolute/Users/vjustov/some-project/node_modules/karma-jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?b9e399d056ab3608dfb7a9a60a397876081d58cd:1979:22
58991/</</</jasmineEnv[methodName]@http://localhost:9876/_karma_webpack_/vendor.js:169895:42
fdescribe@http://localhost:9876/absolute/Users/vjustov/some-project/node_modules/karma-jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?b9e399d056ab3608dfb7a9a60a397876081d58cd:7758:18
88403@http://localhost:9876/_karma_webpack_/main.js:8169:10
__webpack_require__@http://localhost:9876/_karma_webpack_/main.js:16424:42
webpackContext@http://localhost:9876/_karma_webpack_/main.js:16363:9
74097@http://localhost:9876/_karma_webpack_/main.js:10434:16
__webpack_require__@http://localhost:9876/_karma_webpack_/main.js:16424:42
__webpack_exports__<@http://localhost:9876/_karma_webpack_/main.js:16745:102
__webpack_require__.O@http://localhost:9876/_karma_webpack_/main.js:16463:23
@http://localhost:9876/_karma_webpack_/main.js:16746:53
@http://localhost:9876/_karma_webpack_/main.js:16748:12
I am trying to provide a greenfield sandbox to replicate the bug, but so far haven't been able
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.