/
console.test.ts
72 lines (60 loc) · 1.43 KB
/
console.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/* eslint-disable no-console */
import { afterAll, beforeAll, it, describe, expect } from "vitest";
import { prettyDOM } from "@testing-library/dom";
// https://github.com/vitest-dev/vitest/issues/2765
it('regexp', () => {
console.log(/(?<char>\w)/)
})
// https://github.com/vitest-dev/vitest/issues/3934
it('html-raw', async () => {
console.log(`
<form>
<label for="email">Email Address</label>
<input name="email" />
<button>Submit</button>
</form>
`);
})
// https://github.com/vitest-dev/vitest/issues/1279
it('html-pretty', () => {
const div = document.createElement("div");
div.innerHTML = `
<form>
<label for="email">Email Address</label>
<input name="email" />
<button>Submit</button>
</form>
`.replaceAll(/\n */gm, ""); // strip new liens
console.log(prettyDOM(div))
})
beforeAll(() => {
console.log('beforeAll')
console.error('beforeAll')
})
afterAll(() => {
console.log('afterAll')
console.error('afterAll')
})
describe('suite', () => {
beforeAll(() => {
console.log('beforeAll')
console.error('beforeAll')
})
afterAll(() => {
console.log('afterAll')
console.error('afterAll')
})
describe('nested suite', () => {
beforeAll(() => {
console.log('beforeAll')
console.error('beforeAll')
})
afterAll(() => {
console.log('afterAll')
console.error('afterAll')
})
it('test', () => {
expect(true).toBe(true)
})
})
})