Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create E2E tests for Bicep CLI commands #938

Merged
merged 5 commits into from
Nov 18, 2020
Merged

Conversation

shenglol
Copy link
Contributor

Closes #381.

"version": "1.0.0",
"private": true,
"dependencies": {},
"devDependencies": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you'll need to add this path to https://github.com/Azure/bicep/blob/main/.github/dependabot.yml

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know! I added it to the dependabot file.

const exampleBicepFile = path.join(exampleDirectory, "main.bicep");
const exampleJsonFile = path.join(exampleDirectory, "main.json");

describe("bicep build", () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

describe [](start = 0, length = 8)

We should also do a failed build test to make sure we're logging warnings and errors to stderr.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good pt. Added a test.

@codecov-io
Copy link

codecov-io commented Nov 18, 2020

Codecov Report

Merging #938 (b088bdd) into main (2d1f43e) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #938   +/-   ##
=======================================
  Coverage   94.55%   94.55%           
=======================================
  Files         302      302           
  Lines       13682    13682           
  Branches       12       12           
=======================================
  Hits        12937    12937           
  Misses        745      745           
Flag Coverage Δ
dotnet 95.20% <ø> (ø)
typescript 25.78% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@@ -64,6 +64,12 @@ jobs:
- name: Publish Bicep
run: dotnet publish --configuration ${{ matrix.configuration }} --self-contained true -p:PublishTrimmed=true -p:PublishSingleFile=true -r ${{ matrix.rid }} ./src/Bicep.Cli/Bicep.Cli.csproj

- name: Run Bicep E2E Tests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name [](start = 8, length = 4)

Is it possible to also upload coverage data from this npm run as well?

Copy link
Contributor Author

@shenglol shenglol Nov 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is possible and easy to collect and upload coverage data because we are using jest, but does it make sense to do so? We are testing a binary file and the coverage will be 0 for sure (unless we want to cheat by including the test files themselves :p).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're kind of all over the place in that regard. (c# info includes test code as well). I'm fine skipping that for now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the future we could split and tag test code coverage separately. It sometimes can be useful to see coverage highlights there, but it's pretty rare.

@shenglol shenglol merged commit b4b8b32 into main Nov 18, 2020
@shenglol shenglol deleted the shenglol/cli-e2e-tests branch November 18, 2020 03:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add end-to-end tests for CLI commands
4 participants