File: TestQuickJSWASMModule.md

package info (click to toggle)
node-quickjs-emscripten 0.23.0%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,900 kB
  • sloc: ansic: 71,457; javascript: 7,638; makefile: 506; sh: 153
file content (172 lines) | stat: -rw-r--r-- 3,608 bytes parent folder | download
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
[quickjs-emscripten](../README.md) / [Exports](../modules.md) / TestQuickJSWASMModule

# Class: TestQuickJSWASMModule

A test wrapper of [QuickJSWASMModule](QuickJSWASMModule.md) that keeps a reference to each
context or runtime created.

Call [disposeAll](TestQuickJSWASMModule.md#disposeall) to reset these sets and calls `dispose` on any left alive
(which may throw an error).

Call [assertNoMemoryAllocated](TestQuickJSWASMModule.md#assertnomemoryallocated) at the end of a test, when you expect that you've
freed all the memory you've ever allocated.

## Implements

- `Pick`<[`QuickJSWASMModule`](QuickJSWASMModule.md), keyof [`QuickJSWASMModule`](QuickJSWASMModule.md)\>

## Table of contents

### Constructors

- [constructor](TestQuickJSWASMModule.md#constructor)

### Properties

- [contexts](TestQuickJSWASMModule.md#contexts)
- [runtimes](TestQuickJSWASMModule.md#runtimes)

### Methods

- [assertNoMemoryAllocated](TestQuickJSWASMModule.md#assertnomemoryallocated)
- [disposeAll](TestQuickJSWASMModule.md#disposeall)
- [evalCode](TestQuickJSWASMModule.md#evalcode)
- [newContext](TestQuickJSWASMModule.md#newcontext)
- [newRuntime](TestQuickJSWASMModule.md#newruntime)

## Constructors

### constructor

• **new TestQuickJSWASMModule**(`parent`)

#### Parameters

| Name | Type |
| :------ | :------ |
| `parent` | [`QuickJSWASMModule`](QuickJSWASMModule.md) |

#### Defined in

[ts/module-test.ts:21](https://github.com/justjake/quickjs-emscripten/blob/main/ts/module-test.ts#L21)

## Properties

### contexts

• **contexts**: `Set`<[`QuickJSContext`](QuickJSContext.md)\>

#### Defined in

[ts/module-test.ts:19](https://github.com/justjake/quickjs-emscripten/blob/main/ts/module-test.ts#L19)

___

### runtimes

• **runtimes**: `Set`<[`QuickJSRuntime`](QuickJSRuntime.md)\>

#### Defined in

[ts/module-test.ts:20](https://github.com/justjake/quickjs-emscripten/blob/main/ts/module-test.ts#L20)

## Methods

### assertNoMemoryAllocated

▸ **assertNoMemoryAllocated**(): `void`

#### Returns

`void`

#### Defined in

[ts/module-test.ts:62](https://github.com/justjake/quickjs-emscripten/blob/main/ts/module-test.ts#L62)

___

### disposeAll

▸ **disposeAll**(): `void`

#### Returns

`void`

#### Defined in

[ts/module-test.ts:51](https://github.com/justjake/quickjs-emscripten/blob/main/ts/module-test.ts#L51)

___

### evalCode

▸ **evalCode**(`code`, `options?`): `unknown`

#### Parameters

| Name | Type |
| :------ | :------ |
| `code` | `string` |
| `options?` | [`ModuleEvalOptions`](../interfaces/ModuleEvalOptions.md) |

#### Returns

`unknown`

#### Implementation of

Pick.evalCode

#### Defined in

[ts/module-test.ts:47](https://github.com/justjake/quickjs-emscripten/blob/main/ts/module-test.ts#L47)

___

### newContext

▸ **newContext**(`options?`): [`QuickJSContext`](QuickJSContext.md)

#### Parameters

| Name | Type |
| :------ | :------ |
| `options?` | [`ContextOptions`](../interfaces/ContextOptions.md) |

#### Returns

[`QuickJSContext`](QuickJSContext.md)

#### Implementation of

Pick.newContext

#### Defined in

[ts/module-test.ts:35](https://github.com/justjake/quickjs-emscripten/blob/main/ts/module-test.ts#L35)

___

### newRuntime

▸ **newRuntime**(`options?`): [`QuickJSRuntime`](QuickJSRuntime.md)

#### Parameters

| Name | Type |
| :------ | :------ |
| `options?` | [`RuntimeOptions`](../interfaces/RuntimeOptions.md) |

#### Returns

[`QuickJSRuntime`](QuickJSRuntime.md)

#### Implementation of

Pick.newRuntime

#### Defined in

[ts/module-test.ts:23](https://github.com/justjake/quickjs-emscripten/blob/main/ts/module-test.ts#L23)