Skip to content

Commit e5f85e3

Browse files
test(smoke): scan full README against npm install and clarify changelog
1 parent 011868f commit e5f85e3

2 files changed

Lines changed: 51 additions & 11 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ All notable changes to json2sql will be documented in this file.
88

99
- CLI integration tests with comprehensive coverage (#8, #9, #10)
1010
- Standalone dialect tests and converter edge cases (#10)
11-
- npm wrapper (`package.json` + `cli.js`) for npm publishing
1211
- GitHub Actions: PyPI publish workflow (release or manual dispatch)
1312
- GitHub Actions: GitHub Pages deployment workflow
1413
- GitHub Actions: npm publish workflow (release or manual dispatch)
@@ -45,13 +44,14 @@ All notable changes to json2sql will be documented in this file.
4544
- README rewritten with unified pricing tables, Revenue Holdings branding
4645
- README expanded with CI/CD integration examples and alternatives comparison
4746
- README tool count and DevForge URLs updated
48-
- npm install instructions added to README
47+
- README install instructions limited to pip, Homebrew, and Scoop (no npm package)
4948

5049
## [0.1.0] — 2026-05-14
5150

5251
### Added
5352

5453
- Initial release
54+
- PyPI package publishing (json2sql-cli) and local Node.js CLI wrapper
5555
- JSON to SQL INSERT conversion
5656
- Nested JSON auto-flattening into relational tables
5757
- Multi-dialect output: PostgreSQL, MySQL, SQLite

‎tests/smoke.test.js‎

Lines changed: 49 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,58 @@ test("smoke: README documents supported install paths only", () => {
3030
assert.ok(fs.existsSync(readmePath), "README.md must exist");
3131

3232
const readme = fs.readFileSync(readmePath, "utf8");
33+
const lines = readme.split(/\r?\n/);
3334

34-
const installPaths = [
35-
["pip install git+https://", "pip install from git"],
35+
const installStart = lines.findIndex((line) => /^##\s+Install(?:ation)?\s*$/i.test(line));
36+
assert.notStrictEqual(installStart, -1, "README must have an Install section");
37+
const nextHeading = lines.findIndex(
38+
(line, index) => index > installStart && /^##\s+/.test(line)
39+
);
40+
const installSection = lines
41+
.slice(installStart + 1, nextHeading === -1 ? undefined : nextHeading)
42+
.join("\n");
43+
44+
assert.match(
45+
installSection,
46+
/pip install (?:json2sql-cli|git\+https:\/\/github\.com\/Coding-Dev-Tools\/json2sql(?:\.git)?)/,
47+
"README Install section must document `pip install json2sql-cli` (or the documented git fallback)"
48+
);
49+
assert.match(
50+
installSection,
51+
/\bjson2sql-cli\b/,
52+
"README Install section must name the json2sql-cli package"
53+
);
54+
55+
for (const [needle, label] of [
3656
["brew tap ", "Homebrew tap"],
3757
["scoop bucket add ", "Scoop bucket"],
38-
];
39-
for (const [needle, label] of installPaths) {
40-
assert.ok(readme.includes(needle), `README must document ${label}`);
58+
]) {
59+
assert.ok(installSection.includes(needle), `README must document ${label}`);
4160
}
4261

43-
assert.ok(
44-
!/npm\s+install\s+(?:-g|--global)\s+json2sql(?![\w-])/i.test(readme),
45-
"README must not advertise `npm install -g json2sql`: npm `json2sql` is an unrelated third-party package"
46-
);
62+
const fencedBlocks = [
63+
...readme.matchAll(/^```[^\n]*\n([\s\S]*?)^```[ \t]*$/gm),
64+
].map((match) => match[1]);
65+
66+
const forbiddenNpmUsage = [
67+
[/\bnpm\s+(?:install|i|add|exec|x|dlx)\b[^\n]*\bjson2sql(?:-cli)?(?![\w.-])/i, "npm"],
68+
[/\bnpx\b[^\n]*\bjson2sql(?:-cli)?(?![\w.-])/i, "npx"],
69+
[
70+
/\b(?:pnpm|yarn)\s+(?:add|global\s+add|dlx)\b[^\n]*\bjson2sql(?:-cli)?(?![\w.-])/i,
71+
"pnpm/yarn",
72+
],
73+
];
74+
75+
const sources = [
76+
["README.md", readme],
77+
...fencedBlocks.map((block, index) => [`README.md fenced code block ${index + 1}`, block]),
78+
];
79+
for (const [sourceName, source] of sources) {
80+
for (const [pattern, runner] of forbiddenNpmUsage) {
81+
assert.ok(
82+
!pattern.test(source),
83+
`${sourceName} must not use \`${runner}\` to install or run json2sql: npm \`json2sql\` is an unrelated third-party package and this project publishes no npm package`
84+
);
85+
}
86+
}
4787
});

0 commit comments

Comments
 (0)