Skip to content

Commit 9076040

Browse files
author
Ovidiu Barabula
committed
feat(core): add core task for dependencies installation
1 parent d7253da commit 9076040

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { assert, expect } from 'chai';
2+
import 'mocha';
3+
import ConfigManager from '../config-manager';
4+
import ConfigManagerProxy from '../config-manager/config-manager-proxy';
5+
import Logger from '../util/logger';
6+
import { AnyFunction } from '../util/utility-functions';
7+
import { taskFn } from './task-install-dependencies';
8+
9+
describe('#Task: Install Dependencies', () => {
10+
const callback: AnyFunction = () => true;
11+
const logger = Logger.getInstance()('init');
12+
let config;
13+
let pluginProvider;
14+
15+
beforeEach(async () => {
16+
config = ConfigManagerProxy(await ConfigManager(), 'init');
17+
pluginProvider = {
18+
config,
19+
logger,
20+
};
21+
});
22+
23+
24+
it('returns a promise', async () => {
25+
let wasCalled = false;
26+
const customCallback = () => wasCalled = true;
27+
expect(taskFn(customCallback, pluginProvider)).to.satisfy(subject => subject instanceof Promise);
28+
});
29+
});
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* Name: task-install-dependencies.ts
3+
* Description: Task for installing plugin dependencies
4+
* Author: Ovidiu Barabula <lectii2008@gmail.com>
5+
* @since 1.1.0
6+
*/
7+
8+
import depsManager from '../dependencies-manager';
9+
import { PluginProvider } from '../plugin-manager/installable';
10+
import { AnyFunction } from '../util/utility-functions';
11+
12+
// Object to be exported
13+
const taskExport = {
14+
description: 'Task for installing plugin dependencies',
15+
hook: 'dependencies',
16+
name: 'dependencies',
17+
taskFn,
18+
};
19+
20+
/**
21+
* Task main function
22+
* @param done Gulp async callback
23+
* @param pluginProvider Assortment of tools for plugins and tasks (e.g. logger, config manager, etc.)
24+
*/
25+
async function taskFn(done: AnyFunction, { config, logger }: PluginProvider): Promise<void> {
26+
return depsManager.install();
27+
}
28+
29+
/* test:start */
30+
export { taskFn };
31+
/* test:end */
32+
33+
export default taskExport;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy