vendredi 19 juillet 2019

How to instance a class in multiples files and use each of its returns in a configuration file?

How can I do multiple instances on specs, and get each of these to a class? It will indicates who made that spec.

Spec1.js

let helper = require('Helper');
let helper = new Helper("Jonh"); // Jonh did this spec
//...

Spec2.js

let helper = require('Helper');
let helper = new Helper("Julia"); // Julia did this spec
//...

Conf.js

// require user of each spec to show who made the spec in a pdf
afterEachSpec() {
    new PdfReporter(user);
}
//...

Helper.js

class Helper {
    constructor(user) {
        this.user = user;
    }
}

module.exports = Helper;

Aucun commentaire:

Enregistrer un commentaire