nadeesha / saul Goto Github PK
View Code? Open in Web Editor NEWExperimental annotation-based javascript unit tests :rocket:
Experimental annotation-based javascript unit tests :rocket:
Hey, this looks really good, trying to use it with an exisiting project which uses Jest but am unsure how to make that work, or if it does atm.
In a file in ./src
:
...
// @t "should add numbers" add(1, 2) equals 3
export const add = (a, b) => a + b
...
.saulrc
:
{
"fileGlob": "src/**/*.js"
}
scripts in package.json
:
...
"test": "NODE_ENV=test jest --config jest.config.json --verbose node_modules/.bin/saul",
...
outcome:
❯ npm t
> [email protected] test /Users/kav/Sites/playground/sauling
> NODE_ENV=test jest --config jest.config.json --verbose node_modules/.bin/saul
No tests found
In /Users/kav/Sites/playground/sauling
10 files checked.
testMatch: - 10 matches
testPathIgnorePatterns: /node_modules/ - 10 matches
testRegex: \.test\.js$ - 1 match
Pattern: "node_modules/.bin/saul" - 0 matches
so it seems the jest cli uses that last bit of the command to look for matching tests. Same thing happens if i take node_modules/.bin/saul
out of the npm script and run npm t node_modules/.bin/saul
. npm t | node_modules/.bin/saul
hail mary is all errors:
/Users/kav/Sites/playground/sauling/node_modules/saul/lib/testcase.js:6
var suite = exports.suite = describe;
^
ReferenceError: describe is not defined
Is anything in the Jest config that can be set up for it to work?
Thanks heaps!
Hi, I've been using saul
to test my code, it's really fantastic.
However when testing with asyn functions, I wrote an test engine like this:
const expect = require('chai').expect;
module.exports = (
testDescription,
func,
argsArray,
expected,
test
) => {
test(testDescription, () => {
func.apply(null, argsArray)
.then(actual => {
expect(actual).to.eql(eval(`var trouble = ${expected}; trouble`));
});
});
};
It suppose to act like deep-equals
with function returns promise, but it's not working and it did not throw any error.
Could you help me with this? Thanks :)
I've done as the readme says, but it does not test any file.
Results are like these:
[email protected] test /home/xinbg/Documents/pincloud.supe
nyc mocha src/**/*.test.js node_modules/.bin/saul
Warning: Could not find any test files matching pattern: src/**/*.test.js
0 passing (1ms)
----------|----------|----------|----------|----------|----------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Lines |
---|---|---|---|---|---|
All files | Unknown | Unknown | Unknown | Unknown | |
---------- | ---------- | ---------- | ---------- | ---------- | ---------------- |
Also wondering how to exclude node_modules folder?
Hi,
When I want to start and watch the application for contributing, I receive an error with the following message:
var suite = exports.suite = describe; // eslint-disable-line no-undef
ReferenceError: describe is not defined
Would you please help me in solving this problem in development mode?
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.