wesl 0.6.48 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/dist/index.d.ts +295 -214
  2. package/dist/index.js +2947 -1550
  3. package/package.json +6 -8
  4. package/src/AbstractElems.ts +81 -81
  5. package/src/Assertions.ts +5 -5
  6. package/src/BindIdents.ts +193 -319
  7. package/src/ClickableError.ts +3 -2
  8. package/src/Conditions.ts +2 -2
  9. package/src/LinkedWesl.ts +1 -1
  10. package/src/Linker.ts +4 -3
  11. package/src/LinkerUtil.ts +1 -1
  12. package/src/Logging.ts +165 -0
  13. package/src/LowerAndEmit.ts +278 -110
  14. package/src/ModulePathUtil.ts +59 -0
  15. package/src/ModuleResolver.ts +26 -62
  16. package/src/ParseError.ts +9 -0
  17. package/src/ParseWESL.ts +30 -94
  18. package/src/RawEmit.ts +1 -4
  19. package/src/Reflection.ts +1 -1
  20. package/src/Scope.ts +3 -0
  21. package/src/Span.ts +2 -0
  22. package/src/SrcMap.ts +208 -0
  23. package/src/Stream.ts +30 -0
  24. package/src/TransformBindingStructs.ts +2 -2
  25. package/src/Util.ts +1 -1
  26. package/src/debug/ASTtoString.ts +84 -135
  27. package/src/discovery/FindUnboundIdents.ts +14 -5
  28. package/src/index.ts +5 -0
  29. package/src/parse/ContentsHelpers.ts +70 -0
  30. package/src/parse/ExpressionUtil.ts +121 -0
  31. package/src/parse/Keywords.ts +12 -12
  32. package/src/parse/OperatorBinding.ts +146 -0
  33. package/src/parse/ParseAttribute.ts +272 -0
  34. package/src/parse/ParseCall.ts +77 -0
  35. package/src/parse/ParseControlFlow.ts +129 -0
  36. package/src/parse/ParseDirective.ts +105 -0
  37. package/src/parse/ParseExpression.ts +288 -0
  38. package/src/parse/ParseFn.ts +151 -0
  39. package/src/parse/ParseGlobalVar.ts +131 -0
  40. package/src/parse/ParseIdent.ts +77 -0
  41. package/src/parse/ParseImport.ts +160 -0
  42. package/src/parse/ParseLocalVar.ts +69 -0
  43. package/src/parse/ParseLoop.ts +112 -0
  44. package/src/parse/ParseModule.ts +116 -0
  45. package/src/parse/ParseSimpleStatement.ts +162 -0
  46. package/src/parse/ParseStatement.ts +215 -0
  47. package/src/parse/ParseStruct.ts +89 -0
  48. package/src/parse/ParseType.ts +71 -0
  49. package/src/parse/ParseUtil.ts +174 -0
  50. package/src/parse/ParseValueDeclaration.ts +130 -0
  51. package/src/parse/ParseWesl.ts +51 -0
  52. package/src/parse/ParsingContext.ts +93 -0
  53. package/src/parse/WeslStream.ts +63 -20
  54. package/src/parse/stream/CachingStream.ts +48 -0
  55. package/src/parse/stream/MatchersStream.ts +85 -0
  56. package/src/parse/stream/RegexHelpers.ts +38 -0
  57. package/src/test/BevyLink.test.ts +100 -0
  58. package/src/test/BindStdTypes.test.ts +110 -0
  59. package/src/test/{BindWESL.test.ts → BindWESLV2.test.ts} +21 -22
  60. package/src/test/BulkTests.test.ts +11 -12
  61. package/src/test/ConditionLinking.test.ts +107 -0
  62. package/src/test/ConditionalElif.test.ts +1 -13
  63. package/src/test/ConditionalTranslationCases.test.ts +5 -0
  64. package/src/test/ErrorLogging.test.ts +2 -2
  65. package/src/test/ImportCasesV2.test.ts +63 -0
  66. package/src/test/LinkFails.test.ts +69 -0
  67. package/src/test/LinkPackage.test.ts +1 -1
  68. package/src/test/Linker.test.ts +75 -2
  69. package/src/test/LogCatcher.ts +53 -0
  70. package/src/test/Mangling.test.ts +1 -1
  71. package/src/test/ParseComments.test.ts +1 -2
  72. package/src/test/{ParseConditions.test.ts → ParseConditionsV2.test.ts} +57 -49
  73. package/src/test/ParseErrorV2.test.ts +73 -0
  74. package/src/test/{ParseWESL.test.ts → ParseWeslV2.test.ts} +288 -370
  75. package/src/test/{ScopeWESL.test.ts → ScopeWESLV2.test.ts} +205 -176
  76. package/src/test/TestLink.ts +51 -51
  77. package/src/test/TestSetup.ts +9 -3
  78. package/src/test/TestUtil.ts +47 -77
  79. package/src/test/TrimmedMatch.ts +40 -0
  80. package/src/test/VirtualModules.test.ts +33 -2
  81. package/src/test/WeslDevice.test.ts +9 -2
  82. package/src/test/__snapshots__/ParseWeslV2.test.ts.snap +67 -0
  83. package/src/test-util.ts +7 -0
  84. package/src/WESLCollect.ts +0 -656
  85. package/src/parse/AttributeGrammar.ts +0 -232
  86. package/src/parse/ImportGrammar.ts +0 -195
  87. package/src/parse/WeslBaseGrammar.ts +0 -11
  88. package/src/parse/WeslExpression.ts +0 -231
  89. package/src/parse/WeslGrammar.ts +0 -739
  90. package/src/test/Expression.test.ts +0 -22
  91. package/src/test/ImportSyntaxCases.test.ts +0 -24
  92. package/src/test/ParseError.test.ts +0 -45
  93. package/src/test/Reflection.test.ts +0 -176
  94. package/src/test/TransformBindingStructs.test.ts +0 -238
  95. /package/src/test/{ParseElif.test.ts → ParseElifV2.test.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wesl",
3
- "version": "0.6.48",
3
+ "version": "0.7.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -17,11 +17,8 @@
17
17
  }
18
18
  },
19
19
  "types": "dist/index.d.ts",
20
- "dependencies": {
21
- "mini-parse": "0.6.41"
22
- },
23
20
  "devDependencies": {
24
- "@types/brotli": "^1.3.4",
21
+ "@rollup/plugin-replace": "^6.0.3",
25
22
  "multi_pkg": "x",
26
23
  "random_wgsl": "x",
27
24
  "terser": "^5.43.1",
@@ -37,13 +34,14 @@
37
34
  ],
38
35
  "scripts": {
39
36
  "build": "tsdown",
40
- "build:brotli-size": "./scripts/brotli.ts dist/sized.cjs",
41
37
  "build:docs": "typedoc --plugin typedoc-theme-hierarchy --entryPoints ./src/index.ts --entryPointStrategy expand --out ./docs",
42
- "build:size": "run-s build:sizetest build:brotli-size",
43
- "build:sizetest": "vite build --config sizetest.vite.config.js",
38
+ "build:nodebug": "vite build --config vite.nodebug.config.ts",
39
+ "build:size": "./scripts/size-check.ts",
44
40
  "deploy:docsite": "run-s build:docs pages:deploy",
45
41
  "pages:deploy": "wrangler pages deploy --project-name wesl-js docs",
46
42
  "test": "vitest --hideSkippedTests",
43
+ "test:cts": "./scripts/test-cts.ts",
44
+ "test:nodebug": "vitest run --config vitest.nodebug.config.ts",
47
45
  "test:once": "vitest run",
48
46
  "typecheck": "tsgo"
49
47
  },
@@ -1,17 +1,13 @@
1
- import type { Span } from "mini-parse";
2
1
  import type { DeclIdent, RefIdent, Scope, SrcModule } from "./Scope.ts";
2
+ import type { Span } from "./Span.ts";
3
3
 
4
4
  /**
5
- * Structures to describe the 'interesting' parts of a WESL source file.
5
+ * AST structures describing 'interesting' parts of WESL source.
6
6
  *
7
- * The parts of the source that need to analyze further in the linker
8
- * are pulled out into these structures.
9
- *
10
- * The parts that are uninteresting the the linker are recorded
11
- * as 'TextElem' nodes, which are generally just copied to the output WGSL
12
- * along with their containing element.
7
+ * Parts needing further analysis are pulled into these structures.
8
+ * Uninteresting parts are 'TextElem' nodes, copied to output WGSL.
13
9
  */
14
- export type AbstractElem = GrammarElem | SyntheticElem;
10
+ export type AbstractElem = GrammarElem | SyntheticElem | ExpressionElem;
15
11
 
16
12
  export type GrammarElem = ContainerElem | TerminalElem;
17
13
 
@@ -20,6 +16,7 @@ export type ContainerElem =
20
16
  | AliasElem
21
17
  | ConstAssertElem
22
18
  | ConstElem
19
+ | ContinuingElem
23
20
  | UnknownExpressionElem
24
21
  | SimpleMemberRef
25
22
  | FnElem
@@ -37,11 +34,29 @@ export type ContainerElem =
37
34
  | StatementElem
38
35
  | SwitchClauseElem;
39
36
 
37
+ /** Map from element kind string to element type, for type-safe element construction. */
38
+ export type ElemKindMap = {
39
+ alias: AliasElem;
40
+ assert: ConstAssertElem;
41
+ const: ConstElem;
42
+ continuing: ContinuingElem;
43
+ gvar: GlobalVarElem;
44
+ let: LetElem;
45
+ member: StructMemberElem;
46
+ override: OverrideElem;
47
+ param: FnParamElem;
48
+ statement: StatementElem;
49
+ struct: StructElem;
50
+ "switch-clause": SwitchClauseElem;
51
+ type: TypeRefElem;
52
+ var: VarElem;
53
+ };
54
+
40
55
  /** Inspired by https://github.com/wgsl-tooling-wg/wesl-rs/blob/3b2434eac1b2ebda9eb8bfb25f43d8600d819872/crates/wgsl-parse/src/syntax.rs#L364 */
41
56
  export type ExpressionElem =
42
57
  | Literal
43
- | TranslateTimeFeature
44
58
  | RefIdentElem
59
+ | TypeRefElem // template_elaborated_ident is a primary_expression
45
60
  | ParenthesizedExpression
46
61
  | ComponentExpression
47
62
  | ComponentMemberExpression
@@ -65,7 +80,11 @@ export type GlobalDeclarationElem =
65
80
  | OverrideElem
66
81
  | StructElem;
67
82
 
68
- export type DeclarationElem = GlobalDeclarationElem | FnParamElem | VarElem;
83
+ export type DeclarationElem =
84
+ | GlobalDeclarationElem
85
+ | FnParamElem
86
+ | VarElem
87
+ | LetElem;
69
88
 
70
89
  export type ElemWithAttributes = Extract<AbstractElem, HasAttributes>;
71
90
 
@@ -85,23 +104,13 @@ export interface HasAttributes {
85
104
 
86
105
  /* ------ Terminal Elements (don't contain other elements) ------ */
87
106
 
88
- /**
89
- * a raw bit of text in WESL source that's typically copied to the linked WGSL.
90
- * e.g. a keyword like 'var'
91
- * or a phrase we needn't analyze further like '@diagnostic(off,derivative_uniformity)'
92
- */
107
+ /** Raw text copied to linked WGSL (e.g., 'var' or '@diagnostic(off,derivative_uniformity)'). */
93
108
  export interface TextElem extends AbstractElemBase {
94
109
  kind: "text";
95
110
  srcModule: SrcModule;
96
111
  }
97
112
 
98
- /** a name that doesn't need to be an Ident
99
- * e.g.
100
- * - a struct member name
101
- * - a diagnostic rule name
102
- * - an enable-extension name
103
- * - an interpolation sampling name
104
- */
113
+ /** A name that doesn't need to be an Ident (e.g., struct member, diagnostic rule). */
105
114
  export interface NameElem extends AbstractElemBase {
106
115
  kind: "name";
107
116
  name: string;
@@ -127,47 +136,35 @@ export interface ImportElem extends AbstractElemBase, HasAttributes {
127
136
  imports: ImportStatement;
128
137
  }
129
138
 
130
- /**
131
- * An import statement, which is tree shaped.
132
- * `import foo::bar::{baz, cat as neko};
133
- */
139
+ /** Tree-shaped import statement: `import foo::bar::{baz, cat as neko};` */
134
140
  export interface ImportStatement {
135
141
  kind: "import-statement";
136
142
  segments: ImportSegment[];
137
143
  finalSegment: ImportCollection | ImportItem;
138
144
  }
139
145
 
140
- /**
141
- * A collection of import trees.
142
- * `{baz, cat as neko}`
143
- */
146
+ /** A segment in an import path: `foo` in `foo::bar`. */
144
147
  export interface ImportSegment {
145
148
  kind: "import-segment";
146
149
  name: string;
147
150
  }
148
151
 
149
- /**
150
- * A primitive segment in an import statement.
151
- * `foo`
152
- */
152
+ /** A collection of import trees: `{baz, cat as neko}`. */
153
153
  export interface ImportCollection {
154
154
  kind: "import-collection";
155
155
  subtrees: ImportStatement[];
156
156
  }
157
157
 
158
- /**
159
- * A renamed item at the end of an import statement.
160
- * `cat as neko`
161
- */
158
+ /** A renamed item at the end of an import statement: `cat as neko`. */
162
159
  export interface ImportItem {
163
160
  kind: "import-item";
164
161
  name: string;
165
162
  as?: string;
166
163
  }
167
164
 
168
- /* ------ Synthetic element (for transformations, not produced by grammar) ------ */
165
+ /* ------ Synthetic element (for transformations, not from grammar) ------ */
169
166
 
170
- /** generated element, produced after parsing and binding */
167
+ /** Generated element produced after parsing and binding. */
171
168
  export interface SyntheticElem {
172
169
  kind: "synthetic";
173
170
  text: string;
@@ -175,7 +172,7 @@ export interface SyntheticElem {
175
172
 
176
173
  /* ------ Container Elements (contain other elements) ------ */
177
174
 
178
- /** a declaration identifer with a possible type */
175
+ /** A declaration identifier with an optional type. */
179
176
  export interface TypedDeclElem extends ElemWithContentsBase {
180
177
  kind: "typeDecl";
181
178
  decl: DeclIdentElem;
@@ -183,14 +180,14 @@ export interface TypedDeclElem extends ElemWithContentsBase {
183
180
  typeScope?: Scope;
184
181
  }
185
182
 
186
- /** an alias statement */
183
+ /** An alias statement. */
187
184
  export interface AliasElem extends ElemWithContentsBase, HasAttributes {
188
185
  kind: "alias";
189
186
  name: DeclIdentElem;
190
187
  typeRef: TypeRefElem;
191
188
  }
192
189
 
193
- /** an attribute like '@compute' or '@binding(0)' */
190
+ /** An attribute like '@compute' or '@binding(0)'. */
194
191
  export interface AttributeElem extends ElemWithContentsBase {
195
192
  kind: "attribute";
196
193
  attribute: Attribute;
@@ -221,10 +218,12 @@ export interface BuiltinAttribute {
221
218
  param: NameElem;
222
219
  }
223
220
 
221
+ export type DiagnosticRule = [NameElem, NameElem | null];
222
+
224
223
  export interface DiagnosticAttribute {
225
224
  kind: "@diagnostic";
226
225
  severity: NameElem;
227
- rule: [NameElem, NameElem | null];
226
+ rule: DiagnosticRule;
228
227
  }
229
228
 
230
229
  export interface IfAttribute {
@@ -241,82 +240,77 @@ export interface ElseAttribute {
241
240
  kind: "@else";
242
241
  }
243
242
 
244
- /** a const_assert statement */
243
+ export type ConditionalAttribute = IfAttribute | ElifAttribute | ElseAttribute;
244
+
245
+ /** A const_assert statement. */
245
246
  export interface ConstAssertElem extends ElemWithContentsBase, HasAttributes {
246
247
  kind: "assert";
247
248
  }
248
249
 
249
- /** a const declaration */
250
+ /** A const declaration. */
250
251
  export interface ConstElem extends ElemWithContentsBase, HasAttributes {
251
252
  kind: "const";
252
253
  name: TypedDeclElem;
253
254
  }
254
255
 
255
- /** an expression w/o special handling, used inside attribute parameters */
256
+ /** An expression without special handling, used in attribute parameters. */
256
257
  export interface UnknownExpressionElem extends ElemWithContentsBase {
257
258
  kind: "expression";
258
259
  }
259
260
 
260
- /** an expression that can be safely evaluated at compile time */
261
+ /** An expression that can be safely evaluated at compile time. */
261
262
  export interface TranslateTimeExpressionElem {
262
263
  kind: "translate-time-expression";
263
264
  expression: ExpressionElem;
264
265
  span: Span;
265
266
  }
266
267
 
267
- /** A literal value in WESL source. A boolean or a number. */
268
- export interface Literal {
268
+ /** A literal value (boolean or number) in WESL source. */
269
+ export interface Literal extends AbstractElemBase {
269
270
  kind: "literal";
270
271
  value: string;
271
- span: Span;
272
- }
273
-
274
- /** `words`s inside `@if` */
275
- export interface TranslateTimeFeature {
276
- kind: "translate-time-feature";
277
- name: string;
278
- span: Span;
279
272
  }
280
273
 
281
274
  /** (expr) */
282
- export interface ParenthesizedExpression {
275
+ export interface ParenthesizedExpression extends AbstractElemBase {
283
276
  kind: "parenthesized-expression";
284
277
  expression: ExpressionElem;
285
278
  }
286
279
 
287
280
  /** `foo[expr]` */
288
- export interface ComponentExpression {
281
+ export interface ComponentExpression extends AbstractElemBase {
289
282
  kind: "component-expression";
290
283
  base: ExpressionElem;
291
284
  access: ExpressionElem;
292
285
  }
293
286
 
294
287
  /** `foo.member` */
295
- export interface ComponentMemberExpression {
288
+ export interface ComponentMemberExpression extends AbstractElemBase {
296
289
  kind: "component-member-expression";
297
290
  base: ExpressionElem;
298
291
  access: NameElem;
299
292
  }
300
293
 
301
294
  /** `+foo` */
302
- export interface UnaryExpression {
295
+ export interface UnaryExpression extends AbstractElemBase {
303
296
  kind: "unary-expression";
304
297
  operator: UnaryOperator;
305
298
  expression: ExpressionElem;
306
299
  }
307
300
 
308
301
  /** `foo + bar` */
309
- export interface BinaryExpression {
302
+ export interface BinaryExpression extends AbstractElemBase {
310
303
  kind: "binary-expression";
311
304
  operator: BinaryOperator;
312
305
  left: ExpressionElem;
313
306
  right: ExpressionElem;
314
307
  }
315
308
 
316
- /** `foo(arg, arg)` */
317
- export interface FunctionCallExpression {
309
+ /** `foo<T>(arg, arg)` */
310
+ export interface FunctionCallExpression extends AbstractElemBase {
318
311
  kind: "call-expression";
319
- function: RefIdentElem;
312
+ function: RefIdentElem | TypeRefElem; // template_elaborated_ident
313
+ templateArgs?: TypeTemplateParameter[];
320
314
  arguments: ExpressionElem[];
321
315
  }
322
316
 
@@ -359,7 +353,7 @@ export interface RequiresDirective {
359
353
  extensions: NameElem[];
360
354
  }
361
355
 
362
- /** a function declaration */
356
+ /** A function declaration. */
363
357
  export interface FnElem extends ElemWithContentsBase, HasAttributes {
364
358
  // LATER doesn't need contents
365
359
  kind: "fn";
@@ -370,31 +364,30 @@ export interface FnElem extends ElemWithContentsBase, HasAttributes {
370
364
  returnType?: TypeRefElem;
371
365
  }
372
366
 
373
- /** a global variable declaration (at the root level) */
367
+ /** A global variable declaration (at the root level). */
374
368
  export interface GlobalVarElem extends ElemWithContentsBase, HasAttributes {
375
369
  kind: "gvar";
376
370
  name: TypedDeclElem;
377
371
  }
378
372
 
379
- /** an entire file */
373
+ /** An entire file. */
380
374
  export interface ModuleElem extends ElemWithContentsBase {
381
375
  kind: "module";
382
376
  }
383
377
 
384
- /** an override declaration */
378
+ /** An override declaration. */
385
379
  export interface OverrideElem extends ElemWithContentsBase, HasAttributes {
386
380
  kind: "override";
387
381
  name: TypedDeclElem;
388
382
  }
389
383
 
390
- /** a parameter in a function declaration */
384
+ /** A parameter in a function declaration. */
391
385
  export interface FnParamElem extends ElemWithContentsBase, HasAttributes {
392
386
  kind: "param";
393
387
  name: TypedDeclElem;
394
388
  }
395
389
 
396
- /** simple references to structures, like myStruct.bar
397
- * (used for transforming refs to binding structs) */
390
+ /** Simple struct references like `myStruct.bar` (for binding struct transforms). */
398
391
  export interface SimpleMemberRef extends ElemWithContentsBase {
399
392
  kind: "memberRef";
400
393
  name: RefIdentElem;
@@ -402,7 +395,7 @@ export interface SimpleMemberRef extends ElemWithContentsBase {
402
395
  extraComponents?: StuffElem;
403
396
  }
404
397
 
405
- /** a struct declaration */
398
+ /** A struct declaration. */
406
399
  export interface StructElem extends ElemWithContentsBase, HasAttributes {
407
400
  kind: "struct";
408
401
  name: DeclIdentElem;
@@ -410,18 +403,18 @@ export interface StructElem extends ElemWithContentsBase, HasAttributes {
410
403
  bindingStruct?: true; // used later during binding struct transformation
411
404
  }
412
405
 
413
- /** generic container of other elements */
406
+ /** Generic container of other elements. */
414
407
  export interface StuffElem extends ElemWithContentsBase {
415
408
  kind: "stuff";
416
409
  }
417
410
 
418
- /** a struct declaration that's been marked as a bindingStruct */
411
+ /** A struct declaration marked as a binding struct. */
419
412
  export interface BindingStructElem extends StructElem {
420
413
  bindingStruct: true;
421
414
  entryFn?: FnElem;
422
415
  }
423
416
 
424
- /** a member of a struct declaration */
417
+ /** A member of a struct declaration. */
425
418
  export interface StructMemberElem extends ElemWithContentsBase, HasAttributes {
426
419
  kind: "member";
427
420
  name: NameElem;
@@ -429,16 +422,16 @@ export interface StructMemberElem extends ElemWithContentsBase, HasAttributes {
429
422
  mangledVarName?: string; // root name if transformed to a var (for binding struct transformation)
430
423
  }
431
424
 
432
- export type TypeTemplateParameter = TypeRefElem | UnknownExpressionElem;
425
+ export type TypeTemplateParameter = ExpressionElem;
433
426
 
434
- /** a reference to a type, like 'f32', or 'MyStruct', or 'ptr<storage, array<f32>, read_only>' */
427
+ /** A type reference like 'f32', 'MyStruct', or 'ptr<storage, array<f32>, read_only>'. */
435
428
  export interface TypeRefElem extends ElemWithContentsBase {
436
429
  kind: "type";
437
430
  name: RefIdent;
438
431
  templateParams?: TypeTemplateParameter[];
439
432
  }
440
433
 
441
- /** a variable declaration */
434
+ /** A variable declaration. */
442
435
  export interface VarElem extends ElemWithContentsBase, HasAttributes {
443
436
  kind: "var";
444
437
  name: TypedDeclElem;
@@ -453,6 +446,13 @@ export interface StatementElem extends ElemWithContentsBase, HasAttributes {
453
446
  kind: "statement";
454
447
  }
455
448
 
449
+ export interface ContinuingElem extends ElemWithContentsBase, HasAttributes {
450
+ kind: "continuing";
451
+ }
452
+
453
+ /** Statement or continuing - used in loop body parsing. */
454
+ export type BlockStatement = StatementElem | ContinuingElem;
455
+
456
456
  export interface SwitchClauseElem extends ElemWithContentsBase, HasAttributes {
457
457
  kind: "switch-clause";
458
458
  }
package/src/Assertions.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { tracing } from "mini-parse";
1
+ import { debug } from "./Logging.ts";
2
2
 
3
3
  /** checks whether a condition is true, otherwise throws */
4
4
  export function assertThat(condition: any, msg?: string): asserts condition {
@@ -7,17 +7,17 @@ export function assertThat(condition: any, msg?: string): asserts condition {
7
7
  }
8
8
  }
9
9
 
10
- /** when debug testing is enabled, checks whether a condition is true, otherwise throws */
10
+ /** when debug is enabled, checks whether a condition is true, otherwise throws */
11
11
  export function assertThatDebug(
12
12
  condition: any,
13
13
  msg?: string,
14
14
  ): asserts condition {
15
- if (tracing) assertThat(condition, msg);
15
+ if (debug) assertThat(condition, msg);
16
16
  }
17
17
 
18
- /** when debug testing is enabled throw an error */
18
+ /** when debug is enabled throw an error */
19
19
  export function failDebug(msg = "FAIL"): void {
20
- if (tracing) throw new Error(msg);
20
+ if (debug) throw new Error(msg);
21
21
  }
22
22
 
23
23
  /**