Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(env-options): migrate test to reduce cyclic dependencies #1896

Merged
merged 1 commit into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/env-options/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,8 @@ if (capturedEnvironmentOptionNames.length > 0) {
);
}
```

# Note of test migration

To reduce cyclic dependencies, the tests of this module have been moved to
@endo/ses-ava. Doing `yarn test` here currently does nothing.
4 changes: 1 addition & 3 deletions packages/env-options/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@
"lint:types": "tsc",
"build:types": "tsc --build tsconfig.build.json",
"clean:types": "git clean -f '*.d.ts*'",
"test": "ava"
"test": "exit 0"
},
"devDependencies": {
"@endo/init": "^1.0.0",
"@endo/ses-ava": "^1.0.0",
"ava": "^5.3.0",
"babel-eslint": "^10.0.3",
"eslint": "^8.46.0",
Expand Down
9 changes: 0 additions & 9 deletions packages/env-options/test/prepare-test-env-ava.js

This file was deleted.

3 changes: 0 additions & 3 deletions packages/lockdown/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
"lint-fix": "eslint --fix '**/*.js'",
"lint": "eslint '**/*.js'"
},
"devDependencies": {
"ava": "^5.1.1"
},
Comment on lines -15 to -17
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a drive by, but I noticed this was completely unused. Are there any tools to detect dead dependencies? It would seem to be a simple static check.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use depcheck and if I understand it correctly, it should have caught this in its CI job. https://github.com/depcheck/depcheck

"dependencies": {
"ses": "^1.0.0"
},
Expand Down
2 changes: 2 additions & 0 deletions packages/ses-ava/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
"ses": "^1.0.0"
},
"devDependencies": {
"@endo/env-options": "^1.0.0",
"@endo/lockdown": "^1.0.0",
"ava": "^5.3.0",
"babel-eslint": "^10.0.3",
"c8": "^7.14.0",
Expand Down
7 changes: 7 additions & 0 deletions packages/ses-ava/test/prepare-test-env-ava.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import '@endo/lockdown/commit-debug.js';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides migrating, also changed this from '@endo/init/debug.js' to avoid depending on @endo/eventual-send


import rawTest from 'ava';
import { wrapTest } from '../src/ses-ava-test.js';

/** @type {typeof rawTest} */
export const test = wrapTest(rawTest);
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { test } from './prepare-test-env-ava.js';
import { makeEnvironmentCaptor } from '../src/env-options.js';

// eslint-disable-next-line import/order
import { makeEnvironmentCaptor } from '@endo/env-options';

test('test env options empty env', async t => {
const c1 = new Compartment();
Expand Down