2023-11-25 18:11:31 +01:00
|
|
|
import { expect, tap } from '@push.rocks/tapbundle';
|
2017-04-30 00:25:31 +02:00
|
|
|
|
2022-06-09 19:59:21 +02:00
|
|
|
import * as smartgulp from '../ts/index.js';
|
2023-11-25 18:11:31 +01:00
|
|
|
import * as smartstream from '@push.rocks/smartstream';
|
2018-09-02 14:35:49 +02:00
|
|
|
import * as gulpFunction from 'gulp-function';
|
2023-11-25 18:11:31 +01:00
|
|
|
import * as smartpromise from '@push.rocks/smartpromise';
|
2017-04-30 00:25:31 +02:00
|
|
|
|
2022-06-09 19:59:21 +02:00
|
|
|
tap.test('smartgulp.src -> should read a directoy', async (tools) => {
|
2023-11-25 18:11:31 +01:00
|
|
|
let done = smartpromise.defer();
|
2018-09-02 14:35:49 +02:00
|
|
|
smartgulp
|
|
|
|
|
.src(['./test/testfiles/**/*.md'])
|
|
|
|
|
.pipe(
|
2022-06-09 19:59:21 +02:00
|
|
|
gulpFunction.forEach(async (fileArg) => {
|
2018-09-02 14:35:49 +02:00
|
|
|
console.log(fileArg.path);
|
|
|
|
|
})
|
|
|
|
|
)
|
|
|
|
|
.pipe(
|
|
|
|
|
gulpFunction.atEnd(async () => {
|
|
|
|
|
done.resolve();
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
await done.promise;
|
|
|
|
|
});
|
2017-04-30 00:25:31 +02:00
|
|
|
|
2018-02-16 00:46:55 +01:00
|
|
|
tap.test('smartgulp shoould replace files', async () => {
|
2023-11-25 18:11:31 +01:00
|
|
|
let done = smartpromise.defer();
|
2018-09-02 14:35:49 +02:00
|
|
|
smartgulp
|
|
|
|
|
.src(['./test/testfiles/**/*.md'])
|
|
|
|
|
.pipe(
|
2022-06-09 19:59:21 +02:00
|
|
|
gulpFunction.forEach(async (fileArg) => {
|
2018-09-02 14:35:49 +02:00
|
|
|
console.log(fileArg.path);
|
|
|
|
|
})
|
|
|
|
|
)
|
|
|
|
|
.pipe(
|
|
|
|
|
gulpFunction.atEnd(async () => {
|
|
|
|
|
done.resolve();
|
|
|
|
|
})
|
|
|
|
|
)
|
|
|
|
|
.pipe(smartgulp.replace());
|
|
|
|
|
await done.promise;
|
|
|
|
|
});
|
2018-02-16 00:46:55 +01:00
|
|
|
|
2023-11-25 18:11:31 +01:00
|
|
|
await tap.start();
|