@form8ion/javascript
Advanced tools
+7
-37
@@ -46,4 +46,4 @@ import { questionNames as questionNames$2, questions } from '@travi/language-scaffolder-prompts'; | ||
| async function scaffoldCoverage({projectRoot, vcs, visibility, pathWithinParent}) { | ||
| return deepmerge(await scaffold({projectRoot}), await scaffold$1({vcs, visibility, pathWithinParent})); | ||
| async function scaffoldCoverage({projectRoot}) { | ||
| return deepmerge(await scaffold({projectRoot}), await scaffold$1({projectRoot})); | ||
| } | ||
@@ -124,11 +124,3 @@ | ||
| async function scaffoldUnitTesting({ | ||
| projectRoot, | ||
| frameworks, | ||
| decisions, | ||
| visibility, | ||
| vcs, | ||
| pathWithinParent, | ||
| dialect | ||
| }) { | ||
| async function scaffoldUnitTesting({projectRoot, frameworks, decisions, dialect}) { | ||
| const validatedFrameworks = validateOptions(pluginsSchema, frameworks); | ||
@@ -138,3 +130,3 @@ const [framework, coverage] = await Promise.all([ | ||
| .then(chosenFramework => scaffoldChoice(validatedFrameworks, chosenFramework, {projectRoot, dialect})), | ||
| scaffoldCoverage({projectRoot, vcs, visibility, pathWithinParent}) | ||
| scaffoldCoverage({projectRoot}) | ||
| ]); | ||
@@ -1519,20 +1511,9 @@ | ||
| projectRoot, | ||
| visibility, | ||
| tests: {unit, integration}, | ||
| vcs, | ||
| unitTestFrameworks, | ||
| decisions, | ||
| dialect, | ||
| pathWithinParent | ||
| dialect | ||
| }) { | ||
| const unitResults = unit | ||
| ? await scaffoldUnitTesting({ | ||
| projectRoot, | ||
| visibility, | ||
| vcs, | ||
| frameworks: unitTestFrameworks, | ||
| decisions, | ||
| dialect, | ||
| pathWithinParent | ||
| }) | ||
| ? await scaffoldUnitTesting({projectRoot, frameworks: unitTestFrameworks, decisions, dialect}) | ||
| : {}; | ||
@@ -1606,3 +1587,2 @@ | ||
| dialect, | ||
| visibility, | ||
| packageManager, | ||
@@ -1617,12 +1597,3 @@ vcs, | ||
| const [testingResults, lintingResults, huskyResults] = await Promise.all([ | ||
| scaffoldTesting({ | ||
| projectRoot, | ||
| tests, | ||
| visibility, | ||
| vcs, | ||
| unitTestFrameworks, | ||
| decisions, | ||
| dialect, | ||
| pathWithinParent | ||
| }), | ||
| scaffoldTesting({projectRoot, tests, unitTestFrameworks, decisions, dialect}), | ||
| scaffoldLinting({projectRoot, packageManager, registries}), | ||
@@ -1771,3 +1742,2 @@ scaffold$2({projectRoot, packageManager, pathWithinParent}) | ||
| dialect, | ||
| visibility, | ||
| packageManager, | ||
@@ -1774,0 +1744,0 @@ vcs, |
+1
-1
@@ -5,3 +5,3 @@ { | ||
| "license": "MIT", | ||
| "version": "15.6.1", | ||
| "version": "15.6.2", | ||
| "type": "module", | ||
@@ -8,0 +8,0 @@ "engines": { |
@@ -5,4 +5,4 @@ import deepmerge from 'deepmerge'; | ||
| export default async function scaffoldCoverage({projectRoot, vcs, visibility, pathWithinParent}) { | ||
| return deepmerge(await scaffoldC8({projectRoot}), await scaffoldCodecov({vcs, visibility, pathWithinParent})); | ||
| export default async function scaffoldCoverage({projectRoot}) { | ||
| return deepmerge(await scaffoldC8({projectRoot}), await scaffoldCodecov({projectRoot})); | ||
| } |
| import {scaffold as scaffoldCodecov} from '@form8ion/codecov'; | ||
| import {scaffold as scaffoldC8} from '@form8ion/c8'; | ||
| import {describe, vi, it, expect, afterEach} from 'vitest'; | ||
| import {describe, expect, it, vi} from 'vitest'; | ||
| import any from '@travi/any'; | ||
@@ -14,17 +14,10 @@ import {when} from 'vitest-when'; | ||
| describe('coverage scaffolder', () => { | ||
| afterEach(() => { | ||
| vi.clearAllMocks(); | ||
| }); | ||
| it('should scaffold coverage measurement and reporting', async () => { | ||
| const vcs = any.simpleObject(); | ||
| const visibility = any.word(); | ||
| const projectRoot = any.string(); | ||
| const c8Results = any.simpleObject(); | ||
| const codecovResults = any.simpleObject(); | ||
| const pathWithinParent = any.string(); | ||
| when(scaffoldC8).calledWith({projectRoot}).thenResolve(c8Results); | ||
| when(scaffoldCodecov).calledWith({vcs, visibility, pathWithinParent}).thenResolve(codecovResults); | ||
| when(scaffoldCodecov).calledWith({projectRoot}).thenResolve(codecovResults); | ||
| const results = await scaffold({vcs, visibility, projectRoot, pathWithinParent}); | ||
| const results = await scaffold({projectRoot}); | ||
@@ -31,0 +24,0 @@ expect(results).toEqual({...c8Results, ...codecovResults}); |
@@ -92,3 +92,2 @@ import deepmerge from 'deepmerge'; | ||
| dialect, | ||
| visibility, | ||
| packageManager, | ||
@@ -95,0 +94,0 @@ vcs, |
@@ -158,3 +158,2 @@ import deepmerge from 'deepmerge'; | ||
| dialect, | ||
| visibility, | ||
| packageManager, | ||
@@ -161,0 +160,0 @@ vcs, |
@@ -7,20 +7,9 @@ import deepmerge from 'deepmerge'; | ||
| projectRoot, | ||
| visibility, | ||
| tests: {unit, integration}, | ||
| vcs, | ||
| unitTestFrameworks, | ||
| decisions, | ||
| dialect, | ||
| pathWithinParent | ||
| dialect | ||
| }) { | ||
| const unitResults = unit | ||
| ? await scaffoldUnitTesting({ | ||
| projectRoot, | ||
| visibility, | ||
| vcs, | ||
| frameworks: unitTestFrameworks, | ||
| decisions, | ||
| dialect, | ||
| pathWithinParent | ||
| }) | ||
| ? await scaffoldUnitTesting({projectRoot, frameworks: unitTestFrameworks, decisions, dialect}) | ||
| : {}; | ||
@@ -27,0 +16,0 @@ |
@@ -12,3 +12,2 @@ import any from '@travi/any'; | ||
| const projectRoot = any.string(); | ||
| const visibility = any.word(); | ||
| const dialect = any.word(); | ||
@@ -20,10 +19,8 @@ const unitTestingDevDependencies = any.listOf(any.string); | ||
| const unitTestDirectoriesToIgnoreFromVcs = any.listOf(any.string); | ||
| const vcs = any.simpleObject(); | ||
| const unitTestFrameworks = any.simpleObject(); | ||
| const decisions = any.simpleObject(); | ||
| const pathWithinParent = any.string(); | ||
| beforeEach(() => { | ||
| when(scaffoldUnitTesting) | ||
| .calledWith({projectRoot, visibility, vcs, frameworks: unitTestFrameworks, decisions, dialect, pathWithinParent}) | ||
| .calledWith({projectRoot, frameworks: unitTestFrameworks, decisions, dialect}) | ||
| .thenResolve({ | ||
@@ -40,9 +37,6 @@ dependencies: {javascript: {development: unitTestingDevDependencies}}, | ||
| projectRoot, | ||
| visibility, | ||
| tests: {unit: true}, | ||
| vcs, | ||
| unitTestFrameworks, | ||
| decisions, | ||
| dialect, | ||
| pathWithinParent | ||
| dialect | ||
| })).toEqual({ | ||
@@ -58,3 +52,3 @@ dependencies: {javascript: {development: ['@travi/any', ...unitTestingDevDependencies]}}, | ||
| it('should not scaffold unit testing if the project will not be unit tested', async () => { | ||
| expect(await scaffoldTesting({projectRoot, visibility, tests: {unit: false, integration: true}, pathWithinParent})) | ||
| expect(await scaffoldTesting({projectRoot, tests: {unit: false, integration: true}})) | ||
| .toEqual({dependencies: {javascript: {development: ['@travi/any']}}, eslint: {}}); | ||
@@ -64,5 +58,5 @@ }); | ||
| it('should not scaffold testing if the project will not be tested', async () => { | ||
| expect(await scaffoldTesting({projectRoot, visibility, tests: {unit: false, integration: false}, pathWithinParent})) | ||
| expect(await scaffoldTesting({projectRoot, tests: {unit: false, integration: false}})) | ||
| .toEqual({dependencies: {javascript: {development: []}}, eslint: {}}); | ||
| }); | ||
| }); |
@@ -9,11 +9,3 @@ import deepmerge from 'deepmerge'; | ||
| export default async function scaffoldUnitTesting({ | ||
| projectRoot, | ||
| frameworks, | ||
| decisions, | ||
| visibility, | ||
| vcs, | ||
| pathWithinParent, | ||
| dialect | ||
| }) { | ||
| export default async function scaffoldUnitTesting({projectRoot, frameworks, decisions, dialect}) { | ||
| const validatedFrameworks = validateOptions(pluginsSchema, frameworks); | ||
@@ -23,3 +15,3 @@ const [framework, coverage] = await Promise.all([ | ||
| .then(chosenFramework => scaffoldFrameworkChoice(validatedFrameworks, chosenFramework, {projectRoot, dialect})), | ||
| scaffoldCoverage({projectRoot, vcs, visibility, pathWithinParent}) | ||
| scaffoldCoverage({projectRoot}) | ||
| ]); | ||
@@ -26,0 +18,0 @@ |
@@ -22,3 +22,2 @@ import {validateOptions} from '@form8ion/core'; | ||
| const projectRoot = any.string(); | ||
| const vcs = any.simpleObject(); | ||
| const frameworks = any.simpleObject(); | ||
@@ -28,3 +27,2 @@ const decisions = any.simpleObject(); | ||
| const dialect = any.word(); | ||
| const pathWithinParent = any.string(); | ||
| const coverageResults = any.simpleObject(); | ||
@@ -35,3 +33,2 @@ const unitTestFrameworkResults = any.simpleObject(); | ||
| it('should scaffold the chosen framework', async () => { | ||
| const visibility = any.word(); | ||
| const validatedFrameworks = any.simpleObject(); | ||
@@ -43,5 +40,3 @@ when(validateOptions).calledWith(pluginsSchema, frameworks).thenReturn(validatedFrameworks); | ||
| .thenResolve(unitTestFrameworkResults); | ||
| when(scaffoldCoverage) | ||
| .calledWith({projectRoot, vcs, visibility, pathWithinParent}) | ||
| .thenResolve(coverageResults); | ||
| when(scaffoldCoverage).calledWith({projectRoot}).thenResolve(coverageResults); | ||
| when(deepmerge.all) | ||
@@ -55,5 +50,4 @@ .calledWith([ | ||
| expect(await scaffoldUnitTesting({projectRoot, frameworks, decisions, vcs, visibility, pathWithinParent, dialect})) | ||
| .toEqual(mergedResults); | ||
| expect(await scaffoldUnitTesting({projectRoot, frameworks, decisions, dialect})).toEqual(mergedResults); | ||
| }); | ||
| }); |
@@ -10,3 +10,2 @@ import deepmerge from 'deepmerge'; | ||
| dialect, | ||
| visibility, | ||
| packageManager, | ||
@@ -21,12 +20,3 @@ vcs, | ||
| const [testingResults, lintingResults, huskyResults] = await Promise.all([ | ||
| scaffoldTesting({ | ||
| projectRoot, | ||
| tests, | ||
| visibility, | ||
| vcs, | ||
| unitTestFrameworks, | ||
| decisions, | ||
| dialect, | ||
| pathWithinParent | ||
| }), | ||
| scaffoldTesting({projectRoot, tests, unitTestFrameworks, decisions, dialect}), | ||
| scaffoldLinting({projectRoot, packageManager, registries, vcs, pathWithinParent}), | ||
@@ -33,0 +23,0 @@ scaffoldHusky({projectRoot, packageManager, pathWithinParent}) |
@@ -20,3 +20,2 @@ import deepmerge from 'deepmerge'; | ||
| const projectRoot = any.string(); | ||
| const visibility = any.string(); | ||
| const packageManager = any.string(); | ||
@@ -39,3 +38,3 @@ const dialect = any.word(); | ||
| when(scaffoldTesting) | ||
| .calledWith({projectRoot, tests, visibility, vcs, unitTestFrameworks, decisions, dialect, pathWithinParent}) | ||
| .calledWith({projectRoot, tests, unitTestFrameworks, decisions, dialect}) | ||
| .thenResolve(testingResults); | ||
@@ -50,3 +49,2 @@ when(scaffoldHusky).calledWith({projectRoot, packageManager, pathWithinParent}).thenResolve(huskyResults); | ||
| tests, | ||
| visibility, | ||
| decisions, | ||
@@ -53,0 +51,0 @@ unitTestFrameworks, |
Sorry, the diff of this file is too big to display
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
0
-100%454295
-0.52%8076
-0.99%