Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 导出实验室节点_Node.js_Npm_Lab - Fatal编程技术网

Node.js 导出实验室节点

Node.js 导出实验室节点,node.js,npm,lab,Node.js,Npm,Lab,我有一个问题,我尝试使用exports.something或global.something与图书馆实验室,但我有以下问题 includes a lab script that is not exported via exports.lab% 我只能在导出每个文件时使用它 我的这个案例的测试文件有效 我的测试文件 'use strict'; const Lab = require('lab'); const lab = exports.lab = Lab.script(); const e

我有一个问题,我尝试使用exports.something或global.something与图书馆实验室,但我有以下问题

includes a lab script that is not exported via exports.lab% 
我只能在导出每个文件时使用它

我的这个案例的测试文件有效

我的测试文件

'use strict';

const Lab = require('lab');
const lab = exports.lab = Lab.script();
const expect = require('code').expect;

const describe = lab.describe;
const it = lab.it;

const config = require('./config');

describe('CONFIG', () => {

    describe('isEnvironment', () => {

        it('Should have a property boolean', done => {

            expect(config.IsEnvironment('test')).to.be.an.boolean();
            done();
        });

        it('Should return a boolean (true) to pass a variable called test in function isEnvironment', done => {

            expect(config.IsEnvironment('test')).to.equal(true);
            done();
        });

        it('Should return a boolean (false) to pass a variable any variable diferrent of test in function isEnvironment', done => {

            expect(config.IsEnvironment('development')).to.equal(false);
            done();
        });
    });

});
但我用这个案子不管用

setup.js

'use strict';

    const lab = require('lab').script();
    exports.expect = require('code').expect;

    exports.describe = lab.describe;
    exports.before = lab.before;
    exports.after = lab.after;
    exports.beforeEach = lab.beforeEach;
    exports.afterEach = lab.afterEach;
    exports.it = lab.it;
导入setup.js

'use strict';    
const _ = require('../../test/setup');


const config = require('./config');

_.describe('CONFIG', () => {

    _.describe('isEnvironment', () => {

        _.it('Should have a property boolean', done => {

            _.expect(config.IsEnvironment('test')).to.be.an.boolean();
            done();
        });

        _.it('Should return a boolean (true) to pass a variable called test in function isEnvironment', done => {

            done();
        });

        _.it('Should return a boolean (false) to pass a variable any variable diferrent of test in function isEnvironment', done => {

            _.expect(config.IsEnvironment('development')).to.equal(false);
            done();
        });
    });

});
mypackage.json

"scripts": {
    "test": "export NODE_ENV=test && lab src/**/*.spec.js -v; exit 0",
  }
我的结构文件夹