Skip to content

Commit

Permalink
Freeze Assert, ModuleContext and TestContext
Browse files Browse the repository at this point in the history
  • Loading branch information
izelnakri committed Jul 30, 2023
1 parent 790b102 commit 9c81523
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions shims/deno/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ Assert.AssertionError = AssertionError;
ModuleContext.Assert = Assert;
TestContext.Assert = Assert;

Object.freeze(Assert);
Object.freeze(ModuleContext);
Object.freeze(TestContext);

export const module = Module;
export const test = Test;

Expand Down
5 changes: 5 additions & 0 deletions shims/node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@ import Test from './test.js';

Assert.QUnit = QUnit;
Assert.AssertionError = AssertionError;

ModuleContext.Assert = Assert;
TestContext.Assert = Assert;

Object.freeze(Assert);
Object.freeze(ModuleContext);
Object.freeze(TestContext);

export const module = Module;
export const test = Test;

Expand Down
2 changes: 2 additions & 0 deletions shims/shared/module-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,7 @@ export default class ModuleContext {
this.moduleChain = ModuleContext.currentModuleChain.slice(0);
this.name = parentModule ? `${parentModule.name} > ${name}` : name;
this.assert = new ModuleContext.Assert(this);

return Object.freeze(this);
}
}

0 comments on commit 9c81523

Please sign in to comment.