Skip to content

Commit 0c34965

Browse files
authored
Merge pull request #47 from embroider-build/acceptance-test
provide a basic acceptance test
2 parents 1de0c2e + ecec6e9 commit 0c34965

File tree

3 files changed

+41
-1
lines changed

3 files changed

+41
-1
lines changed

.github/workflows/ci.yml

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ jobs:
4343
cache: pnpm
4444
- run: pnpm install
4545
- run: pnpm build
46+
- run: git fetch --all && git fetch --unshallow # this is to work for the acceptance tests
4647
- run: pnpm test
4748
env:
4849
GITHUB_API_URL: ""
50+
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }} #this is for acceptance tests

tests/basic-acceptance.test.js

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { describe, it, vi } from "vitest";
2+
import execa from "execa";
3+
import { expect } from "vitest";
4+
5+
if (!process.env.GITHUB_AUTH) {
6+
console.warn("Warning: to run all tests you need to provide a GITHUB_AUTH");
7+
}
8+
9+
describe("command line interface", () => {
10+
it.skipIf(!process.env.GITHUB_AUTH)("can produce a result", async () => {
11+
const { stdout } = await execa.node("./bin/cli.js", [
12+
"--from=ee1c697fcf871114c53e9847c43e221d3056f19d",
13+
"--to=b20002d9760e9e212bc623c8f3f42931ddc01bda",
14+
]);
15+
16+
expect(stdout).toMatchInlineSnapshot(`
17+
"
18+
## Unreleased (2025-03-05)
19+
20+
#### :rocket: Enhancement
21+
* \`github-changelog\`
22+
* [#33](https://github.com/embroider-build/github-changelog/pull/33) support github enterpise url detection and env vars ([@patricklx](https://github.com/patricklx))
23+
24+
#### Committers: 1
25+
- Patrick Pircher ([@patricklx](https://github.com/patricklx))
26+
27+
28+
## v1.1.0-github-changelog (2025-01-25)
29+
30+
#### :house: Internal
31+
* \`github-changelog\`
32+
* [#29](https://github.com/embroider-build/github-changelog/pull/29) Prepare Release ([@github-actions[bot]](https://github.com/apps/github-actions))
33+
34+
#### Committers: 1
35+
- [@github-actions[bot]](https://github.com/apps/github-actions)"
36+
`);
37+
});
38+
});

vitest.config.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ import { defineConfig } from 'vitest/config'
22

33
export default defineConfig({
44
test: {
5-
include: ['**/src/**/*.{test,spec}.[tj]s']
5+
include: ['**/src/**/*.{test,spec}.[tj]s', 'tests/**/*.js']
66
},
77
})

0 commit comments

Comments
 (0)