Skip to content

Commit

Permalink
Add CLI e2es for omit version
Browse files Browse the repository at this point in the history
  • Loading branch information
tobybessant committed Apr 21, 2024
1 parent 637a5fb commit 8c3a45c
Show file tree
Hide file tree
Showing 2 changed files with 155 additions and 0 deletions.
144 changes: 144 additions & 0 deletions e2e/npm-package/test/cli/__snapshots__/index.e2e.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,78 @@ https://www.npmjs.com/package/generate-license-file
"
`;

exports[`cli for a relative path omit-versions should match snapshot when --omit-versions is given 1`] = `
"This file was generated with the generate-license-file npm package!
https://www.npmjs.com/package/generate-license-file
The following npm package may be included in this product:
- dep-four
This package contains the following license and notice below:
# Dep Four
This license file is spelt \`LICENCE\`.
This license should be found.
-----------
The following npm package may be included in this product:
- dep-one
This package contains the following license and notice below:
# Dep One
This license file is spelt \`LICENSE.md\`.
This license should be found.
-----------
The following npm package may be included in this product:
- dep-three
This package contains the following license and notice below:
# Dep Three
This license file is spelt \`LICENSE\`.
This license should be found.
-----------
The following npm packages may be included in this product:
- dep-two
- dep-two-duplicate
These packages each contain the following license and notice below:
# Dep Two
This license file is spelt \`LICENCE.md\`.
This license should be found.
-----------
The following npm package may be included in this product:
- dep-five
This package contains the following license and notice below:
MIT
-----------
This file was generated with the generate-license-file npm package!
https://www.npmjs.com/package/generate-license-file
"
`;

exports[`cli for a relative path should match snapshot using -i and -o 1`] = `
"This file was generated with the generate-license-file npm package!
https://www.npmjs.com/package/generate-license-file
Expand Down Expand Up @@ -864,6 +936,78 @@ https://www.npmjs.com/package/generate-license-file
"
`;

exports[`cli for an absolute path omit-versions should match snapshot when --omit-versions is given 1`] = `
"This file was generated with the generate-license-file npm package!
https://www.npmjs.com/package/generate-license-file
The following npm package may be included in this product:
- dep-four
This package contains the following license and notice below:
# Dep Four
This license file is spelt \`LICENCE\`.
This license should be found.
-----------
The following npm package may be included in this product:
- dep-one
This package contains the following license and notice below:
# Dep One
This license file is spelt \`LICENSE.md\`.
This license should be found.
-----------
The following npm package may be included in this product:
- dep-three
This package contains the following license and notice below:
# Dep Three
This license file is spelt \`LICENSE\`.
This license should be found.
-----------
The following npm packages may be included in this product:
- dep-two
- dep-two-duplicate
These packages each contain the following license and notice below:
# Dep Two
This license file is spelt \`LICENCE.md\`.
This license should be found.
-----------
The following npm package may be included in this product:
- dep-five
This package contains the following license and notice below:
MIT
-----------
This file was generated with the generate-license-file npm package!
https://www.npmjs.com/package/generate-license-file
"
`;

exports[`cli for an absolute path should match snapshot using -i and -o 1`] = `
"This file was generated with the generate-license-file npm package!
https://www.npmjs.com/package/generate-license-file
Expand Down
11 changes: 11 additions & 0 deletions e2e/npm-package/test/cli/index.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,17 @@ describe("cli", () => {
});
});

describe("omit-versions", () => {
it("should match snapshot when --omit-versions is given", async () => {
await execAsync(
`npx generate-license-file --input ${input} --output ${output} --omit-versions`

Check warning

Code scanning / CodeQL

Shell command built from environment values Medium test

This shell command depends on an uncontrolled
absolute path
.
);

const result = await fs.readFile(output, "utf8");
expect(result).toMatchSnapshot();
});
});

describe("version", () => {
beforeEach(() => (requiresUnlink = false));

Expand Down

0 comments on commit 8c3a45c

Please sign in to comment.