julien-pires / kocoa Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Summary:
Currently, only one decorator is available to provide inline data. It could be good to be able to use a class member as a data provider (like xUnit/nUnit).
How:
We could add a new decorator that will allow to specify a class member. This class member must be iterable (Array or iterator).
@category('Array')
export class IndexOfTests {
public * indexOfDataMethodMember() {
yield [['A'], 'A'];
yield [['A', 'B', 'C'], 'A'];
}
public get indexOfDataGetterMember() {
return [
[['A'], 'A'],
[['A', 'B', 'C'], 'A']
]
}
@test
@memberData('indexOfDataMethodMember')
@memberData('indexOfDataGetterMember')
public 'should return index when element is found'(array: string[], element: string) {
expect(array.indexOf(element)).to.equal(0);
}
}
Summary:
The purpose of this adapter is to run tests using Node test framework (> 18.0.0).
Summary:
Readme.md must be updated with a short description of the library and basics examples.
Summary:
Add some documentations to explain how to use the library.
Summary:
The purpose of this adapter is to run tests under Jasmine environnement.
Summary
Remove node 12 support on all projects. We can update tsconfig.json to latest lib version.
Summary:
The purpose of this adapter is to run tests under Jest environnement.
Summary:
Set in all package.json files the minimum Node engine version required.
Summary:
Add CI pipeline to build the package and run tests.
Summary
Add node 18 support on all projects of the repo.
Summary:
Add missing unit tests on the project.
Summary:
Add semantic release to simplify package and changelog update.
Summary:
We must be able to run a set of tests for each test framework adapter supported by Kocoa. We don't want to write the same tests again and again. So, it should be done in an easy, reusable and configurable way.
Add ability to clean fixtures for a single test
When running tests, we can create fixtures within the class constructor. Some fixtures require to be cleaned/resetted when the test is over. We can implement this through the IDisposable interface (like .NET) and ensure that it's called by the adapter.
@suite
class MyTestSuite implements IDisposable {
constructor() {
this.sqlConnection.open();
}
public dispose() {
this.sqlConnection.close();
}
}
Summary:
For basic assertion, we can provide an additional parameter (e.g: expected
) on data provider to allow automatic assertion.
How:
We can add a new expected
parameter. If the parameter exists, the developer doesn't have to make the assertion itself but return a value from within his test function.
@category('Array')
export class IndexOfTests {
@test
@testData(['A', 'B', 'C'], 'A', { expected: 0 })
public 'should return index when element is found'(array: string[], element: string) {
return array.indexOf(element);
}
}
Summary:
It would be practical to be able to skip a category or test.
How:
This could be implemented as a new decorator that could be applied to both a category or a test.
@skip @category('Array')
export class IndexOfTests {
@skip @test
public 'should return index when element is found'(array: string[], element: string) {
expect(array.indexOf(element)).to.equal(0);
}
}
Summary:
It could be practical to specify a custom test name for a test with no testData decorator.
How:
This could be implemented the following way:
@testSuite('array')
export class IndexOfTests {
@test
@testName('should return index when element is found')
public shouldReturnIndex(array: string[], element: string) {
expect(array.indexOf(element)).to.equal(0);
}
}
Summary:
For now, only sync function are supported. It will be great to have support for callback and async (Promise) function.
How:
Considering callback function, we could provide a done
parameter as the very last parameter when calling the test function (as Mocha is doing right now). This parameter will be always passed to the function and it's up to the dev to use it or not.
For async (Promise), it will be only internal changes to make it feasable.
Summary:
As of today, Kocoa only supports Mocha. Since there are multiple different tests framework in JS env, we can try to add supports for, at least, the must used one (Jest, Mocha, Jasmine,...).
This should be done in an extensible way (plugins) that allow easy development of new test framework support in the future.
Summary:
Current behavior is that with different class that have the same test suite name are not merged into a single test suite. It should be ideal to have class with same test suite name to be merged into a common test suite. This will allow test writers to split test that belong to the same test suite into multiple classes.
Current behavior:
Array
✔ should return element when found in array (["A","B","C"], "A")
✔ should return element when found in array ([1,2,3], 1)
Array
✔ should return index when element is found (["A","B","C"], "A")
✔ should return index when element is found (["A"], "A")
Expected behavior:
Array
✔ should return element when found in array (["A","B","C"], "A")
✔ should return element when found in array ([1,2,3], 1)
✔ should return index when element is found (["A","B","C"], "A")
✔ should return index when element is found (["A"], "A")
Summary:
Code that allow to create annotations with predefined rules and attributes is located in Kocoa package. This is a good candidate for being moved to its own package. This will make easier to reuse for others package that doesn't reference Kocoa package.
Summary:
All projects are under the projects folder. This could be splitted into multiple folders instead to better reflect each project purpose:
Summary:
We should make the package available on NPM.
Summary:
A class that can contains test methods must be marked with @testSuite
annotation to indicate that the class contains test methods.
A test method can be decorated with a @test
annotation to indicate that the method is a test.
A test method can be marked with one or multiple @testData
to provide inline data for the test method. Each occurrence of @testData
create a new test with the specified data.
How:
@testSuite('Map')
export class MapTests {
@test
public 'should return undefined when empty'() {
const sut = new Map();
const actual = sut.get({});
expect(actual).to.be.undefined;
}
@test
@testData(new Map([['foo', 1]]), 'foo', 1)
public 'should return item when key exists'<TKey, TValue>(sut: Map<TKey, TValue>, key: TKey, value: TValue) {
const actual = sut.get(key);
expect(actual).to.not.be.undefined;
expect(actual).to.equal(value);
}
}
Summary:
Add code coverage on the project.
Allow to load Kocoa configuration from file.
With the new plugin system to load test framework, we need a way to defined which one to use. We could allow developers to define a configuration either from package.json or from a configuration file (e.g: .kocoarc,...).
package.json
{
"kocoa": {
"adapter": "@kocoa/adapter-mocha"
}
}
.kocoarc.json
{
"adapter": "@kocoa/adapter-mocha"
}
.kocoarc.yml
adapter: '@kocoa/adapter-mocha'
Summary:
The purpose of this adapter is to run tests under Vitest environnement.
Summary:
The purpose of this adapter is to run tests under Mocha environnement.
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.