2018-09-02 12:35:49 +00:00
|
|
|
import { expect, tap } from '@pushrocks/tapbundle';
|
2017-04-29 22:25:31 +00:00
|
|
|
|
2022-06-09 17:59:21 +00:00
|
|
|
import * as smartgulp from '../ts/index.js';
|
2019-02-20 22:54:38 +00:00
|
|
|
import * as smartstream from '@pushrocks/smartstream';
|
2018-09-02 12:35:49 +00:00
|
|
|
import * as gulpFunction from 'gulp-function';
|
|
|
|
import * as smartq from 'smartq';
|
2017-04-29 22:25:31 +00:00
|
|
|
|
2022-06-09 17:59:21 +00:00
|
|
|
tap.test('smartgulp.src -> should read a directoy', async (tools) => {
|
2018-09-02 12:35:49 +00:00
|
|
|
let done = smartq.defer();
|
|
|
|
smartgulp
|
|
|
|
.src(['./test/testfiles/**/*.md'])
|
|
|
|
.pipe(
|
2022-06-09 17:59:21 +00:00
|
|
|
gulpFunction.forEach(async (fileArg) => {
|
2018-09-02 12:35:49 +00:00
|
|
|
console.log(fileArg.path);
|
|
|
|
})
|
|
|
|
)
|
|
|
|
.pipe(
|
|
|
|
gulpFunction.atEnd(async () => {
|
|
|
|
done.resolve();
|
|
|
|
})
|
|
|
|
);
|
|
|
|
await done.promise;
|
|
|
|
});
|
2017-04-29 22:25:31 +00:00
|
|
|
|
2018-02-15 23:46:55 +00:00
|
|
|
tap.test('smartgulp shoould replace files', async () => {
|
2018-09-02 12:35:49 +00:00
|
|
|
let done = smartq.defer();
|
|
|
|
smartgulp
|
|
|
|
.src(['./test/testfiles/**/*.md'])
|
|
|
|
.pipe(
|
2022-06-09 17:59:21 +00:00
|
|
|
gulpFunction.forEach(async (fileArg) => {
|
2018-09-02 12:35:49 +00:00
|
|
|
console.log(fileArg.path);
|
|
|
|
})
|
|
|
|
)
|
|
|
|
.pipe(
|
|
|
|
gulpFunction.atEnd(async () => {
|
|
|
|
done.resolve();
|
|
|
|
})
|
|
|
|
)
|
|
|
|
.pipe(smartgulp.replace());
|
|
|
|
await done.promise;
|
|
|
|
});
|
2018-02-15 23:46:55 +00:00
|
|
|
|
2018-09-02 12:35:49 +00:00
|
|
|
tap.start();
|