Skip to content

Commit

Permalink
fix(ses): make test insensitive to an irrelevant env var (#2403)
Browse files Browse the repository at this point in the history
Closes: #XXXX
Refs: #2383 

## Description

Of the various property override tests, the ones testing the default
`'moderate'` setting were calling `lockdown` without an `overrideTaming`
option, counting on it to default to `'moderate'`. However, if run
locally in an environment where the environment variable
`LOCKDOWN_OVERRIDE_TAMING` was set to something else, the test would
pointlessly misbehave.

This PR merely sets the option explicitly for those cases, so the tests
for the `'moderate'` case are as insensitive to environment variables as
the tests for the other cases.

### Security Considerations

none
### Scaling Considerations

none
### Documentation Considerations

none
### Testing Considerations

The point. The code before this PR would always work correctly under CI.
But the test may pointless fail locally depending on the developers
environment variable settings.
### Compatibility Considerations

none
### Upgrade Considerations

none
  • Loading branch information
erights authored Aug 22, 2024
1 parent 1f2257f commit 8fc0ef7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
5 changes: 4 additions & 1 deletion packages/ses/test/enable-default-overrides-default.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import '../index.js';
import test from 'ava';

lockdown({ __hardenTaming__: 'safe' });
lockdown({
overrideTaming: 'moderate',
__hardenTaming__: 'safe',
});

// See https://github.com/endojs/endo/issues/616#issuecomment-800733101

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import '../index.js';
import test from 'ava';
import { overrideTester } from './override-tester.js';

lockdown({ errorTaming: 'unsafe', __hardenTaming__: 'safe' });
lockdown({
errorTaming: 'unsafe',
overrideTaming: 'moderate',
__hardenTaming__: 'safe',
});

test('property overrides default with unsafe errorTaming', t => {
overrideTester(t, 'Error', Error(), [
Expand Down
6 changes: 5 additions & 1 deletion packages/ses/test/enable-property-overrides-default.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import '../index.js';
import test from 'ava';
import { overrideTester } from './override-tester.js';

lockdown({ errorTaming: 'safe', __hardenTaming__: 'safe' });
lockdown({
errorTaming: 'safe',
overrideTaming: 'moderate',
__hardenTaming__: 'safe',
});

test('enablePropertyOverrides - on', t => {
overrideTester(t, 'Object', {}, ['toString', 'valueOf']);
Expand Down

0 comments on commit 8fc0ef7

Please sign in to comment.