smartgulp/test/test.ts

44 lines
1.0 KiB
TypeScript
Raw Permalink Normal View History

2023-11-25 17:11:31 +00:00
import { expect, tap } from '@push.rocks/tapbundle';
2017-04-29 22:25:31 +00:00
2022-06-09 17:59:21 +00:00
import * as smartgulp from '../ts/index.js';
2023-11-25 17:11:31 +00:00
import * as smartstream from '@push.rocks/smartstream';
2018-09-02 12:35:49 +00:00
import * as gulpFunction from 'gulp-function';
2023-11-25 17:11:31 +00:00
import * as smartpromise from '@push.rocks/smartpromise';
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) => {
2023-11-25 17:11:31 +00:00
let done = smartpromise.defer();
2018-09-02 12:35:49 +00:00
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 () => {
2023-11-25 17:11:31 +00:00
let done = smartpromise.defer();
2018-09-02 12:35:49 +00:00
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
2023-11-25 17:11:31 +00:00
await tap.start();