Skip to content

Commit 4383911

Browse files
committed
feat: add custom codecov
1 parent d9becfc commit 4383911

File tree

2 files changed

+29
-32
lines changed

2 files changed

+29
-32
lines changed

.github/codecov.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
codecov:
2+
require_ci_to_pass: yes
3+
allow_coverage_offsets: True
4+
5+
coverage:
6+
precision: 2
7+
round: down
8+
range: "70...100"
9+
10+
parsers:
11+
gcov:
12+
branch_detection:
13+
conditional: yes
14+
loop: yes
15+
method: no
16+
macro: no
17+
18+
comment:
19+
layout: "reach,diff,flags,files,footer"
20+
behavior: default
21+
require_changes: no

test/browser/pages/login.test.ts

+8-32
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,14 @@ describe("login", () => {
2525
// Create a fake element and set the attribute
2626
const mockElement = document.createElement("input")
2727
mockElement.setAttribute("id", "base")
28-
mockElement.setAttribute(
29-
"data-settings",
30-
'{"base":"./hello-world","csStaticBase":"./static/development/Users/jp/Dev/code-server","logLevel":2,"disableTelemetry":false,"disableUpdateCheck":false}',
31-
)
28+
const expected = {
29+
base: "./hello-world",
30+
csStaticBase: "./static/development/Users/jp/Dev/code-server",
31+
logLevel: 2,
32+
disableTelemetry: false,
33+
disableUpdateCheck: false,
34+
}
35+
mockElement.setAttribute("data-settings", JSON.stringify(expected))
3236
document.body.appendChild(mockElement)
3337
spy.mockImplementation(() => mockElement)
3438
// Load file
@@ -38,32 +42,4 @@ describe("login", () => {
3842
expect(el?.value).toBe("/hello-world")
3943
})
4044
})
41-
42-
describe("there is no element with id 'base'", () => {
43-
let initialDom: Document
44-
beforeEach(() => {
45-
const dom = new JSDOM()
46-
initialDom = dom.window.document
47-
global.document = dom.window.document
48-
49-
const location: LocationLike = {
50-
pathname: "/healthz",
51-
origin: "http://localhost:8080",
52-
}
53-
54-
global.location = location as Location
55-
})
56-
afterEach(() => {
57-
// Reset the global.document
58-
global.document = undefined as any as Document
59-
global.location = undefined as any as Location
60-
})
61-
62-
it("should not change the DOM", () => {
63-
// Load file
64-
require("../../../src/browser/pages/login")
65-
const currentDom = global.document
66-
expect(initialDom).toBe(currentDom)
67-
})
68-
})
6945
})

0 commit comments

Comments
 (0)