@tapjs/config
Advanced tools
Comparing version 3.0.1 to 3.1.0
@@ -309,2 +309,3 @@ /** | ||
readPackageJsonConfig(pj: string): Promise<OptionsResults<C> | undefined>; | ||
resolvePathOptions(conf: OptionsResults<C> | undefined, file: string): OptionsResults<C> | undefined; | ||
/** | ||
@@ -311,0 +312,0 @@ * Read the configuration from a dependency |
@@ -173,3 +173,4 @@ "use strict"; | ||
try { | ||
return (0, tap_yaml_1.parse)(await (0, promises_1.readFile)(rc, 'utf8')); | ||
const p = (0, tap_yaml_1.parse)(await (0, promises_1.readFile)(rc, 'utf8')); | ||
return this.resolvePathOptions(typeof p === 'string' ? { extends: p } : p, rc); | ||
} | ||
@@ -189,3 +190,6 @@ catch (er) { | ||
if (res && typeof res === 'object' && !Array.isArray(res)) { | ||
return res; | ||
const r = res; | ||
if (typeof r.tap === 'string') | ||
r.tap = { extends: r.tap }; | ||
return r; | ||
} | ||
@@ -203,4 +207,15 @@ } | ||
async readPackageJsonConfig(pj) { | ||
return (await this.readPackageJson(pj))?.tap; | ||
return this.resolvePathOptions((await this.readPackageJson(pj))?.tap, pj); | ||
} | ||
resolvePathOptions(conf, file) { | ||
if (conf) { | ||
for (const p of pathOptions) { | ||
const pc = conf[p]; | ||
if (typeof pc === 'string') { | ||
Object.assign(conf, { [p]: (0, path_1.resolve)((0, path_1.dirname)(file), pc) }); | ||
} | ||
} | ||
} | ||
return conf; | ||
} | ||
/** | ||
@@ -288,10 +303,2 @@ * Read the configuration from a dependency | ||
const { extends: ext, ...rest } = data; | ||
// root the glob and path type options | ||
// if we pick up one of them, lose any others from other root dirs | ||
const dir = (0, path_1.dirname)(resolved); | ||
for (const k of pathOptions) { | ||
if (typeof rest[k] === 'string') { | ||
rest[k] = (0, path_1.resolve)(dir, rest[k]); | ||
} | ||
} | ||
try { | ||
@@ -298,0 +305,0 @@ this.jack.setConfigValues(rest, resolved); |
@@ -38,2 +38,9 @@ /** | ||
}> & import("jackspeak").ConfigSetFromMetaSet<"boolean", false, { | ||
browser: { | ||
description: string; | ||
default: true; | ||
}; | ||
'no-browser': { | ||
description: string; | ||
}; | ||
'show-full-coverage': { | ||
@@ -78,2 +85,5 @@ description: string; | ||
}; | ||
'fail-only': { | ||
description: string; | ||
}; | ||
color: { | ||
@@ -80,0 +90,0 @@ short: string; |
@@ -317,2 +317,15 @@ "use strict"; | ||
.flag({ | ||
browser: { | ||
description: `Open the coverage report in the system's web browser when | ||
an html report is generated (ie, when \`--coverage-report\` | ||
is either \`lcov\` or \`html\`). | ||
If set to false, then the html files will be generated, but | ||
not opened in a web browser automatically.`, | ||
default: true, | ||
}, | ||
'no-browser': { | ||
description: `Do not automatically open html coverage reports in the | ||
system default web browser`, | ||
}, | ||
'show-full-coverage': { | ||
@@ -438,2 +451,9 @@ description: `Show the \`100\` lines in the default \`text\` coverage | ||
}, | ||
'fail-only': { | ||
description: `Fail any tests marked with \`{only: true }\`, for CI and | ||
other environments where you want to ensure that tests are | ||
not being skipped. | ||
Only relevant when the @tapjs/filter plugin is enabled.`, | ||
}, | ||
color: { | ||
@@ -440,0 +460,0 @@ short: 'c', |
@@ -309,2 +309,3 @@ /** | ||
readPackageJsonConfig(pj: string): Promise<OptionsResults<C> | undefined>; | ||
resolvePathOptions(conf: OptionsResults<C> | undefined, file: string): OptionsResults<C> | undefined; | ||
/** | ||
@@ -311,0 +312,0 @@ * Read the configuration from a dependency |
@@ -167,3 +167,4 @@ /** | ||
try { | ||
return yamlParse(await readFile(rc, 'utf8')); | ||
const p = yamlParse(await readFile(rc, 'utf8')); | ||
return this.resolvePathOptions(typeof p === 'string' ? { extends: p } : p, rc); | ||
} | ||
@@ -183,3 +184,6 @@ catch (er) { | ||
if (res && typeof res === 'object' && !Array.isArray(res)) { | ||
return res; | ||
const r = res; | ||
if (typeof r.tap === 'string') | ||
r.tap = { extends: r.tap }; | ||
return r; | ||
} | ||
@@ -197,4 +201,15 @@ } | ||
async readPackageJsonConfig(pj) { | ||
return (await this.readPackageJson(pj))?.tap; | ||
return this.resolvePathOptions((await this.readPackageJson(pj))?.tap, pj); | ||
} | ||
resolvePathOptions(conf, file) { | ||
if (conf) { | ||
for (const p of pathOptions) { | ||
const pc = conf[p]; | ||
if (typeof pc === 'string') { | ||
Object.assign(conf, { [p]: resolve(dirname(file), pc) }); | ||
} | ||
} | ||
} | ||
return conf; | ||
} | ||
/** | ||
@@ -282,10 +297,2 @@ * Read the configuration from a dependency | ||
const { extends: ext, ...rest } = data; | ||
// root the glob and path type options | ||
// if we pick up one of them, lose any others from other root dirs | ||
const dir = dirname(resolved); | ||
for (const k of pathOptions) { | ||
if (typeof rest[k] === 'string') { | ||
rest[k] = resolve(dir, rest[k]); | ||
} | ||
} | ||
try { | ||
@@ -292,0 +299,0 @@ this.jack.setConfigValues(rest, resolved); |
@@ -38,2 +38,9 @@ /** | ||
}> & import("jackspeak").ConfigSetFromMetaSet<"boolean", false, { | ||
browser: { | ||
description: string; | ||
default: true; | ||
}; | ||
'no-browser': { | ||
description: string; | ||
}; | ||
'show-full-coverage': { | ||
@@ -78,2 +85,5 @@ description: string; | ||
}; | ||
'fail-only': { | ||
description: string; | ||
}; | ||
color: { | ||
@@ -80,0 +90,0 @@ short: string; |
@@ -315,2 +315,15 @@ /** | ||
.flag({ | ||
browser: { | ||
description: `Open the coverage report in the system's web browser when | ||
an html report is generated (ie, when \`--coverage-report\` | ||
is either \`lcov\` or \`html\`). | ||
If set to false, then the html files will be generated, but | ||
not opened in a web browser automatically.`, | ||
default: true, | ||
}, | ||
'no-browser': { | ||
description: `Do not automatically open html coverage reports in the | ||
system default web browser`, | ||
}, | ||
'show-full-coverage': { | ||
@@ -436,2 +449,9 @@ description: `Show the \`100\` lines in the default \`text\` coverage | ||
}, | ||
'fail-only': { | ||
description: `Fail any tests marked with \`{only: true }\`, for CI and | ||
other environments where you want to ensure that tests are | ||
not being skipped. | ||
Only relevant when the @tapjs/filter plugin is enabled.`, | ||
}, | ||
color: { | ||
@@ -438,0 +458,0 @@ short: 'c', |
{ | ||
"name": "@tapjs/config", | ||
"version": "3.0.1", | ||
"version": "3.1.0", | ||
"description": "Utility loading and managing tap configuration", | ||
@@ -43,4 +43,4 @@ "tshy": { | ||
"dependencies": { | ||
"@tapjs/core": "2.0.1", | ||
"@tapjs/test": "2.0.1", | ||
"@tapjs/core": "2.1.0", | ||
"@tapjs/test": "2.1.0", | ||
"chalk": "^5.2.0", | ||
@@ -53,4 +53,4 @@ "jackspeak": "^3.1.2", | ||
"peerDependencies": { | ||
"@tapjs/core": "2.0.1", | ||
"@tapjs/test": "2.0.1" | ||
"@tapjs/core": "2.1.0", | ||
"@tapjs/test": "2.1.0" | ||
}, | ||
@@ -57,0 +57,0 @@ "tap": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
277199
3423
+ Added@tapjs/after@1.1.25(transitive)
+ Added@tapjs/after-each@2.0.2(transitive)
+ Added@tapjs/asserts@2.0.2(transitive)
+ Added@tapjs/before@2.0.2(transitive)
+ Added@tapjs/before-each@2.0.2(transitive)
+ Added@tapjs/core@2.1.0(transitive)
+ Added@tapjs/filter@2.0.2(transitive)
+ Added@tapjs/fixture@2.0.2(transitive)
+ Added@tapjs/intercept@2.0.2(transitive)
+ Added@tapjs/mock@2.1.0(transitive)
+ Added@tapjs/node-serialize@2.0.2(transitive)
+ Added@tapjs/snapshot@2.0.2(transitive)
+ Added@tapjs/spawn@2.0.2(transitive)
+ Added@tapjs/stdin@2.0.2(transitive)
+ Added@tapjs/test@2.1.0(transitive)
+ Added@tapjs/typescript@1.4.7(transitive)
+ Added@tapjs/worker@2.0.2(transitive)
- Removed@tapjs/after@1.1.24(transitive)
- Removed@tapjs/after-each@2.0.1(transitive)
- Removed@tapjs/asserts@2.0.1(transitive)
- Removed@tapjs/before@2.0.1(transitive)
- Removed@tapjs/before-each@2.0.1(transitive)
- Removed@tapjs/core@2.0.1(transitive)
- Removed@tapjs/filter@2.0.1(transitive)
- Removed@tapjs/fixture@2.0.1(transitive)
- Removed@tapjs/intercept@2.0.1(transitive)
- Removed@tapjs/mock@2.0.1(transitive)
- Removed@tapjs/node-serialize@2.0.1(transitive)
- Removed@tapjs/snapshot@2.0.1(transitive)
- Removed@tapjs/spawn@2.0.1(transitive)
- Removed@tapjs/stdin@2.0.1(transitive)
- Removed@tapjs/test@2.0.1(transitive)
- Removed@tapjs/typescript@1.4.6(transitive)
- Removed@tapjs/worker@2.0.1(transitive)
Updated@tapjs/core@2.1.0
Updated@tapjs/test@2.1.0