Typescript
Typescript runs using JSDOM.
Version
Running on Node.js v20.0.0
Supported languages
Typescript
Testing framework
Special reminders and implementation details
Remember to always keep your scripts modular and make use of TypeScript's type annotations, interfaces, and other features for type safety. Utilize the Document Object Model (DOM) for manipulating and interacting with web page elements, ensuring that you use type guards when necessary.
ts
import { createHeader } from './helloWorld';
describe('helloWorld.ts', () => {
beforeEach(() => {
document.documentElement.innerHTML = global.htmlContent;
});
test("Should create a h1 with text Hello World!", () => {
createHeader();
const header = document.querySelector('h1');
expect(header.textContent.trim()).toEqual("Hello World!");
});
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15