feat(smartgulp): modernize file glob handling and refresh package metadata
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
import { expect, tap } from '@git.zone/tstest/tapbundle';
|
||||
|
||||
import * as smartgulp from '../ts/index.js';
|
||||
import * as gulpFunction from '@push.rocks/gulp-function';
|
||||
import * as smartpromise from '@push.rocks/smartpromise';
|
||||
import { SmartFile } from '@push.rocks/smartfile';
|
||||
|
||||
tap.test('smartgulp.src should read a directory', async () => {
|
||||
const done = smartpromise.defer<void>();
|
||||
const filePaths: string[] = [];
|
||||
smartgulp
|
||||
.src(['./test/testfiles/**/*.md'])
|
||||
.pipe(
|
||||
gulpFunction.forEach(async (fileArg: SmartFile) => {
|
||||
filePaths.push(fileArg.path);
|
||||
})
|
||||
)
|
||||
.pipe(
|
||||
gulpFunction.atEnd(async () => {
|
||||
done.resolve();
|
||||
})
|
||||
);
|
||||
await done.promise;
|
||||
expect(filePaths.some((filePathArg) => filePathArg.endsWith('.md'))).toBeTrue();
|
||||
});
|
||||
|
||||
tap.test('smartgulp should replace files', async () => {
|
||||
const done = smartpromise.defer<void>();
|
||||
const filePaths: string[] = [];
|
||||
smartgulp
|
||||
.src(['./test/testfiles/**/*.md'])
|
||||
.pipe(
|
||||
gulpFunction.forEach(async (fileArg: SmartFile) => {
|
||||
filePaths.push(fileArg.path);
|
||||
})
|
||||
)
|
||||
.pipe(
|
||||
gulpFunction.atEnd(async () => {
|
||||
done.resolve();
|
||||
})
|
||||
)
|
||||
.pipe(smartgulp.replace());
|
||||
await done.promise;
|
||||
expect(filePaths.some((filePathArg) => filePathArg.endsWith('.md'))).toBeTrue();
|
||||
});
|
||||
|
||||
export default tap.start();
|
||||
@@ -1,43 +0,0 @@
|
||||
import { expect, tap } from '@push.rocks/tapbundle';
|
||||
|
||||
import * as smartgulp from '../ts/index.js';
|
||||
import * as smartstream from '@push.rocks/smartstream';
|
||||
import * as gulpFunction from 'gulp-function';
|
||||
import * as smartpromise from '@push.rocks/smartpromise';
|
||||
|
||||
tap.test('smartgulp.src -> should read a directoy', async (tools) => {
|
||||
let done = smartpromise.defer();
|
||||
smartgulp
|
||||
.src(['./test/testfiles/**/*.md'])
|
||||
.pipe(
|
||||
gulpFunction.forEach(async (fileArg) => {
|
||||
console.log(fileArg.path);
|
||||
})
|
||||
)
|
||||
.pipe(
|
||||
gulpFunction.atEnd(async () => {
|
||||
done.resolve();
|
||||
})
|
||||
);
|
||||
await done.promise;
|
||||
});
|
||||
|
||||
tap.test('smartgulp shoould replace files', async () => {
|
||||
let done = smartpromise.defer();
|
||||
smartgulp
|
||||
.src(['./test/testfiles/**/*.md'])
|
||||
.pipe(
|
||||
gulpFunction.forEach(async (fileArg) => {
|
||||
console.log(fileArg.path);
|
||||
})
|
||||
)
|
||||
.pipe(
|
||||
gulpFunction.atEnd(async () => {
|
||||
done.resolve();
|
||||
})
|
||||
)
|
||||
.pipe(smartgulp.replace());
|
||||
await done.promise;
|
||||
});
|
||||
|
||||
await tap.start();
|
||||
Reference in New Issue
Block a user