Coder Social home page Coder Social logo

kocoa's People

Contributors

julien-pires avatar semantic-release-bot avatar

Watchers

 avatar  avatar

kocoa's Issues

Allow to use class member as data provider

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);
    }
}

Merge test suite from different classes

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")

Make adapter tests reusable

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 Jasmine adapter

Summary:

The purpose of this adapter is to run tests under Jasmine environnement.

Allow to use different tests framework

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.

Add basic tests decorator

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);
    }
}

Allow to skip category or test

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);
    }
}

Add Vitest adapter

Summary:

The purpose of this adapter is to run tests under Vitest environnement.

Add Jest adapter

Summary:

The purpose of this adapter is to run tests under Jest environnement.

Move annotations system to its own package

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.

Add support for callback and async test

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.

Allow to specify a custom name for a test

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);
    }
}

Add some documentations

Summary:

Add some documentations to explain how to use the library.

  • Add new category
  • Add new test
  • Add new test case

Add Mocha adapter

Summary:

The purpose of this adapter is to run tests under Mocha environnement.

Add CI pipeline

Summary:

Add CI pipeline to build the package and run tests.

Allow to load Kocoa configuration from file

Feature:

Allow to load Kocoa configuration from file.

Description:

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,...).

Example:

package.json

{
    "kocoa": {
        "adapter":  "@kocoa/adapter-mocha"
    }
}

.kocoarc.json

{
    "adapter": "@kocoa/adapter-mocha"
}

.kocoarc.yml

adapter: '@kocoa/adapter-mocha'

Changes projects folder organization

Summary:

All projects are under the projects folder. This could be splitted into multiple folders instead to better reflect each project purpose:

  • packages: Will contains all project that will be deployed as independent npm package
  • samples: Will contains all project used to demonstrate package samples

Automatically test function result when expected result is provided

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);
    }
}

Remove node 12 support

Summary

Remove node 12 support on all projects. We can update tsconfig.json to latest lib version.

Update readme

Summary:

Readme.md must be updated with a short description of the library and basics examples.

Add ability to clean fixtures for a single test

Feature:

Add ability to clean fixtures for a single test

Description:

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.

Example:

@suite
class MyTestSuite implements IDisposable {
    constructor() {
        this.sqlConnection.open();
    }
    public dispose() {
        this.sqlConnection.close();
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.