barnard59-base
Advanced tools
Comparing version 1.2.2 to 2.0.0
# v1.0.0 | ||
## 2.0.0 | ||
### Major Changes | ||
- 6be7cd8: Literals loaded as step arguments will be converted to matching JS type (closes #116) | ||
- 72648c5: Change the operation URLs to be HTTPS (re zazuko/barnard59-website#4). | ||
This will only be a breaking change to those using the [shorthand step syntax](https://data-centric.zazuko.com/docs/workflows/explanations/simplified-syntax). | ||
### Minor Changes | ||
- 64b50ac: glob: added a warning message when nothing was matched | ||
## 1.2.2 | ||
@@ -4,0 +16,0 @@ |
@@ -9,2 +9,3 @@ import { promisify } from 'util' | ||
function glob({ pattern, ...options }) { | ||
const { logger } = this | ||
let filenames = null | ||
@@ -17,2 +18,3 @@ | ||
filenames = await promisify(globFn)(pattern, options) | ||
return filenames.length === 0 | ||
}) | ||
@@ -24,5 +26,8 @@ | ||
try { | ||
await init() | ||
const noneMatched = await init() | ||
if (filenames.length === 0) { | ||
if (noneMatched) { | ||
logger.warn(`No files matched by glob '${pattern}'`) | ||
} | ||
return stream.push(null) | ||
@@ -29,0 +34,0 @@ } |
{ | ||
"name": "barnard59-base", | ||
"version": "1.2.2", | ||
"version": "2.0.0", | ||
"description": "Linked Data pipelines", | ||
@@ -33,2 +33,4 @@ "main": "index.js", | ||
"devDependencies": { | ||
"barnard59-core": "^4.0.0", | ||
"chai": "^4.3.10", | ||
"get-stream": "^6.0.1", | ||
@@ -38,7 +40,11 @@ "into-stream": "^7.0.0", | ||
"mocha": "^9.0.1", | ||
"rdf-utils-fs": "^2.1.0" | ||
"rdf-utils-fs": "^2.1.0", | ||
"sinon": "^17.0.0" | ||
}, | ||
"engines": { | ||
"node": ">= 14.0.0" | ||
}, | ||
"mocha": { | ||
"require": "../../test/mocha-setup.cjs" | ||
} | ||
} |
import { deepStrictEqual, strictEqual } from 'assert' | ||
import { array } from 'get-stream' | ||
import { isReadable, isWritable } from 'isstream' | ||
import sinon from 'sinon' | ||
import { expect } from 'chai' | ||
import glob from '../glob.js' | ||
describe('glob', () => { | ||
let logger | ||
beforeEach(() => { | ||
logger = { | ||
debug: sinon.spy(), | ||
info: sinon.spy(), | ||
error: sinon.spy(), | ||
trace: sinon.spy(), | ||
warn: sinon.spy(), | ||
verbose: sinon.spy(), | ||
} | ||
}) | ||
it('should be a function', () => { | ||
@@ -12,3 +27,3 @@ strictEqual(typeof glob, 'function') | ||
it('should return a Readable stream', () => { | ||
const s = glob({ pattern: 'test/support/*' }) | ||
const s = glob.call({ logger }, { pattern: 'test/support/*' }) | ||
@@ -20,3 +35,3 @@ strictEqual(isReadable(s), true) | ||
it('should emit each file name as a chunk', async () => { | ||
const s = glob({ pattern: '../../test/e2e/definitions/foreach/*' }) | ||
const s = glob.call({ logger }, { pattern: '../../test/e2e/definitions/foreach/*' }) | ||
@@ -33,3 +48,3 @@ const filenames = await array(s) | ||
it('should forward additional options', async () => { | ||
const s = glob({ | ||
const s = glob.call({ logger }, { | ||
cwd: '../../test/e2e/definitions/foreach', | ||
@@ -47,2 +62,24 @@ pattern: '*', | ||
}) | ||
it('should warn when no files are matched', async () => { | ||
const s = glob.call({ logger }, { | ||
cwd: '../../test/e2e/definitions/foreach', | ||
pattern: 'foobar', | ||
}) | ||
await array(s) | ||
expect(logger.warn).to.have.been.called | ||
}) | ||
it('should not warn files have been matched', async () => { | ||
const s = glob.call({ logger }, { | ||
cwd: '../../test/e2e/definitions/foreach', | ||
pattern: '*', | ||
}) | ||
await array(s) | ||
expect(logger.warn).not.to.have.been.called | ||
}) | ||
}) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27378
726
8