refactor: testing

This commit is contained in:
cha0s 2021-01-05 11:25:46 -06:00
parent 394a3038c4
commit 36fdb62bf5
2 changed files with 61 additions and 60 deletions

View File

@ -1,7 +1,6 @@
import {expect} from 'chai';
import Middleware from '../src/middleware';
describe('@latus/core', () => {
describe('middleware', () => {
it('should construct with middleware', (done) => {
let called = false;
@ -70,4 +69,3 @@ describe('@latus/core', () => {
});
});
});
});

View File

@ -26,7 +26,10 @@ const client = {
neutrino.options.root = fs.realpathSync(root);
neutrino.options.source = 'client';
neutrino.options.mains.index = 'index';
neutrino.options.mains.tests = {entry: './client/tests'};
neutrino.options.mains.tests = {
entry: './client/tests',
title: 'Mocha tests',
};
const output = 'build';
neutrino.options.output = join(
isAbsolute(output)
@ -85,11 +88,11 @@ const client = {
'};',
].join('\n'));
const testPaths = paths
.map((path) => Latus.runtimePath(`${path}/test`))
.filter((path) => !!path);
plugin.writeModule(`node_modules/@latus/core/tests`, [
testPaths.map((path) => `require('${path}')`),
].join('\n'));
.map((path) => [path, Latus.runtimePath(`${path}/test`)])
.filter(([, path]) => !!path);
plugin.writeModule(`node_modules/@latus/core/tests`, testPaths.map(
([original, path]) => `describe('${original}', () => require('${path}'));`
).join(''));
});
}